Custom Component: LiteTouch

Sorry the dimmer still does work. The problem is that when I use the CINLL portion of the dimmer command it turns the LED off for some reason, thus reporting the switch as off in HASS. That’s why I was hoping prior to running CINLL portion of the dimmer command you could insert CLDON (set LED on) if dimmer is greater than 1 and CDLOF if dimmer is 0.

Here is a video I made if it helps at all. This was a Toggle = True switch

@patmann03, also curious about using CLDON for some unused buttons I have that I was going to turn into security and door lock features.
Not sure what it would take to put in CLDON codes or not.

Lastly, curious if you have thought about doing a clock update or if that would be tough to implement. I guess getting and setting the clock is kinda a big deal with most CCU’s as they tend to go off actual time. Here is some github code I found for a serial command clock update.

I’m not a programmer haha. I get some programming and can update others code, but I think for the clock update, I’d need to create a service within HA to update the clock. If I were you, I’d install node-red (if you haven’t) and do the update in there using inject node, function (to determine the current time and build the command), then the TCP node to submit the update to the controller.

Do your scenes also control relay modules in the enclosures for LiteTouch? If they are strictly lighting loads with dimmers, perhaps update the load type from scene to scene dimmer in LiteWare? I’ll take a look but I don’t think it’s really the correct move to force an led to be on as it should really be controlled by the controller. I might be able to add a forceled flag and test, similar to the toggle force.

I couldn’t get your youtube video to play, got some runtime error.

@patmann03
I’ll try and mess around with it.

The “patio scn 2” toggle I’m trying to toggle on then dim, has a 12v transformers like a lot of the lights in the house. That must get a reading from a relay as it dims in concert with another can 110v load on the scene’s button. What is strange is when I use CINLL to send a load that isn’t preprogramed for that button it shuts the scene’s LED off.

Here is a link to the YouTube video. Maybe that will work.

Hmm ok, yeah I don’t have a 12v transformer to test with… all of my LED’s have the built in transformer so they work as if they are a 110v light.

Interesting that it shuts the led off. What is your controller? Are you using the 5000LC (old controller) or are you upgraded to Savant’s SSL-P018? I know they’ve done firmware upgrades (I’m on an old version and am too nervous to perform the upgrade due to potentially bricking the controller). The controller must feel some load is associated to the loadgroup and the last load updated (if it decides its off) must turn off the LED.

Your friend sent me a PM so maybe he can take a look at how to get the load group status via the litetouch documentation and figure it out? It doesn’t make sense to me, but there is a command that allows you to get the load group load level, but it requires a module number, which I haven’t figured out how to determine.

I have the 5000LC with ethernet port. I totally know what you mean about being scared to do anything with the CCU. I’m on my second CCU after a failure of the first for a reason I don’t kno. I’m actually trying to program more around my stock PRG in fear of changing anything on the system would brick it or not allow it to come back to it’s previous state. I’ve only written over the PRG a couple times and I was nervous both times (haha).
I remember when I purchased this home and I called my good friend who is a great electrician and asked him “hey, have you ever seen a house that was Marty McFly inspired lighting controller?” Haha, that was my introduction to LiteTouch. Ironically now thanks to you and my friend that PM’d you I have come to love litetouch. It seems to be a pretty bulletproof system (just no lighting engineers left, but us to update it with modern smart controlling). With your and the other community and LiteTouch guru’s help I can now turn on and off rooms with my apple watch and alexa. That was my original goal.

The LED’s and wiring to the touch switches I believe are all 24v back to the modules (I never threw a multimeter on them), but I thought I saw that on the back of the switch when I was replacing some bad buttons. The 12v transformers I was speaking of are in the 110v lighting circuit loads going in and 12v going out. I have a ton of MR16 bulbs in small can directional housings throughout the house. So the circuits start as 110v then transform to ~12v then go to the bulbs.

See attached a photo of the transformers and a row of hallway lights (all 12v). I put the chandeliers in and had to find 12v candelabras.

I also messed with the get load group lighting level and originally this is the route I wanted to go (opposed with “get led”).
The problem is he doesn’t know python and I don’t either.
I also don’t really understand the event updates return either when monitoring for load changes.

