I would like to check if the state of a device was off for the past 5 minutes, and if so, turn off a smart plug where this is connected.
This condition, i want to be check only between 00:01 AM and 08:00 AM
Reason is that i have a device that in OFF mode has 40w consumption. In this case, i want to switch the plug OFF, if device is not used
Is the device integrated itself to HA or just through the smart plug? If it’s the first, that’s a very simple automation.
If not, then you need a way to reliably know when the device is off, maybe by the power consumption (if it is always higher when the device is on).
If it’s the first case, the automation would be simple, as I said:
Trigger: entity that has the device status changed to off for 5 minutes
Condition: before 8:00:00 (to be clear, this means from midnight until 8:00:00).
Action: turn off the plug.
All of this can be done through the graphical interface in the automation editor.