Hi,
I’m trying to create an automation condition for my automation that runs when my robot vacuum dockes (after finishing cleaning). For that I have this trigger:
platform: device
device_id: xxx
domain: vacuum
entity_id: vacuum.xxx
type: docked
This works. However, sometimes the vacuum becomes “Unavailable” (Cloud connection issues, WiFi down, sometimes random etc.). This means the above state I am using to trigger also becomes “Unavailable”. Then, when the connection comes back, the state gets set to “Docked” - this fires the automation which I don’t want because the vacuum hasn’t been cleaning before (just disconnected).
I am trying to prevent the automation running with a condition, in which I check the previous state of the trigger. If that previous state is “Unavailable”, then the automation should not trigger. This is the condition I came up with:
condition: template
value_template: '{{ trigger.from_state.state != "Unavailable" }}'
However I’m not sure if that would work that way. At least when testing the condition I get:
template value should be a string for dictionary value @ data[‘value_template’]. Got None
Any hints on how I can achieve this or what I’m doing wrong? I read some threads in the forum but couldn’t get it working.
Cheers!
3 posts - 2 participants