Dim lights at time x

Hi Guys,

I’m trying to get my head around a configuration. All my garden lights go on at sunset and off at sunrise. But I want to dim 2 lights at time X say 0:00. My modules are Qubino. This is the automation I have created but I’m stuck.

‘’’

  • id: ‘1564949714672’
    alias: Hek verlichting uit bij zon op
    trigger:
    • event: sunrise
      platform: sun
      condition: []
      action:
    • data:
      entity_id: switch.qubino_goap_zmnhdd1_flush_dimmer_switch
      service: switch.turn_off
      ‘’’

entity_id can also be ‘’‘light.qubino_goap_zmnhdd1_flush_dimmer_level’’’ i’m not sure which to recall.

Please help.

Remco

The way that I would handle this would be to create a scene:

scene:
  - name: Garden Lights Dim
    entities:
        light.garden_1:
            state: on
            transition: 2
            brightness_pct: 40
        light.garden_2:
            state: on
            transition: 2
            brightness_pct: 40

Then I would create an automation to turn the scene on at the time you want.

automation:
  trigger:
    platform: time
    at: '00:00:00'
  action:
    - service: scene.turn_on
      entity_id: scene.garden_lights_dim

I hope that helps.

That will help. But question, where can I make this Scene? I’m new to this.

You can place the scene in in your configuration.yaml file.

You are a star. All works and now some fine tuning and I’m happy. Thanks for the input.

Do you know if it is possible to trigger a scene from opening a gate? I have a GoGoGate module and connected to Home assistant. I can open and close the gate trough the UI.

What I want to do if you open the gate after 0:00 the dimmed lights should go to 100% and when you close the gate it goes back to 20%

I am assuming the GogoGate you are using has a cover in Homeassistant, and if so I would try something like this:


automation:
  - alias: 'GoGogate Door Open Bright Lights'
    trigger:
      platform: state
      entity_id: cover_gogogate
      from: "closed"
      to: "open"
    condition:
      condition: and
      conditions: 
        - condition: time
          after: '00:00:00'
        - condition: state
          entity_id: sun.sun
          state: 'above_horizen'
    action:
      - service: scene.turn_on
        entity_id: scene.garden_lights_bright
  - alias: 'Gogogate Door Closed Dim Lights'
    trigger:
      platform: state
      entity_id: cover_gogogate
      from: "open"
      to: "closed"
    condition:
      condition: and
      conditions: 
        - condition: time
          after: '00:00:00'
        - condition: state
          entity_id: sun.sun
          state: 'above_horizen'
    action:
      - service: scene.turn_on
        entity_id: scene.garden_lights_dim
        
        
scene:
  - name: Garden Lights Bright
    entities:
        light.garden_1:
            state: on
            transition: 2
            brightness_pct: 100
        light.garden_2:
            state: on
            transition: 2
            brightness_pct: 100
  - name: Garden Lights Dim
    entities:
        light.garden_1:
            state: on
            transition: 2
            brightness_pct: 20
        light.garden_2:
            state: on
            transition: 2
            brightness_pct: 20

I am thinking this should work, at least it works in my head : )

Wow okay looks like magic. I will try and give you an update when it is working. But I’m over the moon already.

Cheers,

Remco

First I did put in the scene into the configuration.yaml file and that worked. After a reboot I saw the two extra scenes in the UI. After I put in the automation part in the automation.yaml and after that I can not get into the Home Assistant. The system is rebooted several times and also complete power down of the raspberry.

Found some issues but now seems to be working.

Blockquote- id: ‘1566418818385’
alias: GoGoGate open licht aan
trigger:

  • entity_id: cover.hek
    from: dicht
    platform: state
    to: open
    condition:
  • after: 0:00
    condition: time
  • after: sunset
    before: sunrise
    condition: sun
    action:
  • entity_id: scene.garden_lights_bright
    service: scene.turn_on
  • data:
    entity_id: switch.qubino_goap_zmnhbdx_flush_2_relays_switch
    service: switch.turn_on

This is for the on part. I added a extra light on. But so far it seems to be working. Now the switch of part.

When you are copying code into your messages, you should copy the code in your message and then highlight it and click on the </> symbol above where you are typing your message. This will format the code the way it should be and makes it a lot easier to read. The code you have posted looks a little out of order, but that might be because of the formatting. Try the method I suggested above and we will go from there.

Ow okay.

- id: '1566418818385'
  alias: GoGoGate open licht aan
  trigger:
  - entity_id: cover.hek
    from: closed
    platform: state
    to: open
  condition:
  - after: '22:00'
    condition: time
  - after: sunset
    before: sunrise
    condition: sun
  action:
  - entity_id: scene.garden_lights_bright
    service: scene.turn_on
  - data:
      entity_id: switch.qubino_goap_zmnhbdx_flush_2_relays_switch
    service: switch.turn_on

This should be better. I have changed one bit already. I had dicht and that makes GoGoGate not connecting to Home Assistant. But now changed and working. I have also changed the time just for testing.

But it seems that when opening the gate the lights are not triggered. So I think the command open and closed are not the right ones.

Okay, deleted the time and sun part and now it is working. So the fault is in that part. I will add time now to see if that works.

Time is now working.

When I add the sun part it is not working. So time set to 0:00 now and end time 5:00 for now. And just walked the dogs and by opening the gate lights went on and by closing off.

Only the sun part now

Code now is.

- id: '1566418818385'
  alias: GoGoGate open licht aan
  trigger:
  - entity_id: cover.hek
    from: closed
    platform: state
    to: open
  condition:
  - after: 0:00
    condition: time
  - after: sunset
    before: sunrise
    condition: sun
  action:
  - entity_id: scene.garden_lights_bright
    service: scene.turn_on
  - data:
      entity_id: switch.qubino_goap_zmnhbdx_flush_2_relays_switch
    service: switch.turn_on
- id: '1566423130786'
  alias: GoGoGate dicht licht uit
  trigger:
  - entity_id: cover.hek
    from: open
    platform: state
    to: closed
  condition:
  - after: 0:00
    condition: time
  - after: sunset
    before: sunrise
    condition: sun
  action:
  - entity_id: scene.garden_lights_dim
    service: scene.turn_on
  - timeout: '60'
    wait_template: ''
  - alias: ''
    data:
      entity_id: switch.qubino_goap_zmnhbdx_flush_2_relays_switch
      service: switch.turn_off

I believe you are missing a crucial part in your condition statement, it is the " condition: and " and you have somethings out of order. Give this a try:

- 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: 0: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: 0: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

Let me know how that works.

Changed it into your code and not working. Opened the gate and closed it no trigger. Or do I have to wait until sun is up and the system is settling in?

If i delete the sun part it is working.

Cheers,

Yes, it will not trigger until it is after 0:00 and the sun has set.

So, I have to ask are you staying up until midnight, tonight? : )