Esphome partition examples?

Does anyone here have any examples of how to split a single same led strip into two or three separate controllable lights?

This seems to be able to combine but I can’t find how to split…

Thanks in advance!

Mark

BUMP

Anyone have any ideas how I might do this?

This may be of interest to you

1 Like

Thanks, I see the sample code has been updated. I will check it and have a look

Thanks!

ok - so i just dont seem to be able to get this working. So here’s a senario…

I have a NeoPixel ring with 16x LEDs all connected to a Wemos D1. I would like the 1st Led to be on one light and the next 10 to be on the other. This is what I have currently:

light:
  - platform: partition
    name: "ledstrip07_partition"
    segments:
      - id: ledstrip07_1
        from: 0
        to: 0
      - id: ledstrip07_2
        from: 1
        to: 10
  - platform: fastled_clockless
    chipset: WS2812B
    pin: D5
    num_leds: 1
    rgb_order: GRB
    name: "ledstrip07_1"
    id: "ledstrip07_1"
  - platform: fastled_clockless
    chipset: WS2812B
    pin: D5
    num_leds: 10
    rgb_order: GRB
    name: "ledstrip07_2"
    id: "ledstrip07_2"

Any ideas why this wouldnt work ?

Thanks in advance.

Did you get his working ? As I’ve not been able to with my light partition.
No errors even in debug mode, only seems to work if I have all the LEDs added.

I’ll post my code tomorrow.

1 Like

So couldn’t get it working for the life of me, but then tried it on another LED ring with 12 LEDS,
Here is were it gets strange…
If i turn on section1, nothing happens on the LEDS.
If i turn on section2, nothing happens on the LEDS.
If i turn on section3, the first two LEDS turn on on the ring (assuming the arrows on the PCB are pointing the correct way)

light:
  - platform: partition
    name: "ESP6_light_part"
    segments:
      - id: ESP6_section1
        from: 0
        to: 1
      - id: ESP6_section2
        from: 2
        to: 10
      - id: ESP6_section3
        from: 11
        to: 12
  - platform: fastled_clockless
    id: ESP6_section1
    chipset: WS2812
    pin: D1
    num_leds: 2
    rgb_order: GRB
    name: "ESP6 LED section1"
  - platform: fastled_clockless
    id: ESP6_section2
    chipset: WS2812
    pin: D1
    num_leds: 9
    rgb_order: GRB
    name: "ESP6 LED section2"
  - platform: fastled_clockless
    id: ESP6_section3
    chipset: WS2812
    pin: D1
    num_leds: 2
    rgb_order: GRB
    name: "ESP6 LED section3"

1 Like

Yes I see the same I couldn’t find a working example anywhere

@mark.carline
Think i got it, not sure how, i was looking at a closed github issue.

So i tried that way of writing the partition and after a few hours of banging my head (more cause i’m throwing up every few hours :face_vomiting: )
I have this.
Hope it helps.

light:
  - platform: fastled_clockless
    chipset: WS2812
    pin: D1
    num_leds: 12
    rgb_order: GRB
    name: "ESP6 LED Ring"
    id: LED_ring
  - platform: partition
    name: "ESP6_section1"
    id: section1
    segments:
      - id: LED_ring
        from: 0
        to: 1
  - platform: partition
    name: "ESP6_section2"
    id: section2
    segments:
      - id: LED_ring
        from: 2
        to: 9
  - platform: partition
    name: "ESP6_section3"
    id: section3
    segments:
      - id: LED_ring
        from: 10
        to: 12


7 Likes

Ok great I’ll try tonight + get well soon ! :wink:

Thanks, @cooljimy84.

You’re a star, this is not how the example looks in the docs though. Still got a lot more to put in, going to have 8 separate lights.

  - platform: neopixelbus
    type: GRB
    pin: GPIO5
    num_leds: 24
    name: "Kallax1"
    id: kallax
    effects:
      - random:
      - addressable_rainbow:

  - platform: partition
    name: "K1"
    id: k1
    segments:
      - id: kallax
        from: 0
        to: 11
    effects:
      - random:
      - addressable_rainbow:
  - platform: partition
    name: "K2"
    id: k2
    segments:
      - id: kallax
        from: 12
        to: 23
    effects:
      - random:
      - addressable_rainbow:
