Custom Component: LiteTouch

I’ve built a custom component for the centralized lighting system: LiteTouch. This integration will work with the 5000LC or the new Savant Controller. LiteTouch is an older centralized lighting system that was discontinued by Savant after being acquired.

See my github here: https://github.com/patmann03/custom_components

This started out as a Node Red flow and I decided to take the challenge to build the integration. Luckily, I didn’t need to start from scratch. I was able to use the Homeworks integration as a base and then changed it to work with LiteTouch. I’m not a programmer, so most likely this will stay a custom integration rather committing it as a main component.

As stated in the readme, place the litetouch folder inside the config/custom_components folder. Reboot the server is a required before updating the configuration.yaml.

Here is a sample of the yaml:

litetouch:
  host: "192.168.1.65"
  port: 10001
  dimmers:
    - addr: "016_2"
      name: "Main Hall"
      loadid: "82"
    - addr: "4_7"
      name: "Front Hall Chandelier"
      loadid: "23"

Currently, this integration only supports lights, but I will add an option for a keypad/outlet. The address is the keypad#_button#. the loadid, is the index number / group number associated to the lighting load. You can get this from the LiteWare software.

I know this lighting system isn’t very popular as it was quite expensive to implement. I got lucky and came across this house as a foreclosure. Hopefully, there are others out there that this helps.

I learned a lot about using git, classes, tcp connections, handling callbacks. Super cool project, had a lot of fun.

Updated v2. Added switch.

Hey @patmann03
This is so helpful!
I’m having a friend doing the same integration right now for me. I read through some of the code (as a novice) to see how and what you were working on and gave it a test run. The code kept crashing my HASS virtual implementation, but did work once or twice. I’ve just received a RasPi and will try it that way.

I see you are tracking LED’s of your switches (i’m guessing for load state reporting). I have 40+ and quite a few are redundant (IE 3 switches have the same button), so I’m just kinda curious how you used the LED’s for your HA dashboard/reporting.
Would you be able to shoot me a screenshot or two of how you are using the controller for updates and control? What UI are you using? LoveLace or other?

When controlling do you find yourself doing loadgroup’s on/off or pressing toggle switch more?

If I have my friend build onto your code is there anything you would like to try and have added?

How about do you know why mine is crashing?

I’ve done some minor updates. I’ll update my GitHub today. Not sure why it would crash. What’s happening when it crashes? Can you enable the logging component and add debug for custom components and include litetouch. You need to include the quotes around the address and the load ID. Maybe that’s what’s going on? You also need to start hassio without any configuration then setup your config and restart. I had issues when u tried to start it all at once.

Each button will have a load group that corresponds to it. Almost all of my keypads have 9 buttons and I have over 60 keypads. Although I certainly don’t add all of them. So when I’m controlling the lights in a room there maybe 1-8 loads in a single group but I just check to see if that button is turned on to determine status. Unfortunately there isn’t a way to check just the light group status… well there kind of is but it requires knowing a module number and I couldn’t figure out how to get it to work.

Updated my github.

Ok, it is stable and not crashing now.

For some reason when I turn on my loadgroup 116 as a switch it turns the LED on at its respective station address 039_3
When I add it as a dimmer it doesn’t turn the led on the station on.

This happens with other load groups as well.

As you know this causes an error in the reporting of the lights on or off as CGLED command is reading it as off, when it is really on.

Do you have any idea why sometimes CSLON would turn an LED on or not?

If I use your code and put the loadgroup 116 at station 039_3 in as a switch the station LED DOES turn on. If I put it in loadgroup 116 at station 039_3 in as a dimmer it does NOT turn the LED on the station on.

What is strange is that my load group 115 corresponds to station address 039_2 and when I put that one in as a switch it turns on the LED 039_3, which is for loadgroup 116. Loadgroup 115 with LED at 039_2 then doesn’t turn on and it reports as off.

I flat out can’t get them to work as dimmers, they just won’t turn on LEDs.

I suspect it has something to do with my original Litetouch PRG config file, but wondering why in the world as a switch the LED would turn on for 116, however when I go into my own telnet and use the command for loadgroup 116 it won’t turn on the LED. It is like your code is magical (sometimes… haha)

@patmann03 do you think my above issue could be because my loadgroup id 116 works multiple switches with different positions in the keypad?

IE Switch address 038_2 does the same thing as switch address 038_3

My loadgroup 116 runs on 3 switches total at different addresses.

If you have loads that are not dimmers in the load group you’ll have this issue. Turning a dimmer on does so with a different call to the controller. It sets the load level which does not work with non dimming loads. A switch turns the load on and works with both the dimmers and the relays. I can look into changing it so when you turn dimmers on it doesn’t set the level, but you could then dim the lights after wards.

@patmann03
You are so the pat”man” for offering!! The main issue is most my switches are scenes and the rooms have 4-5 loads on each button. When I try to control via CSLON and CSLOF RTC commands it is unreliable at turning on the switch leds as for setting status of the HASS button status.
In your code file I saw you started going down the CTGSW Avenue but then never implemented.

Using your code as is I have a rinky dink workaround of using other led status states within my switches scene buttons, but really the most reliable deal is going to be to use the CTGSW (toggle switch) command. I know every time that I used CTGSW my LEDs act normal and report normal.

