UPB lighting

Technically itā€™s not really the buildroot version thatā€™s the issue, itā€™s the kernel version here in home assistantā€™s BR2_EXTERNAL which is too old to contain my patch.

1 Like

One more thing: I can get the UPB integration to communicate with the USB CIM, all on the same machine, if I use ser2net.

In other words, instead of configuring the UPB integration to communicate directly with the locally-connected USB CIM via /dev/ttyUSB0, Iā€™ve configured it to talk via localhost on port 2101 (namely, via ser2net).

Until the UPB integration can talk directly to the USB CIM, via /dev/ttyUSB0, this is one possible way around the current limitation.

The machine that does not work with the integration, what OS is that? Can you get access to the HA install? How about the python interpreter that HA is using? Or is that ā€œlockedā€ away in docker?

If you can a couple of quick things to try to see if we can explore further. Does typing python at the command line take you into the interpreter? (Type ^D to exit it).

Try some of the things on this page: https://pyserial.readthedocs.io/en/latest/shortintro.html. Errors?

If those work then I might be able to dig deeper. I use pyserial-asyncio, which I believe is based on the pyserial stuff, just async.

Itā€™s Home Assistant Supervised on Ubuntu 18.04.5. That means Home Assistant is in a docker container. However, thereā€™s no problem getting to the command line within the container (where I can access python3). Iā€™ll try out your suggestion tomorrow.

Unfortunately, I didnā€™t get very far. Iā€™m puzzled why it claims the serial module lacks the Serial attribute.

Python 3.6.9 (default, Jul 17 2020, 12:50:27) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> ser = serial.Serial('/dev/ttyUSB0')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'serial' has no attribute 'Serial'
>>> 

Iā€™m running python3 from Ubuntuā€™s command-line and not from within the homeassistant container. I wanted to confirm it works here before trying it within the container.

This is whatā€™s installed (from sudo apt list python3*):

python3-serial/bionic,bionic 3.4-2 all

What. A. Headache.

I appear to have learned nothing from the first time this happened! :man_facepalming:

For good measure, I restarted my production server and then the USB CIM on /dev/ttyUSB0 was instantly discovered by the UPB integration.


Now to see if the USB CIM experiences any of the stability problems mentioned by webmtn in this post. The difference is itā€™s being used with Linux, instead of Windows, so maybe the lockup problems he observed wonā€™t manifest themselves in this environment. I should know more after a few days of operation.

Learning does cause headaches sometimes :wink:

Thrilled that you have this working though! This is great news.

FWIW, I had installed Putty and Minicom and both were able to connect to the USB CIM via /dev/ttyUSB0. It got me thinking about how all three programs, Putty, Minicom, and ser2net, were able to use the port but the UPB integration could not. That gave me a sense of dĆ©jĆ  vu ā€¦

Iā€™m also glad that this ā€œproblem that was never an actual problemā€ is now resolved. Now to confirm the USB CIM works as reliably (or not) as the serial model.

Putty, Minicom, and ser2net were all outside of the HA container IIRC. Inside the container there seems to be a need for the reboot. Might be something to raise with the supervisor team since it has caused grief a couple of times ā€“ and thatā€™s just here. Even if there were some type of message alert.

It seems that the appearance of a new port is not relayed to Home Assistant in ā€œreal timeā€. The container has to be restarted in order for it to access the new port.

Iā€™m using Home Assistant Supervised on Ubuntu but the same issue also occurs with HassOS (thatā€™s where I first encountered it using a serial PIM). When you connect the PIM, the new port is immediately reported by HassOS in Supervisor > System > Overflow Menu > Hardware but isnā€™t actually available for use by an integration until you restart Home Assistant.

As for reporting it, based on the response I received reporting another issue, Iā€™ll leave it to someone else.

Itā€™s been well over a week since I installed the Simply Automated USB CIM and I am pleased to report that, so far, it has been working as reliably as the serial version. No problems to report.

1 Like

Thatā€™s great to hear, I figured the USB reliability issues were likely just due to shoddy windows drivers. Serial drivers in Linux are very well tested as serial devices are relatively simple and very commonly used by kernel developers so bugs there get fixed fast. This is one area where the Linux drivers are basically universally better than the Windows equivalents. Serial hardware manufacturers even like to sabotage their own official Windows drivers, FTDI and prolific are known to do this for example. Some like FTDI even went as far as to embed malicious code into their windows drivers which attacks counterfeit hardware.

Well for me life got busy as well between work and spending most weekends out camping getting out of the house. Now starting to hunker down for the winter, please let me know when you might have some time to test the PulseWorx IP UPB controllerā€¦

Iā€™m just not getting along with this forum software. Meant to reply to Glennā€™s post back on Aug 24.

Are there any ethernet IP UPB PIMs that have been validated to work with the UPB integration? I did not see any hardware based suggestions (only ser2net) in this thread or in the integration documentation.

The Pulesworx IP Gateway I have doesnā€™t currently work with the integration. Iā€™m looking for a functional ethernet UPB PIM.

My HASS.io instance is now running in a VirtualBox VM physically far away from where the current serial PIM is located not to mention it still connected to the CQC HA software until I can transition all of the automation over to HASS.

Just as an added bit of information, the computer the HASS VM is running on is physically isolated as much as possible to prevent potential lightning damage (itā€™s also running Blue Iris NVR for the surveillance cameras and weā€™ve had 3 indirect lightning hits in the last 10 years) Network is connected via fiber optic, Computer is plugged into itā€™s own UPS. There will be no other wired connections, usb, serial, etc, to this box. e.g. a USB or serial UPB PIM connected to the power line. UPS will filter out the UPB signal on the power line if the PIM is plugged into the UPS so that is a non starter. Extreme, yes, school of hard knocks.

Iā€™m heavily vested in UPB and and very happy with itā€™s reliability, this is one of the last hardware bits to solve before I can shut off the old CQC box.

Any and all thoughts or suggestions is most appreciated!

Hmm, I might be able to just make a simple proxy script that translates for that.

I apologize for not getting to this sooner. I just have not had the time in the last couple of months to relook at the UPB integration.

I reasonably ā€œsimpleā€ way to get a UPB PIM is to connect a serial PIM to a Raspberry PI and use ser2net. You would need a Raspberry PI, Serial to USB converter, and a Serial PIM. On the Pi you would need ser2net which should be a simple pkg install.

My personal setup is a PIM connected to a USB port on a Windows computer through a serial to USB connector. I run ser2net on the Windows computer. (Iā€™m not a Windows fan, however, we have a reasonably powerful media centre box in our home that I run Home Assistant on in a HyperV VM).

I had started writing the gateway code a while back. I slowed down because getting the code integrated into the UPB lib was requires a fair bit of refactoring. I do like @jameshilliard idea of a proxy though. I had not thought about that before. That might simplify the integration.

Has anyone tested the UPB integration with switches from PCS (instead of Simply Automated or Web Mountain)? Specifically the WS1D Wall Switch Dimmer (thatā€™s the older version of the WS1DL).

Digi and other brands make serial to IP adapters. Or like others have mentioned a Pi could be used. You can probably find an old name brand one on eBay for a reasonable price.

I have one PCS-WS1 that works with the integration. All my other UPB stuff is Simply Automated.

Thanks! Thatā€™s encouraging news.

If there are any owners of the WS1D, I would like to hear how this older model handles an LED load. Is the dimming performance satisfactory? If not, does it at least work well simply turning on the LED lamp to full brightness or is even that problematic (buzzing, flickering, etc)?