Delete this post please

delete this post please

A couple of points on your automation.

  1. It looks like an automation editor offering so not how I’d write it
  2. You don’t need to include keys that are zero in a delay but I assume this was put in by the automation editor so there’s nothing you can do about that

Otherwise there’s nothing wrong with it.
Maybe you reloaded automations between or restarted HA ?

If you know when you want it on and when you want it off you’d be better to have two automations and regardless of anything else it would do as you require

1 Like

If you reload or restart (same with nodered) then the automation is no longer running and therefore does not know it should be shutting off.
Try to think of it from the automations point of view
The computer only does what you tell it and you’ve just wiped its memory

1 Like

Why not just have one automation to turn the switch on and another to turn it off. That way, restarts or power outages would not affect the times.

2 Likes

Use a second automation, that turns of the switch after it has been on for 16 hours. States are preserved, so this should work more reliable.

trigger:
  platform: state
  entity_id: switch.teckin_sp201
  to: 'on'
  for:
    hours: 16

on the other hand: Why not just turn it of at 22:00?

2 Likes

I could have sworn I said exactly that 3 posts up.

Ah ! big district of Thailand
:man_shrugging:

@m0wlheld ditto

Don’t people bother reading previous posts ?