Would it be hard for you to make an option in your code as to if I wanted HASS switch to be controlled by CTGSW (toggle) vs CSLON/OFF I could enumerate the switches address line with a character like -1 at the end of the address? I’m a horrible coder so this might be like coding suicide, but any variable or character would be fine and add it anywhere in the switches setup. But see example below if I’m confusing you.

Ie below the “Sample” switch below I add a -1 so the code calls for a CTGSW opposed to CSLON/OFF
where “Sample 2” would use CSLON/OFF

dimmers:
- addr: “016_2”
name: “Main Hall”
loadid: “82”
switches:
- addr: “016_2”
name: “Main Hall”
loadid: “82”
- addr: "018_2-1”
name: “Sample”
loadid: “88”
- addr: "018_2”
name: “Sample 2”
loadid: “88”

Also to an earlier point. I was also considering going down the module notification path to get load monitoring. I finally figured out the mapping in my head but thinking on it now it would sorta be a nightmare of coding if I wanted to run preset lotetouch programmed scene buttons which is how the majority of my rooms are run. All my scene switch buttons call for 4 or so different module addresses and then I’d have to ask the system if these 4 are on turn on button where the led approach you use is probably the fastest and like you said what you figured out already.

I suppose there is one more option of using the setled on/off RTC command (CLDON CLDOF ) so HASS forces the respective led states on since my liteware prg doesn’t do it consistently with load on off and dim commands (CSLON/OF and CINLL). Then I can continue to use the load on off and dimmer functions with existing code base.

Would that be easier to program than CTGSW variable?

some good points. When I initially created my node red flow, I used CTGSW. The main issue I ran into was with some automations turning lights off after turning them on but when I think about it, it was related to how I was getting the LED states by polling every 30 seconds vs getting the updates directly from the controller notifications (like this implementation is doing). I could look into creating a different class for the toggle or perhaps add a flag so that it knows to use toggle vs CSLON/CSLOF. I’ve never tested forcing the LED to turn on, but that is also something in theory that could be done.

Let me think about it for a bit as I do have 1 or 2 loads that have the same issue as you, it may be beneficial for me as well!

for the option, I think it would be more like this:

litetouch:
  host: "192.168.1.65"
  port: 10001
  dimmers:
    - addr: "016_2"
      name: "Main Hall"
      loadid: "82"
    - addr: "4_7"
      name: "Front Hall Chandelier"
      loadid: "23"
      toggle: true
  switch:
    - addr: "017_2"
      name: "Outside Outlets"
      loadid: "110"
      icon: mdi:power

That sample code makes much more sense than my code suicide. :grinning:

Thanks so much for taking a look at that.

FYI Alex Wolfe replied to my email. I had asked him about what he uses his code mainly for and what UIX and favorite features are. He told me he actually uses it solely in reverse of what I believe our goals are. No UIX. Rather he presses a button on a keypad (he says he has way more than he uses, probably like us (50-60x9 buttons) and it arms his alarm and locks/unlocks his doors and such like that. GENIUS!!

The programmer I work with isn’t versed in Python unfortunately, but I can try and get him to implement something if you are short on time, just let me know if I can help in anyway.

Regards,

yeah, I think I’ve programmed 15 loads, but also have 60+ keypads and 9 buttons each. Super overkill.

I’m going to take a look at this over the next couple of days while watching some TV.

Awesome! Thanks so much @patmann03

Alright man, that was super easy. For the toggle flag, use my suggestion above. You may or may not need quotes around the true (I tested it with the quotes “true”). It will work for both switches and lights.

Also, if you set the brightness to turn the load on, it will not use the toggle, same with turning the load off. If you use the toggle within HA it will use toggle for both on/off.

I’m getting a error that Toggle is not a valid command. Can you release the new code on Github?

yeah, new code is on github. You have to load the files, then reboot, then edit the config and reboot a second time. (reboot home assistant that is)

@patmann03
I’m so grateful for all your help. I can’t even tell you how awesome it is to have this working. Thought I would update you that it is working great and TGSW updates LED’s perfectly.
Now to get off virtual Ubuntu and onto the Raspi4 that just came.

Curious…
What do you think about using CLDON/OF to manually force the LED’s on and off so we can get the dimming back via CINLL? That is really the only downside to using TGSW (no dimming).

Is it hard for you to integrate CLDON (Set LED ON) when CTLON (toggle load on) or CINLL (Initialize load lever) for the particual switch address. Then you can also CLDOF when CLTOF (toggle load off) or CINLL is moved to zero percent?

My workaround I used for toogle loads on/off (CTLON/OF) is to point to a different LED/button within the same switch (more or less changing the switch address to get HASS to read that a loadgroupid is on. Seems to work okay. Only downside is after a bit the LED’s on the switches can get a little out of wack. IE some LED’s are staying lit to loads that aren’t really on, etc. It just isn’t the right way to do it, so it keeps me a little restless, but it works.

You can still dim lights as long as you set then up as dimmers in yaml. Just need to turn them on first via the toggle. I use the slider-entity-row card and enable toggles. This gives me access to brightness right on the card. Without that card you can drill into the entity by clicking on the name and you should have access to brightness.

The problem I see with your suggestion is you now run two commands vs. 1. If I have some more time later I can meet around with it.