Automations Headache

Yes, you changed the example I provided and introduced an error. There’s no such thing as this.automation.pool_pump_new. It should be this.entity_id as shown in the example above. The entity_id in this.entity_id is a property of the this object (refer to the State Objects link below).


References

Available this data
State Objects


In addition, you cannot test a template that references the this object because it exists exclusively when the template is executed by (in this case) the automation after it’s triggered.

BTW, all the debugging steps you went through with LiQuid_cOOled weren’t needed and the end result is a condition with different logic than the original one.

That’s a subtle detail that wasn’t clear when you agreed to this statement:

There’s a subtle but important difference between restricting the automation (what I said and you agreed to) and restricting the pump to turn on once a day. The automation is unaware if you turn on the pump manually so it won’t count towards its ‘once a day’ restriction.

If you want the automation to confirm that the pump hasn’t been turned on then use the Template Condition suggested by LiQuid_cOOled. However, be advised that the value of last_changed is modified on startup. So if Home Assistant is restarted before the automation turns on the pump, the value of last_changed will be today’s date and time and the Template Condition will prevent the automation from turning on the pump. So that Template Condition introduces a potential failure scenario (i.e. automation won’t turn on the pump that day).

3 Likes