Using delay and hours also does not work
17-03-22 18:27:08 INFO (MainThread) [homeassistant.components.automation] Executing TEST sunset power
17-03-22 18:27:08 INFO (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: domain=automation, entity_id=automation.test_<HM_Device>_an_wenn_sonnenuntergang, name=TEST sunset power, message=has been triggered>
17-03-22 18:27:08 INFO (MainThread) [homeassistant.helpers.script] Script TEST sunset power: Running script
17-03-22 18:27:08 INFO (MainThread) [homeassistant.helpers.script] Script TEST sunset power: Executing step call service
17-03-22 18:27:08 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_call_id=1971714480-35, service=turn_on, service_data=entity_id=[‘switch.<HM_Device>’], domain=switch>
17-03-22 18:27:08 DEBUG (Thread-13) [pyhomematic.devicetypes.generic] HMDevice.event: Using callback <bound method HMSwitch._hm_event_callback of <Entity <HM_Device>: off>>
17-03-22 18:27:08 DEBUG (Thread-13) [homeassistant.components.homematic] <HM_Device> received event ‘STATE’ value: True
17-03-22 18:27:08 DEBUG (Thread-13) [homeassistant.components.homematic] <HM_Device> update_ha_state after ‘STATE’
17-03-22 18:27:08 DEBUG (Thread-13) [pyhomematic.devicetypes.generic] HMDevice.event: Using callback <bound method HMSwitch._hm_event_callback of <Entity <HM_Device>: on>>
17-03-22 18:27:08 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state switch.<HM_Device>=on; proxy=wireless, id=, friendly_name=<HM_Device>, working=No, rssi=-64 @ 2017-03-22T18:27:08.874608+01:00>, old_state=<state switch.<HM_Device>=off; proxy=wireless, id=, friendly_name=<HM_Device>, working=No, rssi=-64 @ 2017-03-21T22:28:45.592466+01:00>, entity_id=switch.<HM_Device>>
17-03-22 18:27:08 DEBUG (Thread-13) [homeassistant.components.homematic] <HM_Device> received event ‘WORKING’ value: False
17-03-22 18:27:08 DEBUG (Thread-13) [pyhomematic.devicetypes.generic] HMDevice.event: Using callback <bound method HMSwitch._hm_event_callback of <Entity <HM_Device>: on>>
17-03-22 18:27:08 DEBUG (Thread-13) [homeassistant.components.homematic] <HM_Device> received event ‘STATE’ value: True
17-03-22 18:27:08 INFO (MainThread) [homeassistant.helpers.script] Script TEST sunset power: Executing step call service
17-03-22 18:27:10 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state automation.test_<HM_Device>an_wenn_sonnenuntergang=on; friendly_name=TEST sunset power, last_triggered=2017-03-22T18:27:10.378368+01:00 @ 2017-03-21T13:54:31.041468+01:00>, old_state=<state automation.test<HM_Device>an_wenn_sonnenuntergang=on; friendly_name=TEST sunset power, last_triggered=2017-03-21T18:27:10.264459+01:00 @ 2017-03-21T13:54:31.041468+01:00>, entity_id=automation.test<HM_Device>an_wenn_sonnenuntergang>
17-03-22 18:28:44 INFO (MainThread) [homeassistant.components.automation] Executing TEST sunset power
17-03-22 18:28:44 INFO (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: domain=automation, entity_id=automation.test<HM_Device>_an_wenn_sonnenuntergang, name=TEST sunset power, message=has been triggered>
17-03-22 18:28:44 INFO (MainThread) [homeassistant.helpers.script] Script TEST sunset power: Executing step call service
17-03-22 18:28:44 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_call_id=1971714480-37, service=turn_off, service_data=entity_id=[‘switch.<HM_Device>’], domain=switch>
17-03-22 18:28:44 DEBUG (Thread-13) [pyhomematic.devicetypes.generic] HMDevice.event: Using callback <bound method HMSwitch._hm_event_callback of <Entity <HM_Device>: on>>
17-03-22 18:28:44 DEBUG (Thread-13) [homeassistant.components.homematic] <HM_Device> received event ‘STATE’ value: False
17-03-22 18:28:44 DEBUG (Thread-13) [homeassistant.components.homematic] <HM_Device> update_ha_state after ‘STATE’
17-03-22 18:28:44 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state switch.<HM_Device>=off; proxy=wireless, id=, friendly_name=<HM_Device>, working=No, rssi=-64 @ 2017-03-22T18:28:44.842475+01:00>, old_state=<state switch.<HM_Device>=on; proxy=wireless, id=, friendly_name=<HM_Device>, working=No, rssi=-64 @ 2017-03-22T18:27:08.874608+01:00>, entity_id=switch.<HM_Device>>
17-03-22 18:28:44 DEBUG (Thread-13) [pyhomematic.devicetypes.generic] HMDevice.event: Using callback <bound method HMSwitch._hm_event_callback of <Entity <HM_Device>: off>>
17-03-22 18:28:44 DEBUG (Thread-13) [homeassistant.components.homematic] <HM_Device> received event ‘WORKING’ value: False
17-03-22 18:28:44 DEBUG (Thread-13) [pyhomematic.devicetypes.generic] HMDevice.event: Using callback <bound method HMSwitch.hm_event_callback of <Entity <HM_Device>: off>>
17-03-22 18:28:44 DEBUG (Thread-13) [homeassistant.components.homematic] <HM_Device> received event ‘STATE’ value: False
17-03-22 18:28:44 INFO (MainThread) [homeassistant.helpers.script] Script TEST sunset power: Executing step call service
17-03-22 18:28:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state automation.test<HM_Device>an_wenn_sonnenuntergang=on; friendly_name=TEST sunset power, last_triggered=2017-03-22T18:28:46.431046+01:00 @ 2017-03-21T13:54:31.041468+01:00>, old_state=<state automation.test<HM_Device>an_wenn_sonnenuntergang=on; friendly_name=TEST sunset power, last_triggered=2017-03-22T18:27:10.378368+01:00 @ 2017-03-21T13:54:31.041468+01:00>, entity_id=automation.test<HM_Device>_an_wenn_sonnenuntergang>
Ideas?