action: However, in your trigger, how will device_tracker.amandaiphonelan be marked as “Just Arrived”? input_select.maria_status_dropdown Useful for mqtt-based home automation, especially when the script runs on multiple devices, distributed throughout a property. can you help? It looks like your setting the entity_id to the status. {% else %} Presence detection using Bluetooth trackers with Raspberry Pi. option: Borta länge, – alias: Mark jimmy as away when home assistant starts Intermediate. So you’re trying to update the entity ID to “Just Arrived” for example. {% else %} You may be able to improve this by changing how often the beacons send packets - and by increasing the signal strength (both will drain your beacon batteries more quickly). And i cant wrap my head around it by looking @ the code over and over again. trigger: This improves the ability to keep a connection to a beacon. So if this is what will happen, we’d better add a condition to the automation. – alias: Mark person as home Steps to recreate: turn off your device’s wifi, restart HASS. #- alias: both leaves home Alternatively from Developer Tools -> States change the value from there against your input_select elements. Kom nyss hem So I copied your template into my Home Assistant to check that the syntax was correct, and it seems fine to me. I’m adding to my HA config and looking forward to adding notifications based on state. I’ll wake my phone, place it on the desk and wait for Home Assistant to detect it again. from: 'not_home' Create a sensor for the presence of each individual in the household. data_template: It stopped giving error when i wrapped it inside comas. – service: input_select.select_option Thanks again! To cover this edge-case, I’ve made the following changes to my automation, using templates to first check what my previous state was. {% endif %} You can find out more about configuring the OwnTracks application and beacons here, There is information about configuring Homeassistant to use beacons here. trigger: I hope I’ve convinced you that iBeacons are worth trying! I think you should add that to the automasation above so others might not run in to the same problem. # entity_id: group.allafamiljoguest Thank you for fast response. action: You can do that if you have one of our supported routers. In your first example you had, So, now I’m looking at the code you’ve supplied and I’m not sure what it is trying to do. - platform: state {% endif %}. When OwnTracks sees the beacon (and turns the region red), it also sends an MQTT packet to HA to say that you have entered that region. These zones are used by Home Assistant instead of “home” or “not home”. So that’s a tricky one actually. data_template: entity_id: device_tracker.person_2 # to: 'not_home' – service: input_select.select_option Monitor is a passive Bluetooth presence detection of beacons, cell phones, and other Bluetooth devices. {% elif trigger.entity_id == 'device_tracker.angel_presence' %} – platform: state Used in detached garage to provide internet and network traffic for cameras and devices. Generally 4G is faster than our WiFi here, so if we need to download something quickly we turn WiFi off. This means that if you put a beacon at your front door - OwnTracks will see it within a few seconds of you arriving home - and send an update saying it has seen this iBeacon. from: ‘Gick just hemifrån’ Thanks for the tip. room-assistant: looks for Bluetooth LE beacons, based on Node.js. {% endif %} After creating the variable phil_status, basically just search replace input_select.phil_status_dropdown with variable.phil_status, input_select.phil_status_dropdown with phil_status, and input_select.select_option with variable.set_variable. You could also add another one to mark you as Home when it reboots. Because the variable state is preserved correctly across restarts you won’t need the restore automation (which only works partially anyway with the dropdown). after: ’08:00:00′ entity_id: device_tracker.dani_presence I have a feeling that using the double quote ” might have been the issue here. This would work fine, but it would need to wait another 24 hours for it to be extended away again, therefore run my away on holiday scripts.. Thx for the help so far! I’ve found that in our house, we tend to turn our WiFi on our phones off quite a bit. - platform: state from: 'not_home' You could also do something similar with the drop-downs. # – platform: state When one of us is still at home nothing happens and that is is fine. {% endif %} If you're using HA's Bluetooth device tracker (for presence detection), this project also provides a replacement Bluetooth tracker that allows both components to play nicely together. I’m in a two bedroom apartment, and the Bluetooth presence detection works across the entire apartment. – “extended away” # entity_id: switch.kontoret In my Home Assistant setup I’m using Bluetooth presence detection. {% endif %}, entity_id: > That’s a good point. Its the most indepth/informative I have come across. Beginner. # entity_id: light.koket {% elif trigger.entity_id == ‘device_tracker.person_two’ %} Now I just have to figure out stability and detection issues in my Bayesian sensor. to: ‘Kom nyss hem’ # entity_id: input_select.mark_status_dropdown If it detects my phone, then it knows I’m home. {% if trigger.entity_id == ‘input_select.jimmy_status_dropdown’ %} For the past few days I have been experimenting with detecting Room Presence via the Bluetooth on our android phones and on our three Google Home Minis. Hi Phil, Adding presence detection. https://uploads.disquscdn.com/images/16e931369229049aa9cee41e536b6a14ec8a689064d1b5905cfcfd8e8aa5df3c.png. entity_id: input_select.maria_status_dropdown option: Borta, ###########Maria kommer hem########### See my comment to see how to get a “real” device_tracker! Happy Bubbles Presence Server: presence detection server for Happy Bubbles BLE-scanning devices, based on Go. message: “Maria är hemma!” room-assistant makes use of the MQTT auto discovery (opens new window) features provided by Home Assistant Core to automatically create all entities for you. Luckily, OwnTracks supports iBeacons so I could use them to make presence detection more reliable. We can use the trigger variable to see which device caused the state to change, and then update the drop-down for the right person. So, Home Assistant may not see that we’ve left the house until 10 minutes after we’ve actually left. – Bed Empty Hi Phil, great job you’ve done! Home Assistant Companion Android App April 2021 Release. Any ideas why it would be doing this? option: > just added this code to my HA Or @Phil Hawthorne , do you know where I am going wrong? Hopefully this inspires you to think outside the binary constraints of your controller software, to help you build some really smart automations. Just a heads up. - device_tracker.iphonelan – “just left”, and being away can be the 3 following states : Track and control all devices at home and automate control. There’s no in-between. Just Arrived ###########båda lämnar hem########### That’s so strange. minutes: 10 You can either add a condition, so that the automation only fires once within x minutes, using a template condition. The device_tracker will only ever be either home, or not_home, so that trigger will never fire? detecting the exact moment someone enters or … Nice approach! {% if trigger.entity_id == ‘device_tracker.jimmy’ %} - device_tracker.jacksiphonelan initial: Home Child person_status is ok. My music is changed to my Chillout playlist again (or starts from the beginning), lights that I don’t need might come back on, I get messages that the dishwasher is done etc. 'device_tracker.iphonelan_2': 'input_select.steve_status_dropdown' Currently I have myself and wife as person.entity tied to device_tracker.mobile_apps which track work zone, home and away. mark_status: An example of when this service can be useful is to trigger scans based on other … data: from: ‘not_home’ to my devices, trackers and so on. It would also mean that the automation that should turn on my lights when I got home didn’t work very well! My work WiFi sucks, so I generally have to turn WiFi off, and then forget to turn it back on before I’m home. – Just Arrived The result of the configuration above would be to set the location of device.phone to Drive , (and the GPS location to XXX,YYY) when your phone sees the beacon. Works great! In this two part blog I’ll try and explain why they are useful and how you can use them with Home Assistant. – Just Laid Down You then have to (A) tell Home Assistant where the beacon is located and (B) tell OwnTracks to recognize the beacon. for: Or, if I’m away for a long time, but my fiancée is home, maybe send those alerts to her instead. Not listed as an entity.. How do you handle the state “all people are away” OR “all people are home” ? entity_id: > data_template: This post is by Home Assistant contributor Greg Dowling. condition: and presence_katharina: trigger: # entity_id: input_select.freetoair to: ‘Borta’ # entity_id: switch.sovrum_hoger Would you mind to share it so we can try to identify the probem? trigger: However, even when using this feature I’ve noticed that you can still lose connections (although it seems to vary by beacon manufacturer and type - I’ll talk more about this in part 2). room-assistant. trigger: {% else %} state: ‘not_home’ data_template: – “just arrived” entity_id: input_select.maria_status_dropdown In 2013 Apple introduced iBeacons: a class of Bluetooth low energy (LE) devices that broadcast their identifier to nearby devices, including most smartphones. # entity_id: light.vardagsrum to: ‘Kom nyss hem’ You could have it so when people are marked as Extended Away, an input Boolean is turned on. added states for: to: 'Kom nyss hem' # note that this may be 'off' depnding on your sensor config # I track her iPhone with both WiFi and Bluetooth. data_template: data_template: If my previous state was Just Left, then instead of marking me as Just Arrived it will instead mark me as Home, skipping the Just Arrived state altogether. I found that when I grouped my devices together like that in the trigger, sometimes only one of the group would fire if we got home at the same time. from: ‘Borta’ # note that this may be ‘on’ depnding on your sensor config # trigger: – platform: state {% if states.input_select.person_two_status_dropdown.state == ‘Just Left’ %} – platform: state {% endif %} This means you can have more than one beacon around your home - and a connection to any of them will count as home to OwnTracks and HA. # – service: switch.turn_off I added the 5 sec to my Wife and now she worked flawlessly and my device started eventually failing So now ive added that to me aswell. value_template: ‘{{ states.input_select.sabrina_status_dropdown.state }}’ If your phone can see the packets from that beacon, OwnTracks will turn the relevant Region red. However adding another “for” trigger as you suggested might be cleaner. Cheaper, more reliable, more configurable, and less mqtt-spammy than Happy Bubbles. – Extended Away Hmm if you’re using two device trackers, I would suggest using a group, then just use the group to track your state. Oooh. – service: switch.turn_off it does accept the old style, but it will reformat it once saved. 'device_tracker.amandaiphonelan': 'input_select.amanda_status_dropdown', {% endif %} – platform: state message: “Välkommen hem Maria <3" Since the input_select is set with initial state of ‘home’ and there is no state change to trigger, then sensor.mark_status never transitions from ‘home’ even when device is not home. If you set two beacons to have exactly same details then OwnTracks will think multiple beacons are at the same location. These can be pretty easy to do with presence detection, but sometimes you need more. So I was wondering @Jakob Tewes did you solve this? The only thing i can see that has any link to the problem is that Marias_status does the following before getting stuck Sometimes I have it running for a week between restarts, and everything has been ok so far. to: 'home' – Just Arrived I haven’t personally used the map function yet. Hey Phil, I dove in here for some inspiration: https://yaml-multiline.info/ and tried to double quote the yaml. You can usually change these parameters in the app supplied by the iBeacon maker. {% set map = { Brilliant idea! Instead of using device trackers can we use the person.xxxx entity? # message: 'Welcome home Jimmy' Not sure if you have a better solution but I’ve created a script to trigger the python script, passing the data for each person, and I can use an automation to run it after a restart I guess, but that leads me to the second issue. To make this type of presence detection work you need to turn GPS off for a zone in Home Assistant by making them passive. So, you’ve got your home automation started, and it’s time to add some cool automations, like turning off everything when you leave, or playing some music when you get home. Basically, sometimes I want to trigger a scene through Homekit and at that point Adaptive lighting stops. {% else %} And sadly all devices are always report the right status. input_select.jimmy_status_dropdown when the Inputselect is not. – platform: state I think i added it according to your link, but I’m not sure what to do to access it! input_select.lara_status_dropdown action: My current setup for presence detection is a Bayesian sensor on Home Assistant with a few devices (GPS with OwnTracks, WiFi through Netgear) and it's not too reliable. For additional configuration variables check the Device tracker page. You could use a for in your automation to account for this, however this may increase the time for Home Assistant to detect you as Home, which we don’t want. For now, I’m not looking for fine-grained tracking i.e. To do this you first need to set up MQTT and OwnTracks in Home Assistant - and make sure that HA can track your phone. – service: input_select.select_option The result would be that Home Assistant would think I was 500M away from home, and take quite a while to notice I was home. Try that out, and if it still doesn’t work can you post your automation? Then let’s say I want an automation for when everyone has left the house to turn off my study lamp, the automation could be done in two ways. Sure, from the dropdowns in your UI either select “Just Left” or “Away”. Its only Maria that gets this problem. name: Jakob Thanks for the quick reply!…. Then it get stuck. If you have something like an Eight Sleep tracker, you could also mark someone as “asleep” when they’re laying in bed. I also have grafana working following your guide, after failing a few months ago. # data: does my example automation below work based on your component? In Home Assistant and many other home automation controllers, your home status is either Home or Away. The code I pasted up there, granted not in-line, however correct and working for the ‘Mark Person as Just Arrived’ automation, what I’m struggling with the most is the other ‘Mark person as home’, ‘Mark person as just left’, ‘Mark person as away’ and ‘Mark person as extended away’ automations. That looks like a handy component! This ensures your comings and goings are detected immediately. For example, my wife works next door - and I couldn’t detect whether she’s at home or in the office via GPS because the accuracy wasn’t high enough. data: – Just Arrived I’ll be working away, writing my next awesome automation or piece of code, only for Home Assistant to cut the power to my computer monitor and pause my music. https://uploads.disquscdn.com/images/5f930372073e89963034a0a8a286fff5424ed8e8c3261bf6fd5c71eccccdcf31.png, hey, somehow i managed to show the state , but didnt manage to hide the input select. @disqus_5brlMPOO7w:disqus these were the first versions of the flow. Thanks, this is great! I can then make it look like a normal device tracker by adding our photos to the sensor. – platform: state – service: light.turn_on One popular feature is Home/Away status for automatically triggering smart device routines. You want to change the input_select based on what device_tracker entity gets updated. Im using hassio today so dono is that even a possebility. dennis_status: See how I track devices on my network and use the status in automations. Do you have a suggestion on how a automation that would check that state would look like?