It is just strange. TGSW command always gives the correct LED status for the scene buttons respective button. but CLDON and CLDOF (load on/off) for the load group number doesn’t engage the led on the respective switch address. That is why I thought we could force the LED for the switch address on with a CLDON command and off for a CLDOF command.
I think you said it is bad coding to tell it to turn a LED on then also ask the code to then give you a status update, right?

Oh and also when I TGSW a button on, then try to dim it, the LED then turns off.
Hence anytime a CINLL command is used the LED shuts off for my buttons as well.

Hey! I have to agree that this component is the greatest thing! I have been looking for a way to control the lighting remotely years ago. I have two relatives with Litetouch in their homes, they used the same contractor that installed the system, made basic programming and then after a lengthy and heated discussion, he left both systems with unfinished and with no support. He was the only Litetouch installer at the time in the country. So after a while being disappointed with the system and barely able to use it; they managed to fly an installer from outside. I then got involved and learnt the basics of liteware and got involved. I am no coder, but have basic skills, so I really couldn´t find any other way to send commands from away any other than using liteware and that is not really user friendly.
This year I was fortunate to find Patmann03 and his code. I got a raspberry pi, and voila got it working perfectly with node-red and a few lights. Now i have installed the component and added all the loads (about 100). Really super thankful with this talented guy.
The only problem we are having is that every reboot light entities are randomly disabled.

Here is a spreadsheet I made to copy/paste the data from Liteware and format it for this component

https://docs.google.com/spreadsheets/d/140LJ-XldwNGJycOkwK_09SYkdjYLUqOaTXiRGr7cv1A/edit?usp=sharing

Fixed the unavailable lights issue by running an automation 30s after starting homeassistant
with the homeassistant.update_entity command

- id: '1111111111111'
  alias: Reload Litetouch
  description: ''
  trigger:
  - event: start
    platform: homeassistant
  condition: []
  action:
  - delay: 00:00:30
  - entity_id:
    - light.kitchen
    - light.balcony
    service: homeassistant.update_entity

Did you have to do that for all entities or did it work for all missing?

I believe the unavailable issue may be with the initial load update call. It doesn’t seem to function well due to the fact that there are two separate receiving commands on the server and it seems to cause issues. I’m trying to figure out how to resolve, but for the meantime, if you want, you can edit the light.py and switch.py and comment out the get led states command:

async def async_added_to_hass(self):
        """Call when entity is added to hass."""
        signal = f"litetouch_entity_{self._addr}"
        async_dispatcher_connect(self.hass, signal, self._update_callback)
        #self._controller.get_led_states(self._addr)

the result will be the initial states of the lights will be incorrect upon initially loading, but they will get in sync the first time a light status changes.

I listed all the entities of litetouch in the automation, so all of them get reloaded, and then all are available

I am getting the following error

Log Details (ERROR)

Logger: homeassistant.components.websocket_api.http.connection.2837678224
Source: custom_components/litetouch/light.py:86
Integration: websocket_api (documentation, issues)
First occurred: 11:51:32 AM (4 occurrences)
Last logged: 11:52:35 AM

invalid literal for int() with base 10: '0a0'
invalid literal for int() with base 10: '0a1'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1234, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1257, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 198, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 402, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 599, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 433, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 632, in async_turn_off
    await self.hass.async_add_job(ft.partial(self.turn_off, **kwargs))
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/litetouch/light.py", line 86, in turn_off
    self._controller.toggle_switch(int(keypad), int(button))
ValueError: invalid literal for int() with base 10: '0a0'

ah right, let me take a look. Thanks.

Ok, I’ll move a fix out later tonight.

Updated.

This should fix your issue with non numeric keypads
This may fix your issues with unavailable lights.

NOTE: This version will also update your controllers clock to match your current local time upon starting the component.

Awesome about the clock!!

Alright!!! New update. Instead of calling the clock update during the load (which some people may not want). I’ve created a new service that can be called via automations to update the clock. You can manually run it from the developer page > services > litetouch.set clock