Dim lights at time x

So midnight again in the Netherlands and it is not working. Same issue open the gate nothing. Delete the sun part and it is working.

I would try with this,

    - condition: state
      entity_id: sun.sun
      state: 'below_horizon'

This is what I use, I haven’t used condition: sun before, but according to the homeassisant docs it is setup right. But, give it a try like above and see where that leads you.

Couple of things;
Do you get anything in your log when you trigger after midnight?
I have added the sun integration to my config, but I’m not sure that is needed for basic sunset triggering or maybe it’s enabled by default now a days.
In the Netherlands sunset is always before midnight so there is no need to add after: sunset.

@TinyDoT I have changed the lines and now fingers crossed it will work.

@Sjee yes I have the sun integration inside my config, lights turn on after sunset. I will see in my log file what is what.

Okay small update. After the new lines of TinyDoT Home Assistant did not start. Because of no time at 0:00 I did not check the setup result all lights were on this morning. Now I have deleted the lines and all is working except the open gate light part.

23 augustus 2019

22:27

Home Assistant stopped

22:26

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

22:26

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

22:26

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

22:26

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

22:26

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

22:22

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

22:22

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

22:22

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

22:22

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

22:22

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

22:21

Hek changed to open

22:13

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

22:13

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

22:13

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

22:13

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

22:13

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

22:00

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

22:00

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

22:00

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

22:00

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

22:00

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

22:00

Guesthouse dimmen om 0:00 has been triggered

21:59

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

21:59

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

21:59

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

21:59

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

21:59

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

21:51

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

21:27

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

21:27

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

21:27

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

21:27

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

21:27

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

21:07

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

21:07

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

21:07

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

21:07

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

21:07

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

21:00

Hek changed to closed

20:58

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

20:58

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

20:58

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

20:58

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

20:58

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

20:47

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

20:47

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

20:47

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

20:47

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

20:47

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

20:47

GuestHouse Dimmer turned on

20:47

Voordeur lamp turned on

20:47

Lantaarnpaal turned on

20:47

Hekverlichting turned on

20:47

Garage deuren turned on

20:47

Zon onder has been triggered

20:47

Sun has set

19:46

BR Arnhem (6275) changed to cloudy

19:36

BR Arnhem (6275) changed to partlycloudy

18:26

BR Arnhem (6275) changed to cloudy

18:05

BR Arnhem (6275) changed to sunny

17:56

BR Arnhem (6275) changed to partlycloudy

16:51

Hek changed to open

14:55

Hek changed to closed

10:29

Hek changed to open

9:46

Hek changed to closed

8:05

Hal verlichting turned off

8:05

Hal verlichting turned on

8:04

Hal verlichting turned off

8:04

Hal verlichting turned on

8:04

Hekverlichting Dimmer turned off

8:03

Hek changed to open

7:34

BR Arnhem (6275) changed to cloudy

7:31

yr Symbol changed to 3

7:24

BR Arnhem (6275) changed to fog

7:04

BR Arnhem (6275) changed to partlycloudy

6:54

BR Arnhem (6275) changed to sunny

6:33

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

6:33

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

6:33

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

6:33

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

6:33

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

6:33

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

6:33

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

6:33

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

6:33

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

6:33

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

6:33

GuestHouse Dimmer turned off

6:33

Voordeur lamp turned off

6:33

Lantaarnpaal turned off

6:33

Hekverlichting turned off

6:33

Zon op has been triggered

6:33

Sun has risen

6:20

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

6:20

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

6:20

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

6:20

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

6:20

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

5:34

BR Arnhem (6275) changed to cloudy

5:31

yr Symbol changed to 2

5:14

BR Arnhem (6275) changed to sunny

5:04

BR Arnhem (6275) changed to partlycloudy

3:34

BR Arnhem (6275) changed to cloudy

2:58

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

2:58

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

2:58

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

2:58

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

2:58

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

2:34

BR Arnhem (6275) changed to sunny

2:13

BR Arnhem (6275) changed to partlycloudy

1:34

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

1:34

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

1:34

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

1:34

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

1:34

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

0:53

BR Arnhem (6275) changed to sunny

0:44

BR Arnhem (6275) changed to partlycloudy

0:23

BR Arnhem (6275) changed to sunny

0:14

BR Arnhem (6275) changed to partlycloudy

0:04

Hek changed to closed

0:04

Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management changed to 254

0:04

Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId changed to 0

0:04

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level changed to 0

0:04

Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type changed to 0

0:04

Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting changed to False

0:02

Hek changed to open

0:00

Garage deuren turned off

0:00

0:00 has been triggered

0:00

Hek dimmen om 0:00 has been triggered

@RemcovanKuilenburg can you post your code for me to see and I do believe we need to change

after: 0:00 to after: ‘00:00:00’

We will get this.

Hi TinyDoT. Yes we will nail this.

