Insteon PLM configuration

Hello all, I’m trying to setup the insteon PLM component for use with insteon mini remotes. I have the component setup in home assistant and the mini remote is paired with my usb powerlinc modem. When I press a button on the remote home assistant looks to detect the action but I get the following error.

2017-10-12 06:43:20 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback PLM._parse_insteon_standard(address: 3F.0...rget: 44.84.0A)
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/events.py", line 120, in _run
    self._callback(*self._args)
  File "/srv/homeassistant/lib/python3.4/site-packages/insteonplm/protocol.py", line 508, in _parse_insteon_standard
    device = self.devices[msg.address.hex]
  File "/srv/homeassistant/lib/python3.4/site-packages/insteonplm/protocol.py", line 40, in __getitem__
    raise KeyError
KeyError

I’m not too sure if I’m doing something wrong or if the device I am trying to use is not compatible.

The insteon_plm module has been updated to fix the error you identified above, however, the mini remote is only partially supported. I am working on an enhancement to improve the support but right now I only expect group 1 to work. Would love some help to test code if you are up for it.

BTW, the update I referred to is part of release 0.65.0.

I’m also trying to get a mini remote (8-button) to work directly with the PLM, so I can prove the concept before I add more of these as additional input devices.

At the moment I can’t get it to do anything useful, so if there’s anything that warrants testing I’d be happy to help.

The mini-remote is next on my list after x10 support. Should be about 4 weeks.

@paulster I have a working version of the mini-remote functionality working. i set them up as binary_sensor devices. One for each button. If you are interested in testing, you can download the code. You need to download two repositories:

  1. insteonplm; you need to uninstall the default version first with pip3 uninstall insteonplm then you can untar this file and in the python-insteonplm directory use pip3 install . to install this version that supports the mini-remote
  2. Home Assistant: This is a full version of Home Assistant that you can install any way you want. Alternatively if you are already on the latest version you can just replace homeassistant/components/insteon_plm/__init__.py and restart the system.

I’m getting a 404 on the first download. I’m running 0.72.1, so is it just the first download I need in order to get the init.py file?

Oh crud. I deleted that branch because I went ahead and pushed the change the main repository already. Here are the new directions:

  1. You need to uninstall the default version first with pip3 uninstall insteonplm then you need to install the latest version with pip3 install insteonplm to install this version that supports the mini-remote.
  2. Home Assistant: This is a full version of Home Assistant that you can install any way you want. Alternatively if you are already on the latest version you can just replace homeassistant/components/insteon_plm/__init__.py and restart the system.

Thanks. I’ve just updated and I can see the objects in Home Assistant now with the labels nnnnnn, nnnnnn_2, nnnnnn_3, and nnnnnn_4, so I’m going to see how these behave.

I actually have the 8 button remote and I’ve configured each button to issue an on command when they are pressed, so I don’t have to worry about not being able to pass state back to the remote.

Do you support all 8 buttons, or only 4 on this release?

There is supposed to be support for all 8. What model do you have? You say it is configured to send an on command each time. I thought these only has two modes.

  1. Buttons 1, 3, 5 & 7 sends on and buttons 2,4,6 & 8 send off or
  2. All buttons send an on or off message alternately
    Do you know how to set up debug mode?

Do you know how to get the specific model number, as the instructions mention a number of different model numbers for the 8-button remote? There is an option which sends an on signal for each button press, so you get the green led each time you press a button, rather than the regular option of having one press send an on and the next press send an off (green and then red). This is how I’ve set mine up since you can’t pass state to the remote. And what I want to do is trap the button press and have it invert the state of the relevant switch in HA.

EDIT: Missed the obvious and didn’t look at the back of the remote. It’s a 2342-2.

OK, now I see the mode you are referring to. It is described here:


I did not design for that mode and I am not sure how to yet. I would need to read the device to know it is even in that mode or would need to have a config setting that would tell HA to assume that mode. ugh. Not sure what to do with this.

This is where I think these remotes are a bit odd. If you configure the 8 button to be 4 on and 4 off buttons then as a user you know exactly what it’s going to do. If you configure it be be 8 individual buttons in default mode then because the remote isn’t getting any state passed to it, it could be inverted by something else that controls the same device, so you may press a button and nothing happens because it’s requested the same state that is already set. That’s why this other mode seems to make most sense in that it always sends the same request and then the HA system could interpret it to invert the present state (which is presumably what the user wants).

I’m not loving the way these fit in with the Insteon infrastructure, since it seems very kludgy, but they are the only small, multi-button remote I’ve found for this type of task.

So one of the HA admins gave me a very good idea how to handle your use case. The implementation would be to use ‘Events’ rather than states. This would mean your automations would check for an event that is insteon_plm specific. This appears to be the right approach for a few devices. For example, the motion sensor also has an option to send ‘on only’. I am trying to figure this out and will let you know when it is ready for testing.

I have submitted PR #15213 which creates an event called insteon_plm.binary_sensor_on which will fire every time an INSTEON binary sensor sends an ‘on’ command. This way you can use this event in your automation in the ‘always on’ mode. Here is an example of an automation:

automation:
- id: Mini_Remote_Test_On
  alias: Mini Remote Test On
  trigger:
    platform: event
    event_type: insteon_plm.binary_sensor_on
    event_data:
      entity_id: binary_sensor.44899f_8
  condition:
    - condition: state
      entity_id: light.462f24
      state: 'off'
  action:
    service: light.turn_on
    entity_id: light.462f24
- id: Mini_Remote_Test_Off
  alias: Mini Remote Test Off
  trigger:
    platform: event
    event_type: insteon_plm.binary_sensor_on
    event_data:
      entity_id: binary_sensor.44899f_8
  condition:
    - condition: state
      entity_id: light.462f24
      state: 'on'
  action:
    service: light.turn_off
    entity_id: light.462f24

Excellent! This approach seems to be the most ideal way to deal with this.

Is it available for me to test yet, or do I need to wait for the change to make it into the base code?

Thanks

You can download it here: https://github.com/teharris1/home-assistant/archive/binary_sensor_events.tar.gz

Follow the steps above to uninstall insteonplm and reinstall then install from the tar file I just posted.

I’ve kind of got it working, so definitely making progress.

My observations so far are that:

  1. It still seems to think there are only 4 buttons (I see the address, address_2, address_3, and address_4 registered, but no _5, etc.)
  2. It doesn’t respond to buttons 5 through 8
  3. For buttons 1 through 4, buttons 1 and 2, and 3 and 4 are swapped, so button 1 in the code is called when button 2 is pressed, button 2 is called when button 1 is pressed, etc.

This is looking really promising, although I definitely need to get myself a range extender because that wasn’t making testing easy with devices and the PLM in different rooms.

Did you set a device_override or was the PLM able to detect the device? If you set a device override it should be cat: 0x00 and subcat: 0x1b. If you use subcat: 0x1a it will appear as a 4 button. They are the same device under the hood i think.

The mini-remote is a bad design in my opinion as the buttons and the groups are backwards:

Button Group
a         2
b         1
c         4
d         3
e         6
f         5
g         8
h         7