@Rodolfo_Vieira It tried your suggestion with the boolean. Did not work.
I was thinking; the source of the sensor.battery is a httppost command sent every 15 minutes from my phone via Tasker. This means the sensor isn’t there on HASS restart at first (it takes max. 15 minutes for it to be there). Could it be that the automation isn’t initialized therefore (allthough there are also no errors in my logfile and the automation does show up in my frontend and can be activated manualy)?
ok, do you have a android phone right?
if yes… install the app called GPSlogger, this app is amazing, much better the owntracks, and give the possibilty to know your battery status each one minute.
i use it, do you want a try? if yes, i give you the configuration.
Thanks for this; I’ve been planning on trying out GPSLogger, even though I’m not having any issues getting my battery levels. I was hoping it was better than owntracks, so having this set up info is a huge help.
you need restart HA, after that go to the android mobile and force update manually, then you see your value battery on HA, and if you go to the DEV-TOOLS (states) you see input_boolean.working ON
If this step works, the problem is other…
@Rodolfo_Vieira & @Bob_NL I think you guys are missing one big thing in your logic for using the numeric_state triggers! your tests will not work.
the below and the above part of the triggers are the thresholds for when the automation should be triggered, but only once when the state change actually passes these thresholds.
so let’s say you use below: 50 as threshold for the automation. when you start HASS and the battery level is 100%, you won’t get a message immediately. as the day passes and your battery drains, you’ll get the message as soon as HASS detects a new value for the battery that is below 50 when it was greater than 50 before the state change happened. now let’s say you would have started HASS with your battery level at 40%. HASS wouldn’t send you a message, because the initial state is already below 50 and you never passed that threshold. You would have to charge your phone first until the battery (in HASS) would be above 50 and then it will send a message if your battery is depleting once again until it passes that threshold going down.
also @Rodolfo_Vieira I helped developing the proximity component when it first was released. your logic for the proximity component is also wrong: the state of the proximity component is in kilometres, not in metres. so the threshold below: 100 will only trigger if all devices were all further than 100km away from home after starting HASS
the automation for 100m would be:
alias: "send message me when i am less 100 meters of my house"
trigger:
- platform: numeric_state
entity_id: proximity.home
value_template: '{{ states.proximity.home.state | float }}'
below: 0.1
@Bart274 I see, thanks for your detailed explanation. If I understand correctly, it should trigger if I set the trigger for every state change and I use conditions in which I configure the above and below values, correct? The downside would be that it will trigger at every percentage drop.
@Bob_NL you misunderstood. it’s best just to use these numeric_state triggers, but then they would only trigger when passing the threshold, so for testing you need to wait until the state surpasses these thresholds.
I figure out proximity state is not correctly configured as a numeric_state
The strange thing is
{{states.proximity.XXXXX.state}} gives the correct distance
but
{{states.proximity.XXXXX.state > 0}} gives an error
It is also strange that the function “above” seem to work but Not “below”.
The distance set here is 200 m
Since the below the proximity function doesn’t work because it is not recognized as a numeric_state. the Template way seems to be the only way for now.
The conditions are not necessary but avoid false trigger
- id: zonexxxx detect
alias: M on his way to zoneXXXX
trigger:
platform: template
value_template: "{% if states.proximity.zoneXXXX.state | float < 200 %} true {% endif %}"
condition:
condition: and
conditions:
- condition: state
entity_id: device_tracker.iphone
state: 'not_home'
- condition: template
value_template: '{{ states.proximity.zoneXXXX.attributes.dir_of_travel == "towards" }}'
action:
- service: notify.ios_iphone
data:
title: "going zoneXXXX"
message: "almost zoneXXXX !!"