3 Likes

No problem, the docs tripped me up as well.

I found someone else’s example and then it all clicked

I can confirm that this is working :slight_smile: @cooljimy84 you’re my hero. The example in the docs is really confusing and I couldn’t find a lot of further info online…

1 Like

This works really well. I have 3 partitions working great, and can use each partition as a different status indicator for various things. A problem I have come across is that I can’t store the partition states in a “scene.create” automation. The states never get stored, scene.create Upon restoring the scene, the partitions are off. The strip as a whole works with the scene.create function correctly, I guessing the issue is that the partitions do not have unique entity_id’s. Anyone see this a way around this?

Oh yes the ESPHome documentation IS a bit confusing at first for this. I’m going to give the a go setting it up and then possibly submit a PR for documentation change.

This completely worked after I spent an hour trying to figure out why the gpios I chose were both working the same led strip each time :slight_smile:

Great work explaining the code, the guide needs fixing as yours worked and covered things much better.

Thanks again! @RoadkillUK

i’m having the same issue. it only updates the first set color, but not the 2, 3,…

found a solution for this?

What does your code look like? @tom_el_camino. You’re not giving us much info here :slight_smile:

sorry.

here’s my code for the partitions:

light:
  - platform: neopixelbus
    type: GRB
    pin: GPIO3
    num_leds: 60
    name: "NeoPixel ledstrip"
    internal: true
    id: strip
          
  - platform: partition
    name: "box3"
    id: part1
    segments:
      - id: strip
        from: 0
        to: 20
  - platform: partition
    name: "box2"
    id: part2
    segments:
      - id: strip
        from: 21
        to: 38
  - platform: partition
    name: "box1"
    id: part3
    segments:
      - id: strip
        from: 41
        to: 60          

I then have a script that turn on the ledstrip id per id and then it triggers a scene:

alias: lightbox001
sequence:
  - service: script.box_lijnen_uit
  - wait_template: ''
    timeout: '00:00:01'
  - service: light.turn_on
    data:
      transition: 10
    target:
      entity_id:
        - light.box1
  - wait_template: ''
    timeout: '00:00:01'
  - service: light.turn_on
    data:
      transition: 10
    target:
      entity_id:
        - light.box2
  - wait_template: ''
    timeout: '00:00:01'
  - service: light.turn_on
    data:
      transition: 10
    target:
      entity_id:
        - light.box3
  - scene: scene.lightbox001
mode: single

and the scene is setting a different color per id (ex red green blue)

but when i look at the above’s scene’s YAML it only shows the first ID and not the other 3…

- id: '1616535068269'
  name: Light box colors
  entities:
    light.box1:
      brightness: 202
      hs_color:
      - 240
      - 100
      rgb_color:
      - 0
      - 0
      - 255
      xy_color:
      - 0.136
      - 0.04
      friendly_name: box1
      supported_features: 57
      state: 'on'

i guess this is a bug, when you create a scene with 3 partitions it doesn’t detect it as 3 seperate “scene’s”?

and even if I manualy write in the other 2 entities:

- id: '1616535068269'
  name: Light box colors
  entities:
    light.box1:
      brightness: 202

      rgb_color:
      - 150
      - 0
      - 0

      friendly_name: box1
      supported_features: 57
      state: 'on'
    light.box2:
      brightness: 202

      rgb_color:
      - 0
      - 150
      - 0

      friendly_name: box1
      supported_features: 57
      state: 'on'
    light.box3:
      brightness: 202

      rgb_color:
      - 0
      - 0
      - 150
    
      friendly_name: box1
      supported_features: 57
      state: 'on'

it only uses the first “light.box3”