Create button to disable leds

Hello,

I have a simple automation based on Afvalbeheer (waste management).
When the day has arrived that the waste needs to be put outside, my led strip in the garden flashes green, but only between 07.15 and 09.45 hrs.

When I take the trash out, I want a button on the Overview dashboard which can switch of the led strip. But the button must only work when the led strip is activated by Asfvalbeheer. I use the led-strip for multiple things, so the button must only disable the led strip for the garbage.

This is my automation for the garbage

alias: Grijze bak buitenzetten
description: ""
triggers:
  - trigger: time
    at: "07:15:00"
    id: grijzebak-ledstrip-aan
  - trigger: time
    at: "09:45:00"
    id: grijzebak-ledstrip-uit
conditions:
  - condition: state
    entity_id: sensor.purmerend_restafval
    attribute: Days_until
    state: "0"
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - grijzebak-ledstrip-aan
        sequence:
          - parallel:
              - type: turn_on
                device_id: a73e11b81fc5282e62256f6d69409ce6
                entity_id: d580fd487bf4584fdb16b87f202177b6
                domain: light
                brightness_pct: 8
              - device_id: a73e11b81fc5282e62256f6d69409ce6
                domain: select
                entity_id: 351a7ca5b10b8c14d61ccd8514094a5c
                type: select_option
                option: Grijze bak
        alias: Ledstrip aan naar preset grijze bak
      - conditions:
          - condition: trigger
            id:
              - grijzebak-ledstrip-uit
        sequence:
          - type: turn_off
            device_id: a73e11b81fc5282e62256f6d69409ce6
            entity_id: d580fd487bf4584fdb16b87f202177b6
            domain: light
        alias: Ledstrip uit
    enabled: true
mode: single

And I created this for the button, but it doesn’t work:

alias: Afvalbak ledstrip uitzetten
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_button.afvalbak_reset
conditions:
  - condition: state
    entity_id: automation.grijze_bak
    attribute: current
    state: "on"
    enabled: true
actions:
  - type: turn_off
    device_id: a73e11b81fc5282e62256f6d69409ce6
    entity_id: d580fd487bf4584fdb16b87f202177b6
    domain: light
mode: single

Is

state:"on"

ok? Or is there another way to check if the led strip is turned on via the Afvalbeheer?

I hope someone can help me.
Regards, Peter

Add this to your working automation.

  - trigger: state
    entity_id:
      - input_button.afvalbak_reset
    id: grijzebak-ledstrip-uit

As a trigger

Wow, that is a fast respons! Thanks.

I am just a beginner with HA, so maybe this is a stupid question:
Do I add it like this:

alias: Grijze bak buitenzetten
description: ""
triggers:
  - trigger: time
    at: "07:15:00"
    id: grijzebak-ledstrip-aan
  - trigger: time
    at: "09:45:00"
    id: grijzebak-ledstrip-uit
  - trigger: state
    entity_id:
      - input_button.afvalbak_reset
    id: grijzebak-ledstrip-uit

in the working automation? And do I have to edit the button automation?

Yes that is correct. But delete the button automation.
You won’t need it

Hi,

Okay, I edited the automations and I am beginning to understand how it works.
Still learning yaml.

I will test it next Thursday when it is garbage day.

Thank you so much for the help.
Regards, Peter

You see now your requirements was rather strict.

Might need to strengthen the conditions then.

alias: Grijze bak buitenzetten
description: ""
triggers:
  - trigger: time
    at: "07:15:00"
    id: grijzebak-ledstrip-aan
  - trigger: time
    at: "09:45:00"
    id: grijzebak-ledstrip-uit
  - trigger: state
    entity_id:
      - input_button.afvalbak_reset
    id: grijzebak-ledstrip-uit
conditions:
  - condition: state
    entity_id: sensor.purmerend_restafval
    attribute: Days_until
    state: "0"
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - grijzebak-ledstrip-aan
        sequence:
          - parallel:
              - type: turn_on
                device_id: a73e11b81fc5282e62256f6d69409ce6
                entity_id: d580fd487bf4584fdb16b87f202177b6
                domain: light
                brightness_pct: 8
              - device_id: a73e11b81fc5282e62256f6d69409ce6
                domain: select
                entity_id: 351a7ca5b10b8c14d61ccd8514094a5c
                type: select_option
                option: Grijze bak
        alias: Ledstrip aan naar preset grijze bak
      - conditions:
          - condition: trigger
            id:
              - grijzebak-ledstrip-uit

          ###. Add condition that the led is on at brightness 8 percent.
        sequence:
          - type: turn_off
            device_id: a73e11b81fc5282e62256f6d69409ce6
            entity_id: d580fd487bf4584fdb16b87f202177b6
            domain: light
        alias: Ledstrip uit
    enabled: true
mode: single

Not sure what this option is you set also but perhaps this can also be a condition when turning it off.

And try and not use device triggers and/or device actions they are hard to read, will fail when you replace the device and so on…
Just use the normal actions like light on.

You can always test automations by using the developer tools to set states of entities to what they need to be for the automation to work.
And change the time in the automation.

1 Like

I use Wled on a esp32 and this is a preset in the Wled I use. The LED strip flashes green between 07.17 and 09.45, so I know it’s time to take out the green bin.

And try and not use device triggers and/or device actions they are hard to read, will fail when you replace the device and so on…

I don’t understand what you mean with this. Sorry, just beginnen with HA.

When you use the GUI to create a trigger or action, you currently press the device action/trigger.
If you search for light instead then you will get the “normal” trigger/actions.