Perhaps a strange question. But i’m still finding a way to get the GoGoGate working on switching on and off lights during the night. We have worked out last time but now things are not working. The conditions are to complicated and not working. This because the automation has to work after 23.00 and before sunrise. Time is working but after adding the sunrise condition the automation is not working.
So I was thinking. Can I automate the automation. So after sunrise switch off the automation GoGoGate open and GoGoGate close. And sunset switch on the automation GoGoGate.
#Hek open licht aan
- alias: GoGoGate open licht aan
trigger:
platform: state
entity_id: cover.hek
from: closed
to: open
condition:
condition: and
conditions:
- condition: time
after: '23:00:00'
- condition: state
entity_id: sun.sun
state: below_horizon
action:
- service: scene.turn_on
entity_id: scene.garden_lights_bright
- service: switch.turn_on
entity_id: switch.qubino_goap_zmnhbdx_flush_2_relays_switch
Did not check the logs but seen that it never had been triggered. When I delete the sun part it is working.
Now changed into
# GoGoGate open
- alias: GoGoGate open licht aan
trigger:
platform: state
entity_id: cover.hek
from: closed
to: open
condition:
condition: or
conditions:
- condition: time
after: '23:00:00'
- condition: sun
before: sunrise
action:
- service: scene.turn_on
entity_id: scene.garden_lights_bright
- service: switch.turn_on
entity_id: switch.qubino_goap_zmnhbdx_flush_2_relays_switc
Invalid config for [automation]: expected a dictionary @ data[‘condition’][0]. Got None extra keys not allowed @ data[‘conditions’]. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 115). Please check the docs at Automation - Home Assistant Invalid config for [automation]: expected a dictionary @ data[‘condition’][0]. Got None extra keys not allowed @ data[‘conditions’]. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 115). Please check the docs at Automation - Home Assistant
I’m not sure I agree that your solution could be described as “simple”.
Instead of having one automation do what you want it to do you will now have three different automations to do the same thing. That’s not “simple”.
It would be simpler to actually follow the advice given above and correct your mistakes to make the current automation work correctly.
Going down the path you have chosen because you don’t want to learn the correct syntax means you will end up with a bunch of unnecessary code for every automation where this type of condition is going to be necessary.
Deleted my whole automation and added the following.
#GoGoGate open licht aan
- alias: GoGoGate open licht aan
trigger:
platform: state
entity_id: cover.hek
from: closed
to: open
condition:
condition: or
conditions:
- condition: time
after: '23:00:00'
- condition: sun
before: sunrise
action:
- service: scene.turn_on
entity_id: scene.garden_lights_bright
- service: switch.turn_on
entity_id: switch.qubino_goap_zmnhbdx_flush_2_relays_switch
That gives me
Invalid config for [automation]: expected a dictionary @ data[‘condition’][0]. Got None
extra keys not allowed @ data[‘conditions’]. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 97). Please check the docs at Automation - Home Assistant
And line 97 is
group: !include groups.yaml
When I open the groups.yaml file that one is empty. I’m lost. When I delete the above automation and write my old one no errors.
we were being patient until we kept telling you how to do it and you didn’t follow the directions.
and I’m still not even sure you are even now…
These look exactly the same to me:
In both code blocks you used the following:
condition:
condition: or
conditions:
- condition: time
after: '23:00:00'
- condition: sun
before: sunrise
They aren’t different so one can’t error and the other work because they are the same. Unless I’m missing something…?
the reason it caused errors is because you didn’t copy/paste the code correctly. The indentation was wrong in every one of your posts until the last one which you then said was working. Of course it will work because you fixed the indentation mistakes.
If you look back at post #2 by @anon43302295 you should see that the code he gave you there is exactly like the code that you say is now working.
Because after midnight it is no longer after 23:00 any more. Because the “after” only goes from that time until 00:00. After that it is then before 23:00 of the next day.
The same goes for before sunrise. the only time it is “before sunrise” is from 00:00 until sunrise.
That is why you need the two conditions to be an “or”. Because then you will test for the conditions from between 23:00 and midnight or between midnight and sunrise.
If you you use an “and” condition that is after 23:00 and the sun is below the horizon (as you had in your last “working” automation above that really wasn’t) as soon as it turns into midnight then it is no longer after 23:00 so the “and” conditions are no longer true. So it doesn’t work.
Please don’t blame others who are trying to help you when you are the one failing to follow the instructions given.