{"id":2722,"date":"2018-10-20T12:16:57","date_gmt":"2018-10-20T11:16:57","guid":{"rendered":"https:\/\/www.aerian.fr\/?p=2722"},"modified":"2020-03-08T13:12:41","modified_gmt":"2020-03-08T12:12:41","slug":"send-location-to-home-assistant-from-macrodroid","status":"publish","type":"post","link":"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/","title":{"rendered":"(Fran\u00e7ais) Send location to Home Assistant from Macrodroid"},"content":{"rendered":"<p>I had problem with the liability of Owntracks for reporting the location into Home Assistant,<br \/>\nplus I wanted to replace my current Android Automation App (Llama) to a supported one.<\/p>\n<p>In order to replace Llama, I found <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.arlosoft.macrodroid&amp;hl=fr\">Macrodroid<\/a> which satisfy my need.<br \/>\nBut I needed to make it work with HA.<\/p>\n<p>I first searched how to use <a href=\"https:\/\/www.home-assistant.io\/components\/device_tracker.mqtt_json\/\">JSON MQTT Device Tracker<\/a> withtout being successful.<br \/>\nThen I came across an article on Reddit about Tasker (https:\/\/www.reddit.com\/r\/homeautomation\/comments\/4iaxi9\/augmenting_location_reporting_with_tasker_and\/)<br \/>\nand I wondered how can I do the same with Macrodroid.<\/p>\n<ol>\n<li>You&#8217;ll need to have a MQTT Broker already configured with Owntracks configuration, get the &#8220;state_topic&#8221;. You can look at <a href=\"https:\/\/www.home-assistant.io\/components\/device_tracker.owntracks\/\">HA documentation<\/a> and <a href=\"https:\/\/www.home-assistant.io\/cookbook\/\">HA examples<\/a> for more informations.<\/li>\n<li>You&#8217;ll need to have Macrodroid App<\/li>\n<li>You&#8217;ll need to have a Tasker MQTT browser, I selected <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=in.dc297.mqttclpro&amp;hl=en_US\" class=\"broken_link\">MQTT Client<\/a><\/li>\n<\/ol>\n<p>First Go into MQTT Client and configure the access to your MQTT server, then go into Macrodroid.<\/p>\n<p>Go to add a new macro, Set &#8220;Regular interval&#8221; as the trigger with the interval you want (think about battery drain), Go into actions and select &#8220;Application&#8221;, &#8220;Local\/Tasker Plugin&#8221;, &#8220;Publish to MQTT Message&#8221;, here select the&nbsp;state_topic you filled in your Home Assistant configuration and use the following message:<\/p>\n<pre class=\"brush:json\">{\"_type\": \"location\",\"acc\": [last_loc_accuracy],\"batt\": [battery],\"lat\": [last_loc_lat],\"lon\": [last_loc_long],\"t\": \"a\",\"tid\": \"me\",\"tst\": [system_time]}\r\n<\/pre>\n<p>Validate your action, you can check if it work by clicking on &#8220;Test action&#8221;. With this you should be able to see the message in the MQTT topic similar to:<\/p>\n<pre class=\"brush:json\">{\"_type\": \"location\",\"acc\": 40,\"batt\": 82,\"lat\": 42.836495,\"lon\": 2.5897,\"t\": \"a\",\"tid\": \"lince\",\"tst\": 1540032120}\r\n<\/pre>\n<p>Add contraints, &#8220;Mobile data: on&#8221; and &#8220;Wifi connected&#8221;, and save the configuration.<br \/>\nYou&#8217;ll then be able to send periodically your location to your Home Assistant.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had problem with the liability of Owntracks for reporting the location into Home Assistant, plus I wanted to replace my current [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2724,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[221],"tags":[237,238],"class_list":["post-2722","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-system","tag-android","tag-ha"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>(Fran\u00e7ais) Send location to Home Assistant from Macrodroid - Aerian.fr<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"(Fran\u00e7ais) Send location to Home Assistant from Macrodroid - Aerian.fr\" \/>\n<meta property=\"og:description\" content=\"I had problem with the liability of Owntracks for reporting the location into Home Assistant, plus I wanted to replace my current [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/\" \/>\n<meta property=\"og:site_name\" content=\"Aerian.fr\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-20T11:16:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-08T12:12:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2018\/10\/Yfaqd9hb_400x400.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"400\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"42\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@LinceAerian\" \/>\n<meta name=\"twitter:site\" content=\"@LinceAerian\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"42\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.aerian.fr\/send-location-to-home-assistant-from-macrodroid\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.aerian.fr\/send-location-to-home-assistant-from-macrodroid\/\"},\"author\":{\"name\":\"42\",\"@id\":\"https:\/\/www.aerian.fr\/#\/schema\/person\/622c3cefbea11a0be741137608b4bf8b\"},\"headline\":\"(Fran\u00e7ais) Send location to Home Assistant from Macrodroid\",\"datePublished\":\"2018-10-20T11:16:57+00:00\",\"dateModified\":\"2020-03-08T12:12:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.aerian.fr\/send-location-to-home-assistant-from-macrodroid\/\"},\"wordCount\":281,\"publisher\":{\"@id\":\"https:\/\/www.aerian.fr\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.aerian.fr\/send-location-to-home-assistant-from-macrodroid\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2018\/10\/Yfaqd9hb_400x400.jpg\",\"keywords\":[\"android\",\"ha\"],\"articleSection\":[\"System\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/\",\"url\":\"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/\",\"name\":\"(Fran\u00e7ais) Send location to Home Assistant from Macrodroid - Aerian.fr\",\"isPartOf\":{\"@id\":\"https:\/\/www.aerian.fr\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.aerian.fr\/send-location-to-home-assistant-from-macrodroid\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2018\/10\/Yfaqd9hb_400x400.jpg\",\"datePublished\":\"2018-10-20T11:16:57+00:00\",\"dateModified\":\"2020-03-08T12:12:41+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[[\"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/\"]]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/#primaryimage\",\"url\":\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2018\/10\/Yfaqd9hb_400x400.jpg\",\"contentUrl\":\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2018\/10\/Yfaqd9hb_400x400.jpg\",\"width\":400,\"height\":400},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.aerian.fr\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Send location to Home Assistant from Macrodroid\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.aerian.fr\/en\/#website\",\"url\":\"https:\/\/www.aerian.fr\/en\/\",\"name\":\"Aerian.fr\",\"description\":\"Welcome to Aerian.fr\",\"publisher\":{\"@id\":\"https:\/\/www.aerian.fr\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.aerian.fr\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.aerian.fr\/en\/#organization\",\"name\":\"Aerian.fr\",\"url\":\"https:\/\/www.aerian.fr\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.aerian.fr\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2012\/01\/logo.png\",\"contentUrl\":\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2012\/01\/logo.png\",\"width\":667,\"height\":522,\"caption\":\"Aerian.fr\"},\"image\":{\"@id\":\"https:\/\/www.aerian.fr\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/LinceAerian\",\"https:\/\/www.linkedin.com\/in\/marleixmathieu\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.aerian.fr\/#\/schema\/person\/622c3cefbea11a0be741137608b4bf8b\",\"name\":\"42\",\"sameAs\":[\"http:\/\/www.aerian.fr\"],\"url\":\"https:\/\/www.aerian.fr\/en\/author\/lince\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"(Fran\u00e7ais) Send location to Home Assistant from Macrodroid - Aerian.fr","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/","og_locale":"en_US","og_type":"article","og_title":"(Fran\u00e7ais) Send location to Home Assistant from Macrodroid - Aerian.fr","og_description":"I had problem with the liability of Owntracks for reporting the location into Home Assistant, plus I wanted to replace my current [&hellip;]","og_url":"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/","og_site_name":"Aerian.fr","article_published_time":"2018-10-20T11:16:57+00:00","article_modified_time":"2020-03-08T12:12:41+00:00","og_image":[{"width":400,"height":400,"url":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2018\/10\/Yfaqd9hb_400x400.jpg","type":"image\/jpeg"}],"author":"42","twitter_card":"summary_large_image","twitter_creator":"@LinceAerian","twitter_site":"@LinceAerian","twitter_misc":{"Written by":"42","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.aerian.fr\/send-location-to-home-assistant-from-macrodroid\/#article","isPartOf":{"@id":"https:\/\/www.aerian.fr\/send-location-to-home-assistant-from-macrodroid\/"},"author":{"name":"42","@id":"https:\/\/www.aerian.fr\/#\/schema\/person\/622c3cefbea11a0be741137608b4bf8b"},"headline":"(Fran\u00e7ais) Send location to Home Assistant from Macrodroid","datePublished":"2018-10-20T11:16:57+00:00","dateModified":"2020-03-08T12:12:41+00:00","mainEntityOfPage":{"@id":"https:\/\/www.aerian.fr\/send-location-to-home-assistant-from-macrodroid\/"},"wordCount":281,"publisher":{"@id":"https:\/\/www.aerian.fr\/#organization"},"image":{"@id":"https:\/\/www.aerian.fr\/send-location-to-home-assistant-from-macrodroid\/#primaryimage"},"thumbnailUrl":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2018\/10\/Yfaqd9hb_400x400.jpg","keywords":["android","ha"],"articleSection":["System"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/","url":"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/","name":"(Fran\u00e7ais) Send location to Home Assistant from Macrodroid - Aerian.fr","isPartOf":{"@id":"https:\/\/www.aerian.fr\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/#primaryimage"},"image":{"@id":"https:\/\/www.aerian.fr\/send-location-to-home-assistant-from-macrodroid\/#primaryimage"},"thumbnailUrl":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2018\/10\/Yfaqd9hb_400x400.jpg","datePublished":"2018-10-20T11:16:57+00:00","dateModified":"2020-03-08T12:12:41+00:00","breadcrumb":{"@id":"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":[["https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/"]]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/#primaryimage","url":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2018\/10\/Yfaqd9hb_400x400.jpg","contentUrl":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2018\/10\/Yfaqd9hb_400x400.jpg","width":400,"height":400},{"@type":"BreadcrumbList","@id":"https:\/\/www.aerian.fr\/en\/send-location-to-home-assistant-from-macrodroid\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.aerian.fr\/en\/"},{"@type":"ListItem","position":2,"name":"Send location to Home Assistant from Macrodroid"}]},{"@type":"WebSite","@id":"https:\/\/www.aerian.fr\/en\/#website","url":"https:\/\/www.aerian.fr\/en\/","name":"Aerian.fr","description":"Welcome to Aerian.fr","publisher":{"@id":"https:\/\/www.aerian.fr\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.aerian.fr\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.aerian.fr\/en\/#organization","name":"Aerian.fr","url":"https:\/\/www.aerian.fr\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.aerian.fr\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2012\/01\/logo.png","contentUrl":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2012\/01\/logo.png","width":667,"height":522,"caption":"Aerian.fr"},"image":{"@id":"https:\/\/www.aerian.fr\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/LinceAerian","https:\/\/www.linkedin.com\/in\/marleixmathieu"]},{"@type":"Person","@id":"https:\/\/www.aerian.fr\/#\/schema\/person\/622c3cefbea11a0be741137608b4bf8b","name":"42","sameAs":["http:\/\/www.aerian.fr"],"url":"https:\/\/www.aerian.fr\/en\/author\/lince\/"}]}},"_links":{"self":[{"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/posts\/2722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/comments?post=2722"}],"version-history":[{"count":3,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/posts\/2722\/revisions"}],"predecessor-version":[{"id":2768,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/posts\/2722\/revisions\/2768"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/media\/2724"}],"wp:attachment":[{"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/media?parent=2722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/categories?post=2722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/tags?post=2722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}