Address multi led segments in Esphome

I will be adding WS2813 RGB LEDs to my stairs. In order to find an easy way to change colours and light effects I would like to use ESPhome to drive them. The challenge is now that I want each stair to light up after the other to mimick the direction you are walking in (upstairs or downstairs).

The challenge I am having is how to achieve the segmentation part in Esphome. Esphome can easily address all the stairs (=segments), but how to achieve this on a stair by stair basis is unknown to me.

Is there anyone who has got a solution to this?

Wiring will be according to the image below (shamelessly copied from: https://www.instructables.com/id/LED-Stair-Lighting/)

1 Like

not sure if this is of direct connection to your hardware, but check this out and watch some of his led videos: https://www.youtube.com/watch?v=2X_0Oe24vkA

see: https://www.youtube.com/channel/UCv7UOhZ2XuPwm9SN5oJsCjA/videos

There does not appear to be a way to address the individual strips/LEDs using the ESPhome RGB LED components. You would have to wire each strip’s data line back to the ESP and create 16 individual lights.

Unless you wanted to develop your own ESPhome LED effect.

Found the solution! It’s a little bit hidden inside the esphome.io site, but Light Partition should do the trick (https://esphome.io/components/light/partition.html)
Now it’s time to see if I can create the needed scene without running out of memory…

1 Like

Nice find.

Can you share the ESPhome code for that?

I am running some small scale testst (1 ledstrip with 60 leds) and thus far I am very happy with the results! All animations are done in Homeassistant. Find below the draft code. Rationale: every stair (currently 10 leds) should have 1 color led on all the time (different color per stair) and when script is triggered the stairs should turn on 1 by 1 and off 1 by 1. In the below you should assume that “part” means “stair”.

TODO:

  • ‘wipe’ effect for power on/off
  • Dimming according to time of day
  • Usage of sensors to determine moving direction upstairs/downstairs
  • Actually putting the strips on the stairs :slight_smile:

ESPHOME:

light:
  - platform: fastled_clockless
    chipset: WS2813
    pin: GPIO5
    num_leds: 60
    rgb_order: GRB
    name: "Fastled WS2813 Light"
    id: strip
  - platform: partition
    name: "part1"
    id: part1
    segments:
      - id: strip
        from: 0
        to: 9
  - platform: partition
    name: "part2"
    id: part2
    segments:
      - id: strip
        from: 10
        to: 19
  - platform: partition
    name: "part3"
    id: part3
    segments:
      - id: strip
        from: 20
        to: 29
  - platform: partition
    name: "part4"
    id: part4
    segments:
      - id: strip
        from: 30
        to: 39
  - platform: partition
    name: "part5"
    id: part5
    segments:
      - id: strip
        from: 40
        to: 49
  - platform: partition
    name: "part6"
    id: part6
    segments:
      - id: strip
        from: 50
        to: 59
  - platform: partition
    name: "led1"
    id: led1
    segments:
      - id: strip
        from: 8
        to: 8
  - platform: partition
    name: "led2"
    id: led2
    segments:
      - id: strip
        from: 18
        to: 18
  - platform: partition
    name: "led3"
    id: led3
    segments:
      - id: strip
        from: 28
        to: 28
  - platform: partition
    name: "led4"
    id: led4
    segments:
      - id: strip
        from: 38
        to: 38
  - platform: partition
    name: "led5"
    id: led5
    segments:
      - id: strip
        from: 48
        to: 48
  - platform: partition
    name: "led6"
    id: led6
    segments:
      - id: strip
        from: 58
        to: 58

And the homeassistant script:

'1570253195000':
  alias: Led 1 voor 1
  sequence:
  - data:
      brightness: '130'
      color_name: white
      entity_id: light.part1
    service: light.turn_on
  - delay: 
      milliseconds: 100
  - data:
      brightness: '130'
      color_name: white
      entity_id: light.part2
    service: light.turn_on
  - delay: 
      milliseconds: 100
  - data:
      brightness: '130'
      color_name: white
      entity_id: light.part3
    service: light.turn_on
  - delay: 
      milliseconds: 100
  - data:
      brightness: '130'
      color_name: white
      entity_id: light.part4
    service: light.turn_on
  - delay: 
      milliseconds: 100
  - data:
      brightness: '130'
      color_name: white
      entity_id: light.part5
    service: light.turn_on
  - delay: 
      milliseconds: 100
  - data:
      brightness: '130'
      color_name: white
      entity_id: light.part6
    service: light.turn_on
  - delay: 
      milliseconds: 100
  - data:
      transition: 1
      entity_id: light.part1
    service: light.turn_off
  - delay: 
      milliseconds: 100
  - data:
      transition: 1
      entity_id: light.part2
    service: light.turn_off
  - delay: 
      milliseconds: 100
  - data:
      transition: 1
      entity_id: light.part3
    service: light.turn_off
  - delay: 
      milliseconds: 100
  - data:
      transition: 1
      entity_id: light.part4
    service: light.turn_off
  - delay: 
      milliseconds: 100
  - data:
      transition: 1
      entity_id: light.part5
    service: light.turn_off
  - delay: 
      milliseconds: 100
  - data:
      transition: 1
      entity_id: light.part6
    service: light.turn_off
  - data:
      brightness: '130'
      color_name: red
      entity_id: light.led1
    service: light.turn_on
  - data:
      brightness: '130'
      color_name: blue
      entity_id: light.led2
    service: light.turn_on
  - data:
      brightness: '130'
      color_name: green
      entity_id: light.led3
    service: light.turn_on
  - data:
      brightness: '130'
      color_name: yellow
      entity_id: light.led4
    service: light.turn_on
  - data:
      brightness: '130'
      color_name: purple
      entity_id: light.led5
    service: light.turn_on
  - data:
      brightness: '130'
      color_name: brown
      entity_id: light.led6
    service: light.turn_on
2 Likes

Very impressive, thanks for sharing ! I just received my led strips and installed the nodemcu in the closet under the stairs.
Please share your whole conf when you are done, it will help a lot :slight_smile: Thanks !

I am still planning… Currently my biggest doubts are around power supply (35 amps) and wiring (to solder or not to solder). Will post everything as soon as it is fitted

Hi, did it manage to get started? I myself consider the same principle on my staircase. If you made a video of how it works and how it involved, I would be grateful. Thanks for your work.

It did! I have cut/soldered the first stairs of led strings. I will probably post a walkthrough of some kind in coming weeks.

1 Like

hey Frank,
did you continue this project? i’m about to start building a wordclock that I can trigger from ESPhome and where i can add other info as well (weather etc)

thanks,
Tom

Hi Tom, due to COVID I had to prioritize some activities that where higher on the family’s wishlist like creating a decent garden for the kids.

Still have the led strips cut to the right size of the stairs, so as soon as I have a bit more time I will for sure pick it up again.