(SOLVED see bottom of this post and an update later) My problem, briefly stated is that I cannot control 2 plugin modules from the default view. They are present but status from and commands to the modules are ineffective. … I am sorry if this post is unnecessarily long but it is tough to trim to only ‘relevant’ parts with my current level of understanding.
For testing purposes I am focusing on using 2 lamp plugins, a keypad dimmer in a desktop enclosure and the PLM. All devices I have were set up with the now abandoned HouseLinc software and working with it. …snip…
…snip… HA is showing devices in overview as expected and for at least a few, status and control are working. However I am having trouble with the lamp modules I have chosen for testing. This is the error I get in the ad-don log:
2019-10-13 14:42:26 DEBUG Dimmer: Dimmer message insteon/1a.e0.bd/set b'{"state": "ON"}'
2019-10-13 14:42:26 DEBUG MsgTemplate: Input template render: '{ "cmd" : "{"state": "on"}" }'
2019-10-13 14:42:26 ERROR MsgTemplate: Invalid JSON message { "cmd" : "{"state": "on"}" } from template { "cmd" : "{{value.lower()}}" }
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/insteon_mqtt/mqtt/MsgTemplate.py", line 177, in to_json
return json.loads(value)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 14 (char 13)
2019-10-13 14:42:26 INFO Dimmer: Dimmer input command: None
2019-10-13 14:42:26 ERROR Dimmer: Invalid switch on/off command: None
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/insteon_mqtt/mqtt/Dimmer.py", line 224, in _input_on_off
is_on, mode = util.parse_on_off(data)
File "/usr/lib/python3.6/site-packages/insteon_mqtt/mqtt/util.py", line 30, in parse_on_off
cmd = data.get('cmd').lower()
AttributeError: 'NoneType' object has no attribute 'get'
Prior, I went tried using the directions here:https://github.com/TD22057/insteon-mqtt/blob/42f3933566fb2bcdbe80de7e6f5ff8ff35ecdea0/docs/mqtt.md and went to my HA at: …:8123/developer-tools/mqtt page. I sent;
insteon/command/1f.15.3a
{ "cmd": "join" }
Join gives the following result:
2019-10-09 11:16:42 INFO Mqtt: MQTT message insteon/command/1a.e0.bd b'{ "cmd": "join" }'
2019-10-09 11:16:42 UI Mqtt: Commanding dimmer device 1a.e0.bd (plugin_a) cmd=join
2019-10-09 11:16:42 INFO Base: Join Device 1a.e0.bd
2019-10-09 11:16:42 DEBUG CommandSeq: Running command 1 of 2
2019-10-09 11:16:42 INFO Base: Device 1a.e0.bd (plugin_a) cmd: get engine version
...snip...
2019-10-09 11:16:49 INFO Protocol: Read 0x53: All link done: 1a.e0.bd grp: 1 Cmd.CONTROLLER cat: 0x01 0x0e 0x41
2019-10-09 11:16:49 UI ModemLinkComplete: Modem db entry added via linking: 1a.e0.bd grp 1
This all appears ok and has been done numerous times.
Then pair:
insteon/command/1a.e0.bd
{ "cmd": "pair" }
Results:
...snip...
2019-10-09 11:28:54 INFO Protocol: Write message to modem: OutAllLinkUpdate: 1a.e0.bd grp: 1 Cmd.UPDATE
2019-10-09 11:28:54 DEBUG Protocol: Write bytes to modem: b'\x02o \xe2\x01\x1a\xe0\xbd\x01\x00\x00'
2019-10-09 11:28:54 DEBUG Mqtt: MQTT writing
2019-10-09 11:28:54 DEBUG Serial: Wrote 11 bytes to serial /dev/ttyUSB0
2019-10-09 11:28:54 INFO Protocol: Read 0x6f: OutAllLinkUpdate: 1a.e0.bd grp: 1 Cmd.UPDATE ack: False
2019-10-09 11:28:54 DEBUG Protocol: Passing msg to write handler: ModemDbModify handler
2019-10-09 11:28:54 ERROR ModemDbModify: Modem db updated failed: OutAllLinkUpdate: 1a.e0.bd grp: 1 Cmd.UPDATE ack: False
2019-10-09 11:28:54 ERROR Mqtt: Modem database update failed
2019-10-09 11:28:54 DEBUG Protocol: Write handler finished
I see a “fail” so I reasonably conclude there is a problem here - but what do I know? I am a noob. Restarts,reboots and retries do not improve this. So I push on.
Note: Folowing the documentation here: https://github.com/TD22057/insteon-mqtt/blob/42f3933566fb2bcdbe80de7e6f5ff8ff35ecdea0/docs/mqtt.md Which says to do this for every device (no exceptions) so :
insteon/command/1a.e0.bd
{ "cmd": "sync" }
This fails. “sync” is indicated to be an invalid command. Later in the same document I read:
Sync Device Links (Placeholder)
Supported: modem, device
This command is not yet supported.
Perhaps it would be better to remove the initial reference to an apparently unsupported requirement to reduce the confusion factor for newbs like me since some of us do try to RTFM even though we don’t understand a lot of it.
2019-10-09 11:53:32 INFO Mqtt: MQTT message insteon/command/1a.e0.bd b'{ "cmd": "sync" }'
2019-10-09 11:53:32 UI Mqtt: Commanding dimmer device 1a.e0.bd (plugin_a) cmd=sync
2019-10-09 11:53:32 ERROR Mqtt: Unknown command 'sync' for device type dimmer. Valid commands: dict_keys(['db_add_ctrl_of', 'db_add_resp_of', 'db_del_ctrl_of', 'db_del_resp_of', 'print_db', 'refresh', 'linking', 'join', 'pair', 'get_flags', 'get_engine', 'get_model', 'on', 'off', 'set', 'increment_up', 'increment_down', 'scene', 'set_flags'])
Back to the core issue. Attempting to turn on lamp module from HA overview page fails.
light:
- platform: mqtt
schema: json
name: "Desktop_KP_w_DIM_A"
state_topic: "insteon/1e.f8.83/state/"
command_topic: "insteon/1e.f8.83/set/"
Solution at least in part: command_topic: “insteon/1e.f8.83/set/” is incorrect. Set should be level for a dimming lamp module. As well, scrupulous attention to case. I still had a few devices with upper case address characters!
Thanks to all.
Q