- id: '1566418818385'
  alias: GoGoGate open licht aan
  trigger:
  - entity_id: cover.hek
    platform: state
    from: "closed"
    to: "open"
  condition:
    condition: and
    conditions:
      - condition: time
        after: 00:00:00
      - condition: sun
        after: sunset
        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

- id: '1566423130786'
  alias: GoGoGate dicht licht uit
  trigger:
  - entity_id: cover.hek
    platform: state
    from: "open"
    to: "closed"
  condition:
    condition: and
    conditions:
      - condition: time
        after: 00:00:00
      - condition: sun
        after: sunset
        before: sunrise
  action:
    - service: scene.turn_on
      entity_id: scene.garden_lights_dim
    - delay:
       minutes: 1
    - service: switch.turn_off
      entity_id: switch.qubino_goap_zmnhbdx_flush_2_relays_switch

This is now how I have entered all. Changed the 0:00 to 00:00:00 and now the UI is started. So I have to wait 30 min until midnight.

No trigger when opening the gate.

#### 25 augustus 2019

0:10

[Hek](http://192.168.1.21:8123/logbook#) changed to open

0:09

[Hek](http://192.168.1.21:8123/logbook#) changed to closed

0:07

[Hek](http://192.168.1.21:8123/logbook#) changed to open

0:00

[Moon](http://192.168.1.21:8123/logbook#) changed to waning_crescent

0:00

[Qubino (Goap) ZMNHDD1 Flush Dimmer Power Management](http://192.168.1.21:8123/logbook#) changed to 254

0:00

[Qubino (Goap) ZMNHDD1 Flush Dimmer SourceNodeId](http://192.168.1.21:8123/logbook#) changed to 0

0:00

[Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Level](http://192.168.1.21:8123/logbook#) changed to 0

0:00

[Qubino (Goap) ZMNHDD1 Flush Dimmer Alarm Type](http://192.168.1.21:8123/logbook#) changed to 0

0:00

[Qubino (Goap) ZMNHDD1 Flush Dimmer Exporting](http://192.168.1.21:8123/logbook#) changed to False

0:00

[Garage deuren](http://192.168.1.21:8123/logbook#) turned off

0:00

[Hek dimmen om 0:00](http://192.168.1.21:8123/logbook#) has been triggered

0:00

[0:00](http://192.168.1.21:8123/logbook#) has been triggered

I made a couple of small changes to the code:

- id: '1566418818385'
  alias: GoGoGate open licht aan
  trigger:
    platform: state
    entity_id: cover.hek
    from: "closed"
    to: "open"
  condition:
    condition: and
    conditions:
      - condition: time
        after: '00:00:00'
      - condition: sun
        after: sunset
        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

- id: '1566423130786'
  alias: GoGoGate dicht licht uit
  trigger:
    platform: state
    entity_id: cover.hek
    from: "open"
    to: "closed"
  condition:
    condition: and
    conditions:
      - condition: time
        after: '00:00:00'
      - condition: sun
        after: sunset
        before: sunrise
  action:
    - service: scene.turn_on
      entity_id: scene.garden_lights_dim
    - delay:
       minutes: 1
    - service: switch.turn_off
      entity_id: switch.qubino_goap_zmnhbdx_flush_2_relays_switch

One other thing to check, is to make sure your cover.hek is using open and closed for its state instead of on and off. Change the time to see if it works now if you are still up. Also, you may need to remove the " " from around open and closed.

This is not required. Conditions are logic AND by default.

@sparkydave, thanks that is good to know.

You need to remove the after: sunset condition. Following the conditions docs after sunset is only valid untill midnight, after midnight is a new day so the sun did not set yet.

And again thanks for the updates. I have changed into the last one TinyDoT sent and now my GoGoGate is not visible in the UI. So I think no connection. Will try a reboot again.

Working again. Connection was not okay and did a reset of the GoGoGate unit. Now all fine. Just have to wait until 0:00

Yes it is and found this
21:18

Hek changed to closed

I see in your lines that you use GoGoGate as alias. When I see the integration part they say GoGoGate2. Is that the reason?

# Example configuration.yaml entry cover: - platform: gogogate2 username: [[email protected]](mailto:[email protected]) password: password ip_address: 192.168.1.200

I think we should break this down. I would take the above automation and take out the conditions and see if the action is performed when you open the gate and close the gate. Through the different versions of Homeassitant I have come across time when you need to use " "s or ’ 's around your state item. So I would try the automation with them and with out them. Once you know with version of the automation works then I would put the conditions back in. And, from what @sparkydave said you do not need the “condition: and” statement. @sjee has a good point as well, I think the only condition you would need is after: ‘00:00:00’, but on the other hand you might want to leave the before: sunrise.
This should get us closer to what you want. Also, the alias is just a reference, if you look at your automations on the frontend you will see that is what that automation is called.

When I clear all conditions the trigger works. The garage lights turn on and the fence lights go from dim to full. Reverse also works. The fence lights go to dim again and with delay of 1 min the garage lights turn off.
Version running is 0.97.2