I am trying to always shut off certain devices when I leave my home. I tried that using he sate trigger. Strangely when I select the device trigger for my phone, I an only select unrelated attributes (IP address, hostname, etc.) Leaving the attribute field blank an only specifying the From and To values I get:
alias: LichtAusWennNichtZuhause
description: ''
trigger:
- platform: state
entity_id: device_tracker.galaxy_a40_von_michael
from: Home
to: Away
condition: []
action:
- type: turn_off
device_id: 150b679d3eeaf90e737200b81e2c2ab9
entity_id: switch.steckerschrankbeleuchtung
domain: switch
mode: single
This however does not trigger the action when I leave.
The sensor seems to be working because the dashboard correctly reports that I am home/away when I turn the phone’s WiFi on/off.
The smart switch also works when I use it manually in the dashboard.
What am I doing wrong? How can I switch off devices when I leave?
You’re using the translated states that appear in the frontend. Use the untranslated states that are in the backend. To see these, use the developer tools → states page. The correct states are: home and not_home.
- platform: state
entity_id: device_tracker.galaxy_a40_von_michael
from: home
to: not_home