Can anyone see a problem with this? HASS keep choking on the trigger lines, but they are essentially copied from the example on the triggers documentation page here: https://home-assistant.io/getting-started/automation-trigger/ under the section for template triggers.
Syntax looks valid and devices, etc. were checked against the dev panel names and check out.
# Idiot Alert - If doors are open and I leave, remind me
- alias: 'Door Minder'
trigger:
platform: template
value_template: '{% if is_state('device_tracker.rpitera_rpitera', 'not_home') %}true{% endif %}'
condition: or
conditions:
- condition: state
entity_id: binary_sensor.front_door
state: 'on'
- condition: state
entity_id: binary_sensor.side_door
state: 'on'
action:
service: notify.pushbullet
data:
message: 'Robert, you left one of the entry doors open. Front Door is {{ state.binary_sensor.front_door }}. Side Door is {{ state.binary_sensor.side_door }}. '
This is the error I am getting; the lines refer to the trigger section:
16-09-06 18:35:44 homeassistant.util.yaml: while parsing a block mapping
in â/home/hass/automation.yamlâ, line 181, column 5
expected , but found ââ
in â/home/hass/automation.yamlâ, line 182, column 38
Iâm stumped. Is the documentation wrong? Because all I basically did was copy, paste and then change the device tracker name and the state from âhomeâ to ânot_homeâ.
OK so I decided to simplify this by just using a state trigger and changed it to this:
# Idiot Alert - If doors are open and I leave, remind me
- alias: 'Door Minder'
trigger:
platform: state
entity_id: device_tracker.rpitera_rpitera
state:
from: 'home'
to: 'not_home'
condition: or
conditions:
- condition: state
entity_id: binary_sensor.front_door
state: 'on'
- condition: state
entity_id: binary_sensor.side_door
state: 'on'
action:
service: notify.pushbullet
data:
message: 'Robert, you left one of the entry doors open. Front Door is {{ state.binary_sensor.front_door }}. Side Door is {{ state.binary_sensor.side_door }}. '
Now HASS loads, but the automation load fails with the following error:
16-09-06 18:42:47 homeassistant.bootstrap: Invalid config for [automation]: expected a dictionary @ data['condition'][0]. Got 'o'
expected str for dictionary value @ data['trigger'][0]['state']. Got None
extra keys not allowed @ data['conditions']. Got [OrderedDict([('condition', 'state'), ('entity_id', 'binary_sensor.front_door'), ('state', 'on')]), OrderedDict([('condition', 'state'), ('entity_id', 'binary_sensor.side_door'), ('state', 'on')])] (See /home/hass/automation.yaml:179)
The line references to the "- alias: " line in the automation above. There is no other alias with the same name in the automation file.
Iâm running out of ideas. I just want HASS to let me know I left the door openâŚ
Uggh! thatâs what I get for copying and pasting - the documentation IS incorrect. It doesnât show the top condition line. Iâm restarting now and Iâll let you know. Thanks for replying!
16-09-06 19:44:04 homeassistant.bootstrap: Invalid config for [automation]: expected str for dictionary value @ data[âtriggerâ][0][âstateâ]. Got None (See /home/hass/automation.yaml:180)
Automation now looks like this:
- alias: 'Door Minder'
trigger:
platform: state
entity_id: device_tracker.rpitera_rpitera
state:
from: 'home'
to: 'not_home'
condition:
condition: or
conditions:
- condition: state
entity_id: binary_sensor.front_door
state: 'on'
- condition: state
entity_id: binary_sensor.side_door
state: 'on'
action:
service: notify.pushbullet
data:
message: 'Robert, you left one of the entry doors open. Front Door is {{ state.binary_sensor.front_door }}. Side Door is {{ state.binary_sensor.side_door }}. '
If you use the from/to states elsewhere maybe try copying them and pasting over the text thatâs getting the flag? Itâs a longshot I know but perhaps some weird characters got copied from the documentation.
That was it @AlucardZero! I wish I could understand these error messages better so I wouldnât have to pester you!
But I really appreciate the responses from you, @fanaticDavid and @quantumpelvis. I spent all day at a clientâs site worrying if I left my door open at home because I didnât have a door sensor installed on the new front door yet. In finally figured out that since i had a multi sensor was near the door, if the door was open, the light readings would be high. They were at 0.0 so I rested a little easier and in fact the door was closed.
This was an attempt to prevent that from ever happening again so I just installed the sensor and started writing the automation. I really appreciate all the help guys!