I have created the centralite folder under the custom_components, put all the files in GIT and checked that the folder and file rights are the same as other custom components.
Does anyone have an idea of how to solve it?
I am running Home Assistant Core Version 2021.12.3
I can’t tell from your description what the problem is. I would make sure your ~/centralite folder is in the right location (should be config/custom_components/centralite). Do you have any other logs for further detail? It may be helpful to see what you put in your configuration.yaml.
You may be the first person to try my custom integration. Hopefully I didn’t miss anything in the readme steps.
The upside of reference by ID is that if on reboot your usb moves from ttyUSB0 to ttyUSB1, referencing by ID doesn’t break your configuration. One warning is that if you have more than one serial-to-usb that are the same model, sometimes the manufacturer uses the same ID for every device so they aren’t unique.
You can find your usb settings from a command line: dmesg |grep usb
update: I double checked my local repo versus the github copy. There is one possibly meaningful change I was debugging that isn’t on the github version but I’m not convinced it matters. If you have issue with lights let me know or message me.
Thanks for your support. I got my cable finally I connected the elegance to my pi. The scenes seems working, but I cannot see the lights. I can see that they are being added, but I cannot find them as an entity.
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice after get load name, self._name is L021
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] we are in class LJDevice
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice incoming name is L021
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice after get load name, self._name is L021
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite.light] Light loaded succesful: L021
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite.light] init of the light for 22
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite.light] init of the light self._name is L022
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] we are in class LJDevice
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice incoming name is L022
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice after get load name, self._name is L022
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] we are in class LJDevice
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice incoming name is L022
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice after get load name, self._name is L022
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite.light] Light loaded succesful: L022
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite.light] init of the light for 23
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite.light] init of the light self._name is L023
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] we are in class LJDevice
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice incoming name is L023
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice after get load name, self._name is L023
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] we are in class LJDevice
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice incoming name is L023
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice after get load name, self._name is L023
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite.light] Light loaded succesful: L023
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite.light] init of the light for 24
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite.light] init of the light self._name is L024
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] we are in class LJDevice
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice incoming name is L024
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice after get load name, self._name is L024
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] we are in class LJDevice
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice incoming name is L024
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite] LJDevice after get load name, self._name is L024
2021-12-27 15:55:13 DEBUG (SyncWorker_1) [custom_components.centralite.light] Light loaded succesful: L024
Furthermore, am I correct in saying that the switches are not supported yet?
I just pushed my debug version of light.py to github. Pull down that version of light.py and try it out. I was having trouble at some point and in debuging made one change to get the lights to show up in the UI. As I’ve been modifying someone else’s code ot get this centralite working (and I’m not a python guru), I’m sometimes making best guesses.
Switches aren’t working as I’m not sure where to put the call in the code to update status. My understanding of HA architecture is limited and I keep getting stuck. I’ll try to take a look at it. I’d like to get the switches working because I’d like to trigger automations off of button presses.
In looking at the switch code, right now it is seeing ‘presses’ and ‘releases’. The UI doesn’t show much change as a press will turn on the toggle and the release will turn off the toggle. There is no concept of a press-and-hold to dimm. In HA, the code can just set the brightness level so I don’t think a press-and-hold concept is needed. Can you think of one? I guess if you want to press to dimm via the HA UI it would be helpful but I’m not sure if a switch entity can do that.
I never got the get_all_switch_states or get_all_load_states code working. I’m looking at that. I do have the PDF files for the programming codes. Here’s a link to my copies: http://vps2.tincreek.com/centralite/
I created a branch repo on my github for testing. In digging, I see a couple of problems with the code.
The _sendrecv() function conflicts with the while loop that is reading the serial/RS232 input. The while loop always gets the response that the _sendrecv() is anticipating. The code I started with already had this design approach but due to this problem, today in my branch I’ve moved to letting the while loop recognize the hex status responses. I’ll probably move away from _sendrecv() and just use _send() unless I find a way to deal with that.
I noticed that the hex2bin for load/lights is a different encoding scheme than it is for switches (according to Centralite docs). Wow. Anyway, I copied the hex2bin to a new function for switches, but I haven’t validated it is working right.
The big odd thing… when asking my Centralite system (^G) for the load/light status, I get a hex string back as anticipated. BUT, when I ask the Centralite system for the switch status (^H), I only get back zeros. I get the right number of digits/characters but they are all zeros. It isn’t clear to me if this is only showing me which switches are being PRESSED at that moment or if it is supposed to be showing me which switches have a light on them.
The hex status update functionality for lights/loads isn’t that important because the state of the lights are discovered on bootup. Then the centralite always reports to HA when it is changed. So, Centralite and HA stay in sync.
The status of switches is more unknown. However, the code does report from Centralite to HA a pressed switch and a released switch. That is useful for triggering automations in HA, but the status/state is not tracked. HA can see that the light/load itself is on/off but it can’t tell that from the switch state. It works for programming in nodered, but it’s not elegant on the UI side.