State of individual LIFX LED strip zones missing

I have recently bought a LIFX led strip. It has several individually addressable zones. I have found that the state of the individual zones are not available in HA. The LED strip is represented as a single LightEntity instance and the state of this instance reflects the state of the first zone of the LED strip.
Although there is a service call, lifx.set_state, which takes a parameter, zones, allowing individual control over the zones, it seems that the current state of the zones are not available.

Turning to the lifx component implementation in HA Core, it seems that HA actually gets the state information from each zone in the update_color_zones() method by calling get_color_zones() from the aiolifx module. (https://github.com/home-assistant/core/blob/94f06f86cf426bd5469ee19f615c317dfcb045a8/homeassistant/components/lifx/light.py#L736)

I might be overlooking something obviously… I am after all quite new to HA. But as far as I can see, I cannot get the zone state information from HA, even though it seems to know the state for each zone somewhere internally.
Assuming I’m correct, I would love to help implementing this feature, however, I’m not quite sure what would be the best way. I’m not quite sure how the @property methods work. Would it be possible to add extra @property methods, and then make the LightEntity carry additional information, or are you limited to the inherited methods? Alternatively; could it be a solution (e.g. would it be wise) to represent the LED strip as len(zones) different LightEntity instances, each representing a unique segment of the LED strip?

I’ve found the answers myself.
You can add the extra_state_attributes(self) method and return a dict of attributes you want added. This works just fine for LightEntity also.
I find this a neat solution for the feature I wanted to implement.

Can you explain this solution with a little more detail? I would love to implement it.

Thanks.

2 Likes

So how does this work?

It currently doesn’t. This is a legacy function that hasn’t yet been reimplemented in the updated LIFX integration. I’ll take a look at it this week to see if I can get something that meets the new Core requirements working.

1 Like

I’ve submitted a PR for this: Add a Zones sensor to LIFX multizone devices by Djelibeybi · Pull Request #84934 · home-assistant/core · GitHub but I’m not sure if it’ll be accepted as-is. I might have to tweak it to meet new Core guidelines.