Then I suggest you add an id
to each trigger and use trigger.id
to identify the trigger. Why? Because trigger.idx
is position dependent and if you’re forgetful you might add the new trigger before the existing one.
BTW, at this point it’s a complete farce to label the second post as the Solution; I suggest you untag it to avoid misleading others. You’re not using a History Stats sensor for your application. Plus it wouldn’t care if your switch was unavailable
for a moment or for several hours. It just reports the cumulative number of hours the switch is on
. That’s wildly different from how a State Trigger’s for
option behaves or your timer
based automation.