Automation triggered by Insteon to control Insteon problem?

Hello,

I have a simple automation setup. The trigger is KeypadLinc Button D turned on. The action is to turn on an Outdoor On/Off Module. If I manually execute the automation, the On/Off module is correctly turned on. If I push the D Button, the module is NOT turned on. I have confirmed in the Logbook that the Button D is fired and that the automation is triggered. Yet the module is never turned on. I can obviously turn on the outdoor module via the entity without a problem. It seems like the USB controller is “busy” still receiving data from the Keypad and the ACK is never received.

41009e is the KeypadLinc and 3f94f6 is the Outdoor On/Off module

Has anyone else seen behavior like this? I’ve also had what appears to be similar problems with Insteon Motion Sensors and Door Sensors when controlling Insteon Switches through an HA automation.

The first set of logs below is from physically pushing the KeypadLinc Button. Outdoor On/Off Module is not turned on.

2020-11-05 22:18:26 DEBUG (MainThread) [pyinsteon.messages] RX: msg_id: 0x50, address: 41009e, target: 000006, flags: 0xcf, cmd1: 0x11, cmd2: 0x00
2020-11-05 22:18:26 DEBUG (MainThread) [pyinsteon.topics] Topic: 41009e.6.on.all_link_broadcast data: {'cmd1': 17, 'cmd2': 0, 'target': 000006, 'user_data': None, 'hops_left': 3}
2020-11-05 22:18:26 DEBUG (MainThread) [pyinsteon.topics] Topic: handler.41009e.6.on.all_link_broadcast data: {'on_level': 255}
2020-11-05 22:18:26 DEBUG (MainThread) [pyinsteon.topics] Topic: subscriber_41009e_on_6_broadcast data: {'on_level': 255}
2020-11-05 22:18:26 DEBUG (MainThread) [pyinsteon.topics] Topic: state_41009e_on_off_switch_d_6 data: {'name': 'on_off_switch_d', 'address': '41009e', 'value': 255, 'group': 6}
2020-11-05 22:18:26 DEBUG (MainThread) [homeassistant.components.insteon.insteon_entity] Received update for device 41009e group 6 value 255
2020-11-05 22:18:26 DEBUG (MainThread) [pyinsteon.topics] Topic: event_41009e_6_on_event data: {'name': 'on_event', 'address': '41009e', 'group': 6, 'button': 'on_off_switch_d'}
2020-11-05 22:18:26 DEBUG (MainThread) [homeassistant.components.insteon.utils] Firing event insteon.button_on with {'address': '41009e', 'button': 'd'}
2020-11-05 22:18:26 DEBUG (MainThread) [pyinsteon.topics] Topic: send.on.direct data: {'address': 3f94f6, 'on_level': 255, 'group': 1}
2020-11-05 22:18:26 DEBUG (MainThread) [pyinsteon.topics] Topic: send_message.on.direct data: {'msg': msg_id: 0x62, address: 3f94f6, flags: 0x00, cmd1: 0x11, cmd2: 0xff, 'priority': 3}
2020-11-05 22:18:26 DEBUG (MainThread) [pyinsteon.messages] TX: msg_id: 0x62, address: 3f94f6, flags: 0x00, cmd1: 0x11, cmd2: 0xff
2020-11-05 22:18:26 DEBUG (MainThread) [pyinsteon.messages] RX: msg_id: 0x50, address: 41009e, target: 3d9877, flags: 0x40, cmd1: 0x11, cmd2: 0x06
2020-11-05 22:18:26 DEBUG (MainThread) [pyinsteon.topics] Topic: 41009e.6.on.all_link_cleanup data: {'cmd1': 17, 'cmd2': 6, 'target': 3d9877, 'user_data': None, 'hops_left': 0}
2020-11-05 22:18:26 DEBUG (MainThread) [pyinsteon.topics] Topic: handler.41009e.6.on.all_link_cleanup data: {}
2020-11-05 22:18:27 DEBUG (MainThread) [pyinsteon.messages] RX: msg_id: 0x50, address: 41009e, target: 110106, flags: 0xcb, cmd1: 0x06, cmd2: 0x00
2020-11-05 22:18:27 DEBUG (MainThread) [pyinsteon.topics] Topic: 41009e.6.all_link_cleanup_status_report.all_link_broadcast data: {'cmd1': 6, 'cmd2': 0, 'target': 110106, 'user_data': None, 'hops_left': 2}

The second set of logs is from me turning on the Outdoor Module via the entity. Outdoor Module is correctly turned on.

2020-11-05 22:20:52 DEBUG (MainThread) [pyinsteon.topics] Topic: send.on.direct data: {'address': 3f94f6, 'on_level': 255, 'group': 1}
2020-11-05 22:20:52 DEBUG (MainThread) [pyinsteon.topics] Topic: send_message.on.direct data: {'msg': msg_id: 0x62, address: 3f94f6, flags: 0x00, cmd1: 0x11, cmd2: 0xff, 'priority': 3}
2020-11-05 22:20:52 DEBUG (MainThread) [pyinsteon.messages] TX: msg_id: 0x62, address: 3f94f6, flags: 0x00, cmd1: 0x11, cmd2: 0xff
2020-11-05 22:20:52 DEBUG (MainThread) [pyinsteon.messages] RX: msg_id: 0x62, address: 3f94f6, flags: 0x00, cmd1: 0x11, cmd2: 0xff, ack: 0x06
2020-11-05 22:20:52 DEBUG (MainThread) [pyinsteon.topics] Topic: ack.3f94f6.1.on.direct data: {'cmd1': 17, 'cmd2': 255, 'user_data': None}
2020-11-05 22:20:53 DEBUG (MainThread) [pyinsteon.messages] RX: msg_id: 0x50, address: 3f94f6, target: 3d9877, flags: 0x26, cmd1: 0x11, cmd2: 0xff
2020-11-05 22:20:53 DEBUG (MainThread) [pyinsteon.topics] Topic: 3f94f6.on.direct_ack data: {'cmd1': 17, 'cmd2': 255, 'target': 3d9877, 'user_data': None, 'hops_left': 1}
2020-11-05 22:20:53 DEBUG (MainThread) [pyinsteon.topics] Topic: handler.3f94f6.1.on.direct data: {'on_level': 255}
2020-11-05 22:20:53 DEBUG (MainThread) [pyinsteon.topics] Topic: state_3f94f6_on_off_switch_1 data: {'name': 'on_off_switch', 'address': '3f94f6', 'value': 255, 'group': 1}
2020-11-05 22:20:53 DEBUG (MainThread) [homeassistant.components.insteon.insteon_entity] Received update for device 3f94f6 group 1 value 255
2020-11-05 22:20:53 DEBUG (MainThread) [pyinsteon.topics] Topic: event_3f94f6_1_on_event data: {'name': 'on_event', 'address': '3f94f6', 'group': 1, 'button': 'on_off_switch'}
2020-11-05 22:20:53 DEBUG (MainThread) [homeassistant.components.insteon.utils] Firing event insteon.button_on with {'address': '3f94f6'}

I believe I have a found a workaround. If I had a 1s delay action before the device turn on/off action, it works albeit slow.

@teharris1 Would you expect this to be necessary?

The Insteon protocol was not designed for the use case you have. The Insteon architects intended for you to link the on/off module directly to the Keypad Link button. In fact you can make that link using nothing more than the set button on the KPL. This is called all-linking and allows you to link dozens of responders to a single button. Since the all-link process is designed for 1 to dozens of responders, there is a clean up process that runs after you press the button. It first sends a broadcast and then runs through the KPL button’s all link database to send individual clean up messages to each linked responder. This takes a non-trivial amount of time in Insteon and the Insteon network is “busy” with messages during that time. You can’t get the PLM to start a new all-link broadcast (to turn on the on/off module) while the clean-up is in progress for the KPL button.

Waiting 1 second seems about right for a healthy setup. You could probably just wait 250-500ms but I don’t know how to do that in an HA automation. If you setup was not healthy you might need to wait 5-10 seconds (e.g. if you had responders linked to that KPL button that no longer exist on the network).

Ideally you would link that on/off module to the KPL button and then you could still control the on/off module from HA. If you really want to do that then I suggest making the links in both directions. Link the on/off module to the KPL button and link the KPL button to the on/off module. You’d perform the manual linking twice but reverse the process. This means that if HA commands the on/off module to change state, the KPL button LED will follow.

Thanks @mstovenour. I definitely agree that what you described is how Insteon was meant to be used. And maybe I’ll go that route in this situation as well.

My problem with that explanation is that I was able to do this without adding a delay using Home Seer and it’s Insteon integration with the same hardware. Maybe that integration is doing something like an automatic retry?

There could be a number of explanations. For a single link or even an unlinked controller the delay required is very small e.g. 250ms. Maybe home seer is slower overall transitioning from trigger to action? Maybe the insteon code in home seer is slower? Maybe home seer had some kind of hold down timer with a command queue? I will look at the pyinsteon library code to see if there’s anything simple that can be done.

One reason why I tried to go this route wasn’t so much for the Outdoor module as it was for the micro-modules installed at the 2nd floor roof line. I don’t have a way to make those a responder to the KeypadLinc without getting on a 20ft ladder. I’ve seen some documentation saying that power can be cut at the switch but maybe my modules are too old. That doesn’t seem to work.

The links can be programmed remotely. The original MisterHouse code I helped write included a mechanism to create the links from a configuration file. Creating an 8 controller by 20 responder all-link group like I have would take hours by hand. I often wondered what I’d do if I wanted to update those links now that I’ve ditched MisterHouse. Maybe i’ll work on that over the Christmas break.