New Insteon PLM modem integration option via MQTT

I’m interested to hear how @larizzo went with his hub testing too.

Well, if you don’t own a hub or PLM yet, I’d say buy the PLM. If you own a hub, just try it and see if it works. I spent 5 minutes with google and it appears that people say the hub version 2242-222 has a PLM port available (i.e. can be used like a modem) and the newer hub version 2245-222 does not.

I own no Insteon gear at present and being from Australia there is only one hub available (2242-522) which uses a different frequency and has no PLM. There is also no local 240v PLM so it isn’t so easy for us Aussies unfortunately. The reason for my curiosity is that I am willing to buy a 2242-222 (assuming I can source one) and have found with the same research (thanks Google) that the 2245-222 would appear to be unsuitable. I’m ready to commit to using the US Insteon range once I know the 2242-222 does the trick. As the US PLMs are 110v only as far as I can see I certainly have some challenges to overcome if I’m going to jump on the Insteon bandwagon.

The reason why I am so tempted to go down the Insteon path is the 6 and 8 button keypads would best suit my purposes when bundled with in-wall relays. I cannot find any Z-Wave switch panels to suit the Australian market that are even comparable.

Would be great to see this work for 2245 :slight_smile:

My understanding is that the 2245 (as well as 2242) has a serial PLM built inside with an Ethernet/IP adapter that requires the use of HTTP GET for sending and receiving Insteon messages locally (not via the cloud).

The receive part is more challenging as the 2245 uses an internal buffer that is “read” by HTTP GET on one side of the buffer and is “written” to by the serial PLM on the other side and there is no indication on read that 1) there is a new message, nor 2) that the writing of an entire message has been completed (can read the buffer and get a partial message), nor 3) any indication of how many messages are in the buffer.

To catch unsolicited messages, say from a motion sensor, and do so in a timely manner, this buffer would need to be polled/read (HTTP GET), oh say every 500ms, and then determine if any new non partial message or messages are in the buffer.

Is the code for this project intended to support something like this?

I have no plans to support a hub api. The modem works well and is what I own (and is really the best way to integrate insteon in a home automation system). If someone wants to fork the code and add support for the hub, that would be great and I’ll merge it in. The low level network code would be easy to adapt to this (see the network.Link class for the API to use) and it already has a polling API.

I think the hard part is that the design assumes there is a PLM modem and modem database. If the hub has that built in and follows the PLM modem API for getting and manipulating the database, then it’s probably not too bad. If it doesn’t, then that’s a big change.

Additionally, I think it would require a lot testing to figure out a good polling interval to not swamp the hub but fast enough to get all the data. How big is the hub’s internal buffer? What happens in high density message traffic scenarios? Can data be read fast enough? Things like that would need to be tested.

I know you reported that Insteon Thermostat functionality would be complicated, but have you made any plans to add it? I’d really like to try out your work, but have two Insteon Thermostats and really need that functionality. Thanks for this though, I’ve been following along and it’s a really great addition that’s beneficial to not only Home Assistant, but to most any other HA effort that wants Insteon integration.

Terry

I wouldn’t mind trying at some point, but the thermostat is complicated and I don’t own one so it’s going to be difficult to do. I’m also in the middle of a house remodel and other projects so it’s unlikely I’m going to have time to try it for at least several months. I’d suggest you open a github issue to request this and when I have time (or if someone else want’s to try it), we can discuss it over there. The insteon-terminal app does support the thermostat so that would be a good place to start if anyone wants to give it a try.

I just wanted to check-in and say, thank you! I may finally have a working insteon system under Home Assistant. In addition to issues with Home Assistant’s built-in insteon plm platform, I think I may have either a flaky serial PLM or a flaky USB-Serial adapter. Today I installed a new USB PLM and updated to 0.60.1 and I think things are working!

…now if we could get it as a docker image for Hass.io:wink:

I’m glad it’s working for you. I don’t run hass.io or docker so I think some one else is going to have to step up to get that up and running. I’d be happy to add any docker/hass.io creation scripts and docs to the repo if someone writes them.

I also wish there was a HASSio add-on for this component. I would be willing to test things out.

1 Like

I have a problem installing this application. I installed the latest version of HASSbian on a new Pi. Brand new image, with absolutely nothing configured. HASS loads up fine. I then followed the instructions from https://github.com/TD22057/insteon-mqtt63

When I try the command “pip install .”, I get the following in the log:

Processing /home/pi/insteon-mqtt
Collecting Jinja2>=2.1 (from insteon-mqtt==0.6.1)
  Downloading Jinja2-2.10-py2.py3-none-any.whl (126kB)
    100% |████████████████████████████████| 133kB 90kB/s
Collecting paho-mqtt>=1.3 (from insteon-mqtt==0.6.1)
  Downloading https://www.piwheels.hostedpi.com/simple/paho-mqtt/paho_mqtt-1.3.1-py3-none-any.whl (57kB)
    100% |████████████████████████████████| 61kB 195kB/s
Collecting pyserial>=3.2 (from insteon-mqtt==0.6.1)
  Downloading pyserial-3.4-py2.py3-none-any.whl (193kB)
    100% |████████████████████████████████| 194kB 229kB/s
Collecting pyyaml>=3 (from insteon-mqtt==0.6.1)
  Downloading https://www.piwheels.hostedpi.com/simple/pyyaml/PyYAML-3.12-cp35-cp35m-linux_armv6l.whl (43kB)
    100% |████████████████████████████████| 51kB 184kB/s
Collecting MarkupSafe>=0.23 (from Jinja2>=2.1->insteon-mqtt==0.6.1)
  Downloading https://www.piwheels.hostedpi.com/simple/markupsafe/MarkupSafe-1.0-cp35-cp35m-linux_armv6l.whl
Building wheels for collected packages: insteon-mqtt
  Running setup.py bdist_wheel for insteon-mqtt ... error
  Complete output from command /home/pi/insteon-mqtt/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-7m_tz23g-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpa1l5k1pipip-wheel- --python-tag cp35:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for insteon-mqtt
  Running setup.py clean for insteon-mqtt
Failed to build insteon-mqtt
Installing collected packages: MarkupSafe, Jinja2, paho-mqtt, pyserial, pyyaml, insteon-mqtt
  Running setup.py install for insteon-mqtt ... done
Successfully installed Jinja2-2.10 MarkupSafe-1.0 insteon-mqtt-0.6.1 paho-mqtt-1.3.1 pyserial-3.4 pyyaml-3.12

Any idea what is going on? Does the MQTT broker need to be installed on the same host? I have it already installed on another host. Thanks!

Did you try running it after that? I got the same wheel error but it still installed and ran fine. On many systems doing a pip3 install wheel before that will make the error disappear (but since it works fine, it’s not that important).

I didn’t really try it after. I stopped and wanted to see if I could continue or not… I will give it a try. thanks!

I redid the install and did pip3 install wheel before doing pip install . and everything went smoothly this time. I will start doing some development tests…

Thanks!

I’m stuck. My PLM is connected to USB port on my Raspberry Pi as /dev/bus/usb/001/004. I used that in the config.yaml file but when I start the application, the logs tell me:

serial.serialutil.SerialException: [Errno 13] could not open port /dev/bus/usb/001/004: [Errno 13] Permission denied: '/dev/bus/usb/001/004'
2018-02-25 21:42:54 DEBUG poll: Link connection failed Serial /dev/bus/usb/001/004

Any idea what could be wrong here? The application seems to connect to my MQTT broker just fine.

@Madelinot The HA user needs serial read permissions. That’s covered in the docs (4th bullet): https://github.com/TD22057/insteon-mqtt/blob/master/doc/quick_start.md

I have already done this but I will try again. Thanks

Also note that the device location may change from restart to restart. You generally should set up a udev alias to force the modem to appear at the same location every time (https://www.sparkfun.com/news/2332).

Yes, I realize that, thanks. I will do it once I can make this work. Both “pi” and “homeassistant” users are already members of “dialout”. Back to square one…

Some progress… I did:

sudo chown :homeassistant /dev/bus/usb/001/004

and the program can read the port… Continuing with some tests…