Hey there,
I’m super duper new to HA development, plus: I’m not the most experienced Python dev: I program it in my freetime since couple of years, but unfortunately it’s not part my main job; I am a Software Engineer though, just not mainly a Python dev and HA really makes use of (feels like it) 100% of Pythons language features, so I sometimes struggle a bit to find the right things myself, especially if you have never done an actual project using Python asyncio.
My main question: I’m trying to submit my first, little improvement / maybe bugfix for a HA component: WLED.
I’m using WLED for a lot of LED strips I have in and outside of (X-Mas lighting) my apartment. One issue I have with the WLED component is that it chooses (imho) the wrong name when adding new entities.
If you’re not familiar with WLED: WLED is an awesome piece of software to run on a variety of microcontrollers to control (e.g.) LED strips. Two of its many abilities are:
a) Segmenting the LED strip into multiple segments, e.g. 5 segments of 20 LEDs each. And every segment is one entity in HA, so you can control it seperately.
b) Save and load presets: So e.g. have a preset where the strip is split into two segments, one where it’s split into five segments.
That said: If you have a preset active with two segments and then load one with five, the HA component needs to add entities for these other three (new) segments.
Imho, the current component chooses the wrong name for them, as for the base of the name (“BlaBla Segment X”, “BlaBla Segment Y”, etc…) it doesn’t use the HA device name, but always the actual name you have configured in WLED, so in the software / on the controller itself.
So I want to change it to use the HA device name as a base. But I struggle to get access to it in the current WLED component’s code. Strictly speaking about this line: https://github.com/home-assistant/core/blob/4ec81d4b6749932d3a998440972da0c554d264bb/homeassistant/components/wled/light.py#L164
I tried looking up other components, like the Yeelight component I also spent some time in already in the past, but I struggle to find it.
Could someone point me in the right direction, how to properly get an instance of the device these entities will be added for?
Thanks and sorry if I totally didn’t get the concept of this maybe
Greetings,
Andy!