I am trying to trigger an automation when my phone is detected in ‘automotive’ but it won’t fire. The current trigger is as per below code, I have tired without the ‘Types’ attribute and automotive not capitalised but they don’t work. The sensor is definitely changing state as my state history shows walking, stationary, automotive etc
Anyone else use the activity as a trigger?
trigger:
- platform: state
to: Automotive
entity_id: sensor.gj_s_iphone_activity_2
attribute: Types
Hi there, did you have any luck with this?
I’m trying to implement the same thing… but the condition keeps failing.
The best guess I get from other automations is: even though the sensor lists “Automotive” as a state with capital A, I noticed that in the end HA wants it with lower case initial… not sure this might influence the result.
@pixel_xyz, I have managed to get it to work in an automation. The automation I use it for, is to open the garage as I approach the house. Naturally this should only work when I am in automotive mode. Sadly I have had to disable the automation because when my wife is with me in the car both our iPhones trigger the automation. As my garage works on an impulse switch - click to open and click to close with no status whether its open or closed (that I will do later when I get an appropriate contact sensor.
My code is as follows:
alias: Zone Entry - Garage opens on arrival
description: Garage opens on arrival
trigger:
- platform: zone
entity_id: person.w
zone: zone.home
event: enter
- platform: zone
entity_id: person.s
zone: zone.home
event: enter
enabled: false
condition:
- condition: and
conditions:
- condition: or
conditions:
- condition: template
value_template: "{{ states('sensor.wg_iphone_activity') == 'Automotive'}}"
- condition: template
value_template: "{{ states('sensor.sg_iphone_activity') == 'Automotive'}}"
enabled: false
- condition: state
entity_id: binary_sensor.vw_ev_car_is_active
state: "on"
action:
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- metadata: {}
data: {}
target:
entity_id: button.garage_switch
action: button.press
mode: single
Yes another condition is that my EV is on. So it only works with the car.
Wow that’s a great help! thank you so much, I’ll try it out and let you know!
EDIT: @wgumaa the condition didn’t work for some reason and blocked the execution of the whole automation, being it inside an and if condition. Don’t know why, but I’m sure i wrote it correctly because all the data were recognized when i switched from yaml back to the web UI setup page.