The lack of distributed engine is pain.

So the very first problem I have here, is there is no way to run this thing distributed.  This is a major issue, as my setup is as follows:

  • Main server (electra, a VM) runs the engine and talks directly to networked devices.
  • A PI in the laundry room is connected to the ademco, the onewire, and the insteon.
  • A PI in the homelab is connected to another onewire.
  • A Pi Zero in an air duct feeds BCM680 data.

So even if I give up on the VM, and run hass on the laundry room pi, I still have the issue that the other PI can't talk to it.  This begins my quest to solve this problem, bit by bit.

I tried a few solutions, such as running two homeassistant instances, and using the MQTT stuff to forward things around.  This was a complete fail.  Nothing I did made this sane, or worked.

Second was to try remotehomeassistant.  Now this had promise.  Onewire worked perfectly.  The Ademco worked perfectly.  The insteon.. well.. ick.  Plus, as a bonus, the homeassistant powers that be have decided to never integrate this into the mainline.  This means it will break eventually..  sigh.

OK.  so.  lets solve this one at a time.  First, the easy one, the PI Zero.  This just has a pair of BCM680's wired directly to i2c.  All I needed to do was rewrite the code that handles them, and forward them to MQTT.  MQTT works here, because it's unidirectional, just need to pass the data, not respond to requests.  Done.

Now for the hard part.  All the stuff in the laundry room.

First, the ademco. Looking on the page for the ademco, they seem to indicate that the vendor sells a network attached version of my ad2usb.  That didn't exist when I did mine.  Bonus points, is that the network attached one is basically a PI running ser2sock (which they wrote!), which shoves a serial port onto a socket. 10 minutes later, I have it running, and /dev/ad2usb is forwarded to port 10000, and bang, the remote hass instance can talk to it.

This of course, gets me thinking.  Why can't I just forward up my insteon modem?  Well, obviously the integration doesn't support that.. or does it?

If you have deep lore of insteon, you might know there are two versions of the hub.  V1 and V2.  V2 is trash. I have one.  Don't ever buy this abomination.  A V1 hub on the other hand, is an actual modem, but it just spews everything out on port 9761.  If you tcp to that port, you get raw insteon data.

So what would happen if we connected the serial port, to ser2sock running on port 9761, and then told homeassistant we owned a hub v1?

If you answered it would magically work, you would be half right.  It should have, except there is a bug. The alarmconsole module forces pyserial==2.7, but insteonplm wants pyserial==3.2.0.  It needs 3.2.0, because there is a bug in earlier versions that breaks the fake socket://host:port trick asyncio_serial uses.  The fix?  Just upgrade pyserial to 3.2.0 and ignore the errors, because it won't actually break alarmconsole.  I filed a PR on this, hopefully they will fix. https://github.com/home-assistant/home-assistant/issues/29875

So basically, yeah.. ser2sock is amazing.

Next on my list is onewire....

Posted on