Status_led, status_led light, binary light & light components?

I’m really confused by this list of components (or are they platforms?).
I would like to have the GPIO2 LED on my DOIT DEVKIT board to provide a “heathy” slow flash.
For example 0.1sec on, 2sec off. If the status_led has to be included in the toolkit that is fine.

If some one could offer a few code snippets that I can include in my working device, I would be most grateful. As I said, I have been at this problem for days, with no success!

Regards, Martin
As an aside, the status_led specification of OFF for anything other than Warning or Error seems to be flawed? How do I know that there is an Warning/Error if the LED is not working?

status_led is a component, and will default to off when no warnings/errors are present, slow blink on active warning, and fast blink on active error.

status_led light is a platform within the light component that follows the status_led during active warning/errors, but can be used as a configurable binary light component when no warnings/errors are active.

I think this should work:

light:
  - platform: status_led
    pin: GPIO2
    id: led_status_light
    restore_mode: ALWAYS_ON
    internal: true
    effects:
    - strobe:
        name: "Slow Blink" # 0.1s on, 2s off
        colors:
          - state: true
            brightness: 100%
            duration: 100ms
          - state: false
            duration: 2s
    on_turn_on:
      - light.turn_on:
          id: led_status_light
          effect: "Slow Blink"

internal: true makes the light component internal only, and hides it from your frontend. If you want to be able to toggle it from your frontend, remove this line, and add a name: line.
restore_mode: ALWAYS_ON makes sure the light is turned on whenever the device reboots.
The on_turn_on: block sets the “Slow Blink” effect when the light is turned on (otherwise, the default behavior would just be solid on without the blinking.)

I haven’t tested, but since this uses the status_led platform, it should override the effect and switch to the slow/fast blink behavior during active warning/errors.

2 Likes

Thank you very much. It is working a treat!
Can you suggest a simple technique to introduce (for debugging) an error and/or warning?
So that I can test the three modes?

Regards, M.