When I push a button on the dashboard a want to call an automation which will turn a lamp on and directly and automation off. Pressed the same button again the lamp will go out and the automation will go on. Sometimes you like to have manualy a lamp staying on longer then via several sensor. The first part of the YAML must be a “button” Who can assist
Why a button? Better to use a toggle. But regardless, create a button or toggle helper and add it to your dashboard, then simply use a state trigger in your automation tied to the entity_id of the button/toggle helper.
Enabling and disabling automations is fine if they’re seasonal - Christmas tree lights, for example - but otherwise there shouldn’t be any need if you’ve got the triggers and conditions right.
This automation works fine, but stops at sunrise. But when a couple of minutes before sunrise the lamps are going on they are not going out anymore due to sunrise. Do you have a solutions?
It would seem that your sun condition prevents the timer trigger from firing. You should be able to solve it by modifying your conditions something like this: