New Insteon PLM modem integration option via MQTT

I have an existing insteon scene and I would like to modify it so that one of the lights comes on at 50%. I figured out how to do this at one point but now I can’t seem to get it to work. The command I am using is:

{ "cmd" : "db_add_ctrl_of", "local_group" : ctrl_group,
  remote_addr" : aa.bb.cc, "remote_group" : resp_group,
  ["two_way" : true/false], [refresh" : true/false],
  ["local_data" : [D1,D2,D3]], ["remote_data" : [D1, D2,D3]] } }

I think the D1 in remote data is what I need to adjust but I cant seem to get the syntax right. Here is what I am issuing on the modem


{ "cmd" : "db_add_ctrl_of", "local_group" : 33,
  "remote_addr" : "soffit_lights", "remote_group" : 1,
  "two_way" : true, "refresh" : true,
  "remote_data" : "0x7f,0x1f,0x01" }

I’m thinking the 7f should be 50% brightness. When I look at the db in soffit_lights it’s always 0xff,0x1f,0x01 so I think I must have something mis-formatted and it is just ignoring the data fields.

Hi!
I am trying to pair a switch insteon device but I get timeouts all the time. I tried with “refresh” and the same happens:

2021-01-02 13:43:05 INFO Mqtt: MQTT message insteon/command/26.fd.40 b'{ "cmd" : "refresh" }'
2021-01-02 13:43:05 UI Mqtt: Commanding Switch device 26.fd.40 (lamp1) cmd=refresh
2021-01-02 13:43:05 INFO Base: Device 26.fd.40 (lamp1) cmd: status refresh
2021-01-02 13:43:05 INFO Protocol: Write message to modem: Std: 26.fd.40, Type.DIRECT, 19 00 
2021-01-02 13:43:05 DEBUG Protocol: Write bytes to modem: b'\x02b&\xfd@\x0f\x19\x00'
2021-01-02 13:43:05 DEBUG Serial: Wrote 8 bytes to serial socket://192.168.1.56:25105
2021-01-02 13:43:11 WARNING Base: Handler timed out 1 of 3 sent: Std: 26.fd.40, Type.DIRECT, 19 00 
2021-01-02 13:43:11 DEBUG Base: Increasing max_hops to 3
2021-01-02 13:43:11 INFO Protocol: Write message to modem: Std: 26.fd.40, Type.DIRECT, 19 00 
2021-01-02 13:43:11 DEBUG Protocol: Write bytes to modem: b'\x02b&\xfd@\x0f\x19\x00'
2021-01-02 13:43:11 DEBUG Serial: Wrote 8 bytes to serial socket://192.168.1.56:25105
2021-01-02 13:43:17 WARNING Base: Handler timed out 2 of 3 sent: Std: 26.fd.40, Type.DIRECT, 19 00 
2021-01-02 13:43:17 DEBUG Base: Increasing max_hops to 3
2021-01-02 13:43:17 INFO Protocol: Write message to modem: Std: 26.fd.40, Type.DIRECT, 19 00 
2021-01-02 13:43:17 DEBUG Protocol: Write bytes to modem: b'\x02b&\xfd@\x0f\x19\x00'
2021-01-02 13:43:17 DEBUG Serial: Wrote 8 bytes to serial socket://192.168.1.56:25105
2021-01-02 13:43:23 WARNING Base: Handler timed out 3 of 3 sent: Std: 26.fd.40, Type.DIRECT, 19 00 
2021-01-02 13:43:23 DEBUG Base: Increasing max_hops to 3
2021-01-02 13:43:23 INFO Protocol: Write message to modem: Std: 26.fd.40, Type.DIRECT, 19 00 
2021-01-02 13:43:23 DEBUG Protocol: Write bytes to modem: b'\x02b&\xfd@\x0f\x19\x00'
2021-01-02 13:43:23 DEBUG Serial: Wrote 8 bytes to serial socket://192.168.1.56:25105
2021-01-02 13:43:29 WARNING Base: Handler timed out - no more retries (3 sent)
2021-01-02 13:43:29 ERROR Mqtt: Command timed out

Any help on this? thanks!!!

I’m guessing you are using an Insteon Hub as your PLM…which model is it?

Yes, indeed! Is the new Insteon Hub 2 (2245-222)

I haven’t kept up with this repository as much as I use to, but looking through it now I still don’t see any support for the 2245. The first gen Insteon Hub 1 supports the “serial” protocol over IP (which is what you have set up for), but the 2245 dropped support of the “serial” protocol. So that’s why you’re getting those errors.

I had a 2245 at one time and modified this code a couple of years ago to work with the 2245 but I kept running into an architectural issue with the Insteon implementation where packets to/from the devices would be dropped from time to time. While my modification worked for the most part, the architectural issue made things a little bit too unreliable for me. I switched over to the serial USB PLM and things have been great ever since.

EDIT1, I think I have found where they added support for the 2245, but still digging …
EDIT 2, OK what I see is that support for the 2245 is now in the “development” branch. It has not yet been put in the main branch (that’s why I didn’t see it earlier). So you can either wait, or give the development branch a try.

wow thanks for the information!! I had my doubts about if the hub could be he problem but could not find much info about it. I think I will try with the usb PLM then in the meantime, thanks again!!! :slight_smile:

@krkeegan So I am giving this module another shot. I think it is really well put together, but I seem to be having one problem. I got the scene import and sync to work, and my keypadlinc now controls my fanlinc correctly from the switch. Also, I can call scene 1 on and off to turn the fanlinc light on and off from the command line, but not from a light.

I can not for the life of me figure out the other 4 buttons and the fan speed. It works perfectly from the physical switch, but if I call that scene on from the command line, it doesn’t work.

I am also struggling with how to set up switch’s in HA to call the scene for the keypadlinc. Any help would be greatly appreciated.

When I call scene 1 using:

 - platform: mqtt
    schema: json
    name: "Bedroom Fan Light"
    state_topic: "insteon/xX.xX.xX/state/1"
    command_topic: "insteon/xX.Xx.Xx/scene/1"
    brightness: true

This is what I get in the log:

2021-01-04 16:14:48.168 DEBUG KeypadLinc: KeypadLinc scene 1 message insteon/xX.xX.Xx/scene/1 b'{"state": "OFF"}'
2021-01-04 16:14:48.170 DEBUG MsgTemplate: Input template render: '{ "cmd" : "{"state": "off"}" }'
2021-01-04 16:14:48.170 ERROR MsgTemplate: Invalid JSON message { "cmd" : "{"state": "off"}" } from template { "cmd" : "{{value.lower()}}" }

I’ve been trying to get Insteon-MQTT working under hass.io. Is this not possible? I’ve kind of come to the conclusion that I need Python 3.9 installed for it to work, but that this is not possible under hass.io (I’m running HA OS as a VM in VirtualBox on a Mac).
Am I missing something, or do I need to install HA Core in Debian in VBox in order to utilize the Insteon-MQTT integration?
Thanks much

Although I don’t use hassio for my production insteon-mqtt, I do have a hassio instance I use to play around with…so thought I’d give it a shot to help you out.

I got insteon-mqtt to run in my hassio using the Add-On installation method. After installing, you “start” it at the Supervisor’s insteon-addon GUI. My first “start” didn’t seem to work (no Docker Container), but my second “start” did work.

Hope this helps.

What the AddOn method is doing is setting up a insteon-mqtt Docker Container (like any other AddOn) and mapping a directory in your HA config directory called “insteon-mqtt” where the insteon-mqtt configuration yaml file is. The AddOn GUI has a “Open Web page” that allows you access to the insteon-mqtt cli.

Thanks! I think I’ve gotten that far - it starts OK, but with this message in the Insteon MQTT log: “WebSocket transport not available. Install simple-websocket for improved performance”

Then, when I use the web interface to join a device/module, I get this:
“The WebSocket transport is not available, you must install a WebSocket server that is compatible with your async mode to enable it.”

I’m not sure how to install a WebSocket server, or if it is even possible (I had assumed it was part of the hass.io installation).

Hmmm, I don’t know really. Just digging around, I think your error is coming from a Python module called Flask and from what I can tell this is used by insteon-mqtt for its Web GUI. Usually a websocket is used between the Web GUI running on a web browser and the web server, in this case the web server is running on some part of hassio. If I had to guess…and its just a guess, there is a version incompatibility perhaps between insteon-mqtt ( the version of Flask it uses) and your hassio. What versions are you running?

Interesting. I’m running latest versions of Hass.io & insteon-mqtt (2021.7.3 & 1.0.1), but looking at github for insteon-mqtt, the flask8 component seems to be from 2 years ago (can’t tell version).
I’ll contact the developer.

Yeah, I was just guessing…I too am using HA 2021.7.3 and insteon-mqtt 1.0.1, and my supervisor version is 2021.06.8 hassos version is 6.1.
The versions of flask that get installed inside the insteon-mqtt docker container should be the latest ones as the requirements.txt file limit the minimum version and so that generally means the latest ones on PyPi; I did a quick check, in my case the ones that got install are the latest ones (2.0.1 for flask, and 5.1.0 for flask_socketio), which I suspect you have as well. Anyway, yea I’d ask the developer for some direction as I don’t know how hassio uses the websocket for the AddON’s GUI.

Can I ask which instructions you followed, or what was keeping it from working? I’ve been struggling with this for 2 weeks now, and seem to be at about the same place as you are describing. Everything seems to be working, but I can’t get a device to show up.

Which daemon are you referring to? I have both mosquitto & Insteon-mqtt running, but same result; cmd times out. Can’t find what I’m missing.

another noob Q. Hopefully this is an easy one.
I can now publish a packet, turn on a light, and see the response, using “MQTT Settings”:
topic: insteon/3e.ab.a7/set
payload: on
I am trying to get fancy and make sure I understand the commands, by simply trying to set the dim level. I’ve tried:
topic: insteon/3e.ab.a7
payload: {“state”: “ON”,“brightness”: 50}
It will work if I use the device slider on HA, so I know they are corrected, but I can’t seem to get the formatting of the topic/payload correct.
Any suggestions most appreciated!

topic: insteon/3e.ab.a7
payload: {“state”: “ON”,“brightness”: 50}

I think your topic should be: insteon/3e.ab.a7/level for Dimmers and the such. Try that and see if it works like you expect.