{"id":70,"date":"2017-11-27T03:43:15","date_gmt":"2017-11-27T03:43:15","guid":{"rendered":"http:\/\/www.diyfuturism.com\/?p=70"},"modified":"2018-01-22T14:27:36","modified_gmt":"2018-01-22T22:27:36","slug":"useful-sensor-improving-presence-detection-with-node-red","status":"publish","type":"post","link":"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/","title":{"rendered":"Presence Detection Part 2: Improving Presence with Node-Red"},"content":{"rendered":"<p>In my <a href=\"http:\/\/www.diyfuturism.com\/index.php\/2017\/11\/26\/presence-detection-with-home-assistant-bayesian-probability\/\">previous post about presence detection<\/a>, I showed how you can combine multiple device trackers into one highly accurate Bayesian sensor.<\/p>\n<p>In Home Assistant, this new <em>binary_sensor<\/em> that I created is either <strong>on<\/strong> or <strong>off<\/strong>. It would be a little nicer if it were a <em>device_tracker<\/em>\u00a0entity instead that was either <strong>home<\/strong> or <strong>not home<\/strong>.<\/p>\n<p>With Node-Red that&#8217;s easy enough, but what if we take it a step further and create our own custom <em>device_tracker<\/em> based on a different set of rules altogether?<\/p>\n<p><!--more--><\/p>\n<div id=\"amzn-assoc-ad-8ba45d28-72f3-4d97-89af-ef96de2a7468\"><\/div>\n<p><script async src=\"\/\/z-na.amazon-adsystem.com\/widgets\/onejs?MarketPlace=US&#038;adInstanceId=8ba45d28-72f3-4d97-89af-ef96de2a7468\"><\/script><\/p>\n<h2>CONVERT BINARY SENSOR TO DEVICE TRACKER<\/h2>\n<div id=\"attachment_71\" style=\"width: 740px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-71\" data-attachment-id=\"71\" data-permalink=\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/screen-shot-2017-11-26-at-7-12-58-pm\/\" data-orig-file=\"https:\/\/i2.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.12.58-PM.png?fit=1166%2C286&amp;ssl=1\" data-orig-size=\"1166,286\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i2.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.12.58-PM.png?fit=300%2C74&amp;ssl=1\" data-large-file=\"https:\/\/i2.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.12.58-PM.png?fit=854%2C209&amp;ssl=1\" loading=\"lazy\" class=\"wp-image-71 size-large\" src=\"https:\/\/i1.wp.com\/www.diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.12.58-PM-1024x251.png?resize=730%2C179\" alt=\"\" width=\"730\" height=\"179\" srcset=\"https:\/\/i2.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.12.58-PM.png?resize=1024%2C251&amp;ssl=1 1024w, https:\/\/i2.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.12.58-PM.png?resize=600%2C147&amp;ssl=1 600w, https:\/\/i2.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.12.58-PM.png?resize=300%2C74&amp;ssl=1 300w, https:\/\/i2.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.12.58-PM.png?resize=768%2C188&amp;ssl=1 768w, https:\/\/i2.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.12.58-PM.png?w=1166&amp;ssl=1 1166w\" sizes=\"(max-width: 730px) 100vw, 730px\" data-recalc-dims=\"1\" \/><p id=\"caption-attachment-71\" class=\"wp-caption-text\">Node Red Flow to Convert to Device Tracker<\/p><\/div>\n<p>The input is an inject node, set to send a message once every minute. It then gets the state of the <em>binary_sensor.brad_presence\u00a0<\/em>entity and returns it&#8217;s state as the message. The switch evaluates that message:\u00a0<strong>on<\/strong> goes up to set my new device_tracker home,\u00a0<strong>off<\/strong> goes down to a different service call to set it away.<\/p>\n<p>I am using the device_tracker.see service call in the output, configured like so:<\/p>\n<div id=\"attachment_72\" style=\"width: 740px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-72\" data-attachment-id=\"72\" data-permalink=\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/screen-shot-2017-11-26-at-7-18-01-pm\/\" data-orig-file=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.18.01-PM.png?fit=1066%2C600&amp;ssl=1\" data-orig-size=\"1066,600\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;device_tracker.see service call node&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.18.01-PM.png?fit=300%2C169&amp;ssl=1\" data-large-file=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.18.01-PM.png?fit=854%2C480&amp;ssl=1\" loading=\"lazy\" class=\"wp-image-72 size-large\" src=\"https:\/\/i0.wp.com\/www.diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.18.01-PM-1024x576.png?resize=730%2C411\" alt=\"\" width=\"730\" height=\"411\" srcset=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.18.01-PM.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.18.01-PM.png?resize=600%2C338&amp;ssl=1 600w, https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.18.01-PM.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.18.01-PM.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.18.01-PM.png?w=1066&amp;ssl=1 1066w\" sizes=\"(max-width: 730px) 100vw, 730px\" data-recalc-dims=\"1\" \/><p id=\"caption-attachment-72\" class=\"wp-caption-text\">Node Red Service Call Options<\/p><\/div>\n<p>This creates a <em>device_tracker.brad_bayesian\u00a0<\/em>entity to use like any other.<\/p>\n<p>Copy the JSON below to import this flow into your Node-Red.<\/p>\n<pre><span class=\"br0\">[<\/span><span class=\"br0\">{<\/span><span class=\"st0\">\"id\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"763070f9.0c571\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"type\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"switch\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"z\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"4056fc4f.0baa64\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"name\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"property\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"payload\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"propertyType\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"msg\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"rules\"<\/span><span class=\"sy0\">:<\/span><span class=\"br0\">[<\/span><span class=\"br0\">{<\/span><span class=\"st0\">\"t\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"eq\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"v\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"on\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"vt\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"str\"<\/span><span class=\"br0\">}<\/span><span class=\"sy0\">,<\/span><span class=\"br0\">{<\/span><span class=\"st0\">\"t\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"eq\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"v\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"off\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"vt\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"str\"<\/span><span class=\"br0\">}<\/span><span class=\"br0\">]<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"checkall\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"true\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"outputs\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">2<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"x\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">1316.9999771118164<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"y\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">301.00000381469727<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"wires\"<\/span><span class=\"sy0\">:<\/span><span class=\"br0\">[<\/span><span class=\"br0\">[<\/span><span class=\"st0\">\"57b903a4.bd2f6c\"<\/span><span class=\"br0\">]<\/span><span class=\"sy0\">,<\/span><span class=\"br0\">[<\/span><span class=\"st0\">\"a080246.03d5ed8\"<\/span><span class=\"br0\">]<\/span><span class=\"br0\">]<\/span><span class=\"br0\">}<\/span><span class=\"sy0\">,<\/span><span class=\"br0\">{<\/span><span class=\"st0\">\"id\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"57b903a4.bd2f6c\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"type\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"api-call-service\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"z\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"4056fc4f.0baa64\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"name\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"Set Presence Home\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"server\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"8ac3cd7f.58d3e\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"service_domain\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"device_tracker\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"service\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"see\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"data\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"{<span class=\"es0\">\\\"<\/span>dev_id<span class=\"es0\">\\\"<\/span>:<span class=\"es0\">\\\"<\/span>brad_bayesian<span class=\"es0\">\\\"<\/span>,<span class=\"es0\">\\\"<\/span>location_name<span class=\"es0\">\\\"<\/span>:<span class=\"es0\">\\\"<\/span>home<span class=\"es0\">\\\"<\/span>}\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"x\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">1510.3333740234375<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"y\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">272.6667175292969<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"wires\"<\/span><span class=\"sy0\">:<\/span><span class=\"br0\">[<\/span><span class=\"br0\">]<\/span><span class=\"br0\">}<\/span><span class=\"sy0\">,<\/span><span class=\"br0\">{<\/span><span class=\"st0\">\"id\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"a080246.03d5ed8\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"type\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"api-call-service\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"z\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"4056fc4f.0baa64\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"name\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"Set Presence Not Home\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"server\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"8ac3cd7f.58d3e\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"service_domain\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"device_tracker\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"service\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"see\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"data\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"{<span class=\"es0\">\\\"<\/span>dev_id<span class=\"es0\">\\\"<\/span>:<span class=\"es0\">\\\"<\/span>brad_bayesian<span class=\"es0\">\\\"<\/span>,<span class=\"es0\">\\\"<\/span>location_name<span class=\"es0\">\\\"<\/span>:<span class=\"es0\">\\\"<\/span>not_home<span class=\"es0\">\\\"<\/span>}\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"x\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">1520.3333282470703<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"y\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">335.99999380111694<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"wires\"<\/span><span class=\"sy0\">:<\/span><span class=\"br0\">[<\/span><span class=\"br0\">]<\/span><span class=\"br0\">}<\/span><span class=\"sy0\">,<\/span><span class=\"br0\">{<\/span><span class=\"st0\">\"id\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"afb02bc5.351e68\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"type\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"comment\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"z\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"4056fc4f.0baa64\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"name\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"Convert Bayesian Sensor into Device Tracker\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"info\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"x\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">1015.0000381469727<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"y\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">252.00008296966553<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"wires\"<\/span><span class=\"sy0\">:<\/span><span class=\"br0\">[<\/span><span class=\"br0\">]<\/span><span class=\"br0\">}<\/span><span class=\"sy0\">,<\/span><span class=\"br0\">{<\/span><span class=\"st0\">\"id\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"a86ac3f0.00c67\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"type\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"inject\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"z\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"4056fc4f.0baa64\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"name\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"topic\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"payload\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"payloadType\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"date\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"repeat\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"10\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"crontab\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"once\"<\/span><span class=\"sy0\">:<\/span><span class=\"kw2\">false<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"x\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">942.3333129882812<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"y\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">300.6665403842926<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"wires\"<\/span><span class=\"sy0\">:<\/span><span class=\"br0\">[<\/span><span class=\"br0\">[<\/span><span class=\"st0\">\"d43007ca.720b78\"<\/span><span class=\"br0\">]<\/span><span class=\"br0\">]<\/span><span class=\"br0\">}<\/span><span class=\"sy0\">,<\/span><span class=\"br0\">{<\/span><span class=\"st0\">\"id\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"d43007ca.720b78\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"type\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"api-current-state\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"z\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"4056fc4f.0baa64\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"name\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"Bayesian Presence\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"server\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"8ac3cd7f.58d3e\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"halt_if\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"entity_id\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"binary_sensor.bayesian_presence\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"x\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">1142.3333892822266<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"y\"<\/span><span class=\"sy0\">:<\/span><span class=\"nu0\">300.66639733314514<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"wires\"<\/span><span class=\"sy0\">:<\/span><span class=\"br0\">[<\/span><span class=\"br0\">[<\/span><span class=\"st0\">\"763070f9.0c571\"<\/span><span class=\"br0\">]<\/span><span class=\"br0\">]<\/span><span class=\"br0\">}<\/span><span class=\"sy0\">,<\/span><span class=\"br0\">{<\/span><span class=\"st0\">\"id\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"8ac3cd7f.58d3e\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"type\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"server\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"z\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"name\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"Home Assistant\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"url\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"http:\/\/HASSIP:8123\"<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">\"pass\"<\/span><span class=\"sy0\">:<\/span><span class=\"st0\">\"XXX\"<\/span><span class=\"br0\">}<\/span><span class=\"br0\">]<\/span><\/pre>\n<p><a href=\"https:\/\/pastebin.com\/FYA4N3FG\">https:\/\/pastebin.com\/FYA4N3FG<\/a><\/p>\n<p><script type=\"text\/javascript\">\namzn_assoc_placement = \"adunit0\";\namzn_assoc_tracking_id = \"diyfuturism-20\";\namzn_assoc_ad_mode = \"search\";\namzn_assoc_ad_type = \"smart\";\namzn_assoc_marketplace = \"amazon\";\namzn_assoc_region = \"US\";\namzn_assoc_default_search_phrase = \"smart lighting\";\namzn_assoc_default_category = \"All\";\namzn_assoc_linkid = \"a8e23f8e04967420d066fd3bab467880\";\namzn_assoc_design = \"in_content\";\n<\/script><br \/>\n<script src=\"\/\/z-na.amazon-adsystem.com\/widgets\/onejs?MarketPlace=US\"><\/script><\/p>\n<h2>CREATING AN IMPROVED DEVICE TRACKER<\/h2>\n<p>I walk my dog over to a park close by a few times a day. This was causing my house to shut down, turn the music off, etc. and then turn everything back on to a blank slate every time I walked out.<\/p>\n<p>I tried a few work arounds with delays and iBeacons, but really I just wanted my bayesian sensor to weight it&#8217;s probability slightly more towards\u00a0<strong>home<\/strong> if I was walking to the park.<\/p>\n<p><img data-attachment-id=\"73\" data-permalink=\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/screen-shot-2017-11-26-at-7-30-26-pm\/\" data-orig-file=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?fit=1496%2C770&amp;ssl=1\" data-orig-size=\"1496,770\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screen Shot 2017-11-26 at 7.30.26 PM\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Creating a new device tracker&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?fit=300%2C154&amp;ssl=1\" data-large-file=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?fit=854%2C440&amp;ssl=1\" loading=\"lazy\" class=\"aligncenter wp-image-73 size-large\" src=\"https:\/\/i2.wp.com\/www.diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM-1024x527.png?resize=730%2C376\" alt=\"Node Red Flow for Creating Device Tracker\" width=\"730\" height=\"376\" srcset=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?resize=1024%2C527&amp;ssl=1 1024w, https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?resize=600%2C309&amp;ssl=1 600w, https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?resize=300%2C154&amp;ssl=1 300w, https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?resize=768%2C395&amp;ssl=1 768w, https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?w=1496&amp;ssl=1 1496w\" sizes=\"(max-width: 730px) 100vw, 730px\" data-recalc-dims=\"1\" \/><\/p>\n<p>On the left as inputs, I have 3 different GPS tracking platforms &#8211; the Home Assistant iOS app, my Tile tracker, and Owntracks. I format the GPS signal, and then send it into two <a href=\"https:\/\/flows.nodered.org\/node\/node-red-node-geofence\">geofence nodes<\/a>.<\/p>\n<div id=\"attachment_74\" style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-74\" data-attachment-id=\"74\" data-permalink=\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/screen-shot-2017-11-26-at-7-36-08-pm\/\" data-orig-file=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.36.08-PM.png?fit=990%2C1022&amp;ssl=1\" data-orig-size=\"990,1022\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screen Shot 2017-11-26 at 7.36.08 PM\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Not my neighborhood, but looks like a good spot for dogwalking&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.36.08-PM.png?fit=291%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.36.08-PM.png?fit=854%2C882&amp;ssl=1\" loading=\"lazy\" class=\"wp-image-74 size-full\" src=\"https:\/\/i2.wp.com\/www.diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.36.08-PM.png?resize=854%2C882\" alt=\"Creating a Geofence in the Node Options\" width=\"854\" height=\"882\" srcset=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.36.08-PM.png?w=990&amp;ssl=1 990w, https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.36.08-PM.png?resize=600%2C619&amp;ssl=1 600w, https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.36.08-PM.png?resize=291%2C300&amp;ssl=1 291w, https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.36.08-PM.png?resize=768%2C793&amp;ssl=1 768w\" sizes=\"(max-width: 854px) 100vw, 854px\" data-recalc-dims=\"1\" \/><p id=\"caption-attachment-74\" class=\"wp-caption-text\">Not my neighborhood, but looks like a good spot for dogwalking<\/p><\/div>\n<p>The last function node in the flow marked &#8220;GPS&#8221; formats the GPS signal into data that Home Assistant can use, so our new device_tracker also contains the GPS data of the original source (our inputs, on the left). Anything sent in the &#8220;data&#8221; container like this will override the &#8220;data&#8221; field in the Home Assistant service output node.<\/p>\n<p>Copy the JSON below to import into your Node-Red to see for yourself:<\/p>\n<pre>[{\"id\":\"274f638d.ec8f8c\",\"type\":\"api-call-service\",\"z\":\"4056fc4f.0baa64\",\"name\":\"Node Red Presence not_home\",\"server\":\"8ac3cd7f.58d3e\",\"service_domain\":\"device_tracker\",\"service\":\"see\",\"data\":\"{\\\"dev_id\\\":\\\"you_nodered\\\",\\\"location_name\\\":\\\"not_home\\\"}\",\"x\":1467.8095474243164,\"y\":403.9643292427063,\"wires\":[]},{\"id\":\"b72e2804.d59b08\",\"type\":\"api-call-service\",\"z\":\"4056fc4f.0baa64\",\"name\":\"Node Red Presence home\",\"server\":\"8ac3cd7f.58d3e\",\"service_domain\":\"device_tracker\",\"service\":\"see\",\"data\":\"{\\\"dev_id\\\":\\\"you_nodered\\\",\\\"location_name\\\":\\\"home\\\"}\",\"x\":1457.8094329833984,\"y\":333.2976927757263,\"wires\":[]},{\"id\":\"be995292.1ddc4\",\"type\":\"comment\",\"z\":\"4056fc4f.0baa64\",\"name\":\"Create Device Tracker\",\"info\":\"\",\"x\":1460.8095932006836,\"y\":293.9643611907959,\"wires\":[]},{\"id\":\"e63f1260.978e2\",\"type\":\"comment\",\"z\":\"4056fc4f.0baa64\",\"name\":\"Home or Not?\",\"info\":\"\",\"x\":1031.3452911376953,\"y\":372.33337688446045,\"wires\":[]},{\"id\":\"d4e1c95c.1f67e8\",\"type\":\"function\",\"z\":\"4056fc4f.0baa64\",\"name\":\"GPS\",\"func\":\"newmsg = {};\\nnewmsg.payload = { data: {'gps': [msg.payload.lat,msg.payload.lon] } };\\nreturn newmsg;\",\"outputs\":1,\"noerr\":0,\"x\":1258.6432456970215,\"y\":334.2023983001709,\"wires\":[[\"b72e2804.d59b08\"]]},{\"id\":\"2d1f97bf.d24a98\",\"type\":\"function\",\"z\":\"4056fc4f.0baa64\",\"name\":\"GPS\",\"func\":\"newmsg = {};\\nnewmsg.payload = { data: {'gps': [msg.payload.lat,msg.payload.lon] } };\\nreturn newmsg;\",\"outputs\":1,\"noerr\":0,\"x\":1257.8097114562988,\"y\":403.8691101074219,\"wires\":[[\"274f638d.ec8f8c\"]]},{\"id\":\"739a62d6.c7e47c\",\"type\":\"geofence\",\"z\":\"4056fc4f.0baa64\",\"name\":\"Inside Home Zone\",\"mode\":\"circle\",\"inside\":\"true\",\"rad\":0,\"points\":[],\"centre\":{\"latitude\":0,\"longitude\":0},\"x\":1025.625015258789,\"y\":322.5000047683716,\"wires\":[[\"d4e1c95c.1f67e8\"]]},{\"id\":\"f52b241a.4d2f78\",\"type\":\"geofence\",\"z\":\"4056fc4f.0baa64\",\"name\":\"Outside Home Zone\",\"mode\":\"circle\",\"inside\":\"false\",\"rad\":0,\"points\":[],\"centre\":{\"latitude\":0,\"longitude\":0},\"x\":1034.9999961853027,\"y\":418.7499952316284,\"wires\":[[\"2d1f97bf.d24a98\"]]},{\"id\":\"8ac3cd7f.58d3e\",\"type\":\"server\",\"z\":\"\",\"name\":\"Home Assistant\",\"url\":\"http:\/\/HASSIP:8123\",\"pass\":\"XXXXX\"}]<\/pre>\n<p><a href=\"https:\/\/pastebin.com\/BCc3Nc5Z\">https:\/\/pastebin.com\/BCc3Nc5Z<\/a><\/p>\n<p>In this way we create yet another piece of presence data for our Bayesian sensor to evaluate, so that a quick walk around to the nearby park doesn&#8217;t arm the house like we&#8217;re gone for good.<br \/>\n<script type=\"text\/javascript\">\namzn_assoc_placement = \"adunit0\";\namzn_assoc_tracking_id = \"diyfuturism-20\";\namzn_assoc_ad_mode = \"search\";\namzn_assoc_ad_type = \"smart\";\namzn_assoc_marketplace = \"amazon\";\namzn_assoc_region = \"US\";\namzn_assoc_default_search_phrase = \"smart lighting\";\namzn_assoc_default_category = \"All\";\namzn_assoc_linkid = \"a8e23f8e04967420d066fd3bab467880\";\namzn_assoc_design = \"in_content\";\n<\/script><br \/>\n<script src=\"\/\/z-na.amazon-adsystem.com\/widgets\/onejs?MarketPlace=US\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"wpm_excerpt clearfix\"><p>In my previous post about presence detection, I showed how you can combine multiple device trackers into one highly accurate Bayesian sensor. In Home Assistant, this &hellip;<\/p>\n<\/div>","protected":false},"author":1,"featured_media":73,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[8,7,11,9],"tags":[45,43,46,36,42,44],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Presence Detection Part 2: Improving Presence with Node-Red - DIY Futurism<\/title>\n<meta name=\"description\" content=\"Tracking your phone&#039;s position with Node-Red, Home Assistant, and custom geofences to improve presence detection for home automation systems.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Presence Detection Part 2: Improving Presence with Node-Red - DIY Futurism\" \/>\n<meta property=\"og:description\" content=\"Tracking your phone&#039;s position with Node-Red, Home Assistant, and custom geofences to improve presence detection for home automation systems.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/\" \/>\n<meta property=\"og:site_name\" content=\"DIY Futurism\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-27T03:43:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-22T22:27:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?fit=1496%2C770&#038;ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1496\" \/>\n\t<meta property=\"og:image:height\" content=\"770\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@diyfuturism\" \/>\n<meta name=\"twitter:site\" content=\"@diyfuturism\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"brad\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/diyfuturism.com\/#website\",\"url\":\"https:\/\/diyfuturism.com\/\",\"name\":\"DIY Futurism\",\"description\":\"Adventures in Open Source Smart Home Projects\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/diyfuturism.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?fit=1496%2C770&ssl=1\",\"contentUrl\":\"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?fit=1496%2C770&ssl=1\",\"width\":1496,\"height\":770,\"caption\":\"Creating a new device tracker\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/#webpage\",\"url\":\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/\",\"name\":\"Presence Detection Part 2: Improving Presence with Node-Red - DIY Futurism\",\"isPartOf\":{\"@id\":\"https:\/\/diyfuturism.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/#primaryimage\"},\"datePublished\":\"2017-11-27T03:43:15+00:00\",\"dateModified\":\"2018-01-22T22:27:36+00:00\",\"author\":{\"@id\":\"https:\/\/diyfuturism.com\/#\/schema\/person\/b93619fac07567640bd87cc613a55b7c\"},\"description\":\"Tracking your phone's position with Node-Red, Home Assistant, and custom geofences to improve presence detection for home automation systems.\",\"breadcrumb\":{\"@id\":\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/diyfuturism.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Presence Detection Part 2: Improving Presence with Node-Red\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/diyfuturism.com\/#\/schema\/person\/b93619fac07567640bd87cc613a55b7c\",\"name\":\"brad\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/diyfuturism.com\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7e2d60eb1f322b4ad6040a746946a361?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7e2d60eb1f322b4ad6040a746946a361?s=96&d=mm&r=g\",\"caption\":\"brad\"},\"description\":\"I'm a professional artist who likes to tinker with building things in my spare time.\",\"sameAs\":[\"https:\/\/twitter.com\/@diyfuturism\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Presence Detection Part 2: Improving Presence with Node-Red - DIY Futurism","description":"Tracking your phone's position with Node-Red, Home Assistant, and custom geofences to improve presence detection for home automation systems.","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:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/","og_locale":"en_US","og_type":"article","og_title":"Presence Detection Part 2: Improving Presence with Node-Red - DIY Futurism","og_description":"Tracking your phone's position with Node-Red, Home Assistant, and custom geofences to improve presence detection for home automation systems.","og_url":"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/","og_site_name":"DIY Futurism","article_published_time":"2017-11-27T03:43:15+00:00","article_modified_time":"2018-01-22T22:27:36+00:00","og_image":[{"width":1496,"height":770,"url":"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?fit=1496%2C770&ssl=1","path":"\/var\/www\/html\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png","size":"full","id":73,"alt":"","pixels":1151920,"type":"image\/png"}],"twitter_card":"summary_large_image","twitter_creator":"@diyfuturism","twitter_site":"@diyfuturism","twitter_misc":{"Written by":"brad","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/diyfuturism.com\/#website","url":"https:\/\/diyfuturism.com\/","name":"DIY Futurism","description":"Adventures in Open Source Smart Home Projects","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/diyfuturism.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/#primaryimage","inLanguage":"en-US","url":"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?fit=1496%2C770&ssl=1","contentUrl":"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?fit=1496%2C770&ssl=1","width":1496,"height":770,"caption":"Creating a new device tracker"},{"@type":"WebPage","@id":"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/#webpage","url":"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/","name":"Presence Detection Part 2: Improving Presence with Node-Red - DIY Futurism","isPartOf":{"@id":"https:\/\/diyfuturism.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/#primaryimage"},"datePublished":"2017-11-27T03:43:15+00:00","dateModified":"2018-01-22T22:27:36+00:00","author":{"@id":"https:\/\/diyfuturism.com\/#\/schema\/person\/b93619fac07567640bd87cc613a55b7c"},"description":"Tracking your phone's position with Node-Red, Home Assistant, and custom geofences to improve presence detection for home automation systems.","breadcrumb":{"@id":"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/diyfuturism.com\/index.php\/2017\/11\/27\/useful-sensor-improving-presence-detection-with-node-red\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/diyfuturism.com\/"},{"@type":"ListItem","position":2,"name":"Presence Detection Part 2: Improving Presence with Node-Red"}]},{"@type":"Person","@id":"https:\/\/diyfuturism.com\/#\/schema\/person\/b93619fac07567640bd87cc613a55b7c","name":"brad","image":{"@type":"ImageObject","@id":"https:\/\/diyfuturism.com\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/7e2d60eb1f322b4ad6040a746946a361?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7e2d60eb1f322b4ad6040a746946a361?s=96&d=mm&r=g","caption":"brad"},"description":"I'm a professional artist who likes to tinker with building things in my spare time.","sameAs":["https:\/\/twitter.com\/@diyfuturism"]}]}},"jetpack_featured_media_url":"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-7.30.26-PM.png?fit=1496%2C770&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9q0Cl-18","jetpack-related-posts":[{"id":34,"url":"https:\/\/diyfuturism.com\/index.php\/2017\/11\/26\/presence-detection-with-home-assistant-bayesian-probability\/","url_meta":{"origin":70,"position":0},"title":"Presence Detection Part 1: Home Assistant &#038; Bayesian Probability","date":"November 26, 2017","format":false,"excerpt":"One of the most useful things to track for home automation is whether anyone is home or not. If you want the lights to turn off when no one is home, the vacuum robot to run when you're at work, or the heat to come on before you arrive home\u2026","rel":"","context":"In &quot;Config&quot;","img":{"alt_text":"","src":"https:\/\/i2.wp.com\/www.diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-25-at-8.31.52-PM.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":469,"url":"https:\/\/diyfuturism.com\/index.php\/2018\/03\/13\/location-aware-notification-lights-node-red-ifttt\/","url_meta":{"origin":70,"position":1},"title":"Location Aware Notification Lights with Node-Red and IFTTT","date":"March 13, 2018","format":false,"excerpt":"I am in the habit of going on cooking sprees while listening to music... loudly. I only share one wall with a neighbor here in the loft, and that neighbor is very tolerant. On a Sunday afternoon, with multiple dishes going at a time, my most used smart home feature\u2026","rel":"","context":"In &quot;Home Assistant&quot;","img":{"alt_text":"Connecting Node Red and IFTTT","src":"https:\/\/i0.wp.com\/diyfuturism.com\/wp-content\/uploads\/2018\/03\/36159691101_b469c9a91f_k.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":718,"url":"https:\/\/diyfuturism.com\/index.php\/2018\/07\/30\/automate-dumb-devices-ir-node-red-home-assistant\/","url_meta":{"origin":70,"position":2},"title":"Automating Dumb Devices with Node-Red and Home Assistant","date":"July 30, 2018","format":false,"excerpt":"Here in coastal California, air conditioning is extremely uncommon. So during a recent heat wave, I got desperate and went down to the big box store in search of some relief and came home with a regular old dumb fan. I'm sure this is the kind of gadget you could\u2026","rel":"","context":"In &quot;Hardware&quot;","img":{"alt_text":"Automating a Dumb Fan","src":"https:\/\/i0.wp.com\/diyfuturism.com\/wp-content\/uploads\/2018\/07\/Screenshot-from-2018-07-30-125551.png?fit=939%2C759&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":16,"url":"https:\/\/diyfuturism.com\/index.php\/2017\/11\/26\/big-list-of-home-automation-nodes-for-node-red\/","url_meta":{"origin":70,"position":3},"title":"Big List of Useful Home Automation Nodes for Node-Red","date":"November 26, 2017","format":false,"excerpt":"An ongoing list of nodes I have found useful for constructing home automation flows. I have not included device platform nodes, as all state tracking and actions are performed in Home Assistant.","rel":"","context":"In &quot;Node-Red&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":22,"url":"https:\/\/diyfuturism.com\/index.php\/2017\/11\/26\/the-open-source-smart-home-getting-started-with-home-assistant-node-red\/","url_meta":{"origin":70,"position":4},"title":"The Open Source Smart Home: Getting Started with Home Assistant &#038; Node-Red","date":"November 26, 2017","format":false,"excerpt":"Home Assistant is one of the most interesting open source projects I've ever come across. It interfaces with any device, platform, or service you can think of. It can connect all of your devices to make a truly smart home. With a little creativity almost anything is possible with Home\u2026","rel":"","context":"In &quot;Config&quot;","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/11\/Screen-Shot-2017-11-26-at-10.43.33-PM.png?fit=1200%2C562&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":191,"url":"https:\/\/diyfuturism.com\/index.php\/2017\/12\/14\/basic-node-red-flows-for-automating-lighting-with-home-assistant\/","url_meta":{"origin":70,"position":5},"title":"Basic Node-Red Flows for Automating Lighting with Home Assistant","date":"December 14, 2017","format":false,"excerpt":"Smart light bulbs are probably the first thing everyone getting into home automation buys. It is easy to see the applications for them - have the lights come on at night, turn off when you're home, etc. It's very satisfying to have the lights react to the day and your\u2026","rel":"","context":"In &quot;Config&quot;","img":{"alt_text":"","src":"https:\/\/i1.wp.com\/diyfuturism.com\/wp-content\/uploads\/2017\/12\/Screen-Shot-2017-12-14-at-7.49.36-PM.png?fit=835%2C631&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/diyfuturism.com\/index.php\/wp-json\/wp\/v2\/posts\/70"}],"collection":[{"href":"https:\/\/diyfuturism.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/diyfuturism.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/diyfuturism.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/diyfuturism.com\/index.php\/wp-json\/wp\/v2\/comments?post=70"}],"version-history":[{"count":12,"href":"https:\/\/diyfuturism.com\/index.php\/wp-json\/wp\/v2\/posts\/70\/revisions"}],"predecessor-version":[{"id":413,"href":"https:\/\/diyfuturism.com\/index.php\/wp-json\/wp\/v2\/posts\/70\/revisions\/413"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/diyfuturism.com\/index.php\/wp-json\/wp\/v2\/media\/73"}],"wp:attachment":[{"href":"https:\/\/diyfuturism.com\/index.php\/wp-json\/wp\/v2\/media?parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diyfuturism.com\/index.php\/wp-json\/wp\/v2\/categories?post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diyfuturism.com\/index.php\/wp-json\/wp\/v2\/tags?post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}