-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lights not turning off reliably #22
Comments
I'm seeing this issue too. It seems especially prevalent when I run a script or call a light.turn_off service for multiple groups simultaneously. I see them hit MQTT and cmqttd but only the first one or two lights go off, the rest do not. I see the same PCIErrorPacket error as you do. Could it be that there are too many messages in rapid succession?
|
I'm also seeing an issue where the lights don't turn off reliably when set off from an automation with a large number of other lights. The lights show as |
I am seeing the same thing. I am putting lights in a light group then turning off the group. Some lights stay on. If I trigger the Home Assistant script multiple times I typically get additional lights turn off (from the original group). |
Did anyone have any luck resolving this? It would be really great to be able to control several groups in a batch reliably. |
I didn’t. I went back to using my cgateweb based solution, which has been very stable. |
I am seeing the same issue on my setup. running scenes with multiple lights doesn't work consistently |
I'm using cbus for a new home and this is on my todo list to investigate and hopefully fix as I need reliable bulk group changes. I'd love to eliminate c-gate and the java runtime from my final environment as these seem quite redundant. If anyone has any hints on where to start looking that would be great! Cheers |
If you have a 5500SHAC or similar, check out https://github.com/autoSteve/acMqtt |
@Nick-Adams-AU that looks great but I only have the old Ethernet CNI |
After some investigation I believe that the issue is just that its sending commands too quickly for the CNI to handle. Here is the comment from pciprotocol.py
Actions are to figure out what the best rate is and implement a message queue |
That's a great lead @mitchell-johnson thanks. I wonder if someone with a SHAC or similar could send a batch of commands through and snoop for the timing it uses? Come to think of it even the toolkit can batch switch multiple groups can't it. Maybe c-gate could be a point of reference for timing? |
It seems its a known thing. In the setup code there is already. I have forked this PR #36 that adds a throttled queue to get the status of all devices on connection. I dunno where 97 ms came from but works for that so im going to see if I can just reuse the same thing. https://github.com/CABrouwers/cbus/blob/c8c4000b81cfa1258c466d0c45b313f8ff6759d1/cbus/daemon/cmqttd.py#L174 |
That sounds promising! I'm usually bit averse to the old just add a sleep as a fix but sometimes working with undocumented protocols force a bit of improvisation. |
I have pushed the changes here if you wanted to try them out. Just adds a 100ms delay between each light. I don't love it. I believe I should be able to figure out which command fails and retry it but at least its working for me now |
Awesome thanks. My cbus kit is packed up ready for install at a new build but next time I fire it up I will definitely test it. Hopefully someone else will too! Great work. |
Feel free to email me mitchell at johnson dot fyi if you need a hand with the setup |
Hey Mitchell, I tried to install your fork of cmqttd and things went pretty crazy. Previously I was running the micolous code from 2021. In your fork there have been several updates around how labels are handled. I am not using a project.cbz file and with the new version I was getting errors in publish_all_lights. Are you using a project.cbz file? Do you think I can just cherry pick your queue related changes? |
Thanks @mitchell-johnson I have made the changes and it is working like a charm. The delay give a nice ripple effect through the house as I operate on the big groups we have here. Thanks so much for nutting out this problem I have been frustrated by it (but not enough to debug myself) for the last two years !! Thanks again. |
There are 2 areas that I might get to researching. The CNI obviously has some sort of buffer that gets full up. In theory rather than waiting 100ms to send each command we should be able to do 2-3 at a time then wait some amount of MS then continue. Also there is confirmation code logic that is not fully implemented that should allow you to check if a given command is executed successfully. Doing both of those would be the best solution. |
Might find this useful for debugging/tracing communications https://github.com/robert/how-to-build-a-tcp-proxy/blob/master/tcp_proxy.py |
I am integrating with Home Assistant and this is such a great addition to any CBUS setup. Logging from HA suggests that the MQTT messages are being sent and received as expected. I have a HA script that is trying to turn 4 lights on and off. The 'on' script works but the 'off' script does not turn all the lights off. Here is the debug from cmqttd:
As you can see I get and invalid packet. When I run the script a second time I get the same issue.
To get the light to turn off I need to activate another scene that includes the light in question, then try turning off again and this mostly works.
Unfortunately this does not happen every time I run the on and off scripts. Here is what a successful lights on and then lights off looks like:
Any help would be really appreciated. I am running cmqttd on
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal
Python version: 3.8.5
The text was updated successfully, but these errors were encountered: