Insteon issue: Stopping Insteon Modem writer due to byte must be in range(0, 256)

I’ve recently started using Insteon with hass.io and I’m having issues where all Insteon devices stop updating and responding after a while. Sometimes it is after a few days, but today I was able to get it to hang up after manually triggering a few automations to turn on and off the outdoor lights a few times. It’s not repeatable thus far. I’ve turned on debug logging for the Insteon component and I see the following entry when it stops responding:

2018-12-27 19:49:29 ERROR (MainThread) [insteonplm.plm] Stopping Insteon Modem writer due to byte must be in range(0, 256)
2018-12-27 19:49:29 DEBUG (MainThread) [insteonplm.plm] Ending Insteon Modem write message from send queue

The complete log file can be downloaded here:

My setup is as follows:

  • hass.io version 0.84.6 running on a Raspberry Pi B+
  • Insteon 2413U PLM
  • Qty 5 Insteon dimmers
  • Qty 1 Insteon 6 button keypad
  • Qty 2 Insteon relay modules

Does anyone have any suggestions for next steps to resolve this?

Thanks.

I just had it hang up again. The log file is linked below. It appears that I’m still receiving status updates via Insteon, just unable to send any commands.

Really sorry for the delay here. Have you resolved this? If not, can you tell me if you are using a Hub or a PLM? I see the error was generated when your 6 or 8 button KeyPadLinc was triggered. Can you tell me anything else about what the automation was doing?

@teharris1

I got the same error overnight. I use and Insteon Hub. HA version 0.91.0 running in an Unraid docker.

I did not have any debugging turned on for the log, so I only see the error. Timestamp on the error was 00:58. I have 2 automations that should trigger at 01:00 to turn off 2 sets of outdoor lights. Both automations triggered, but only one set of lights turned off.

Hi, I have the same problem in my installation (“Stopping Insteon Modem writer due to byte must be in range(0, 256)”), I did a lot of things, reinstall HA, erased the hub & devices.
but after every action, HA worked fine by 1 week, after that, failed again

I’m using HA 0.93.2, and Insteon component 0.15.4

Could you help me?

Are you able to reproduce the error? What was happening at the time the error occured? Was there an automation running? If you can put the insteon component into debug mode that will help:

logger:
  default: warn
  logs:
    insteonplm: debug
    homeassistant.components.insteon: debug
    homeassistant.components.light.insteon: debug
    homeassistant.components.switch.insteon: debug
    homeassistant.components.binary_sensor.insteon: debug
    homeassistant.components.sensor.insteon: debug
    homeassistant.components.fan.insteon: debug
    homeassistant.components.cover.insteon: debug

Hi, to be honest, I can’t reproduce the error, because is aleatory, but, I put the log in debug mode some days ago (I read your advice in another topic). So, I have the log with the debug messages. Do you want that I upload the logs?

The error occur running automations, turning on switchs, lights, etc

Dear @teharris1 ,after some days, I got free time to see this topic again.
I could detect via logs,that the problem happened when a 6-button keypad is operated, either directly or remotely (from another associated switch via Insteon Scene).
In my installation I have 2 identical Keypads running, but only one causes the error and not always, sometimes yes, sometimes not
I do not find that it can be, check both and they do not differ in how they are configured
What do you advise me? Is there any solution?
My environment is:
Insteon Hub 2
HA version 0.94.4
Insteon Integration 0.15.4

I attaching the Log https://www.dropbox.com/s/nhyxn29wnw8poza/home-assistant.log?dl=0

Thanks in advance

Original poster here. Sorry I’ve been away a while.

I’ve worked around this for now by adding another exception handler to _get_message_from_send_queue in plm.py, which has restart enabled so that I don’t have to restart everything to get PLM going again:

            except ValueError:
                self.log.error('Stopping Insteon Modem writer due to '
                               'ValueError')
                self._restart_writer = True

I couldn’t figure out how to edit plm.py in the dockerized version of HA (I’m not a real programmer) so I reverted to a manual installation.

Through adding more debug messages in plm.py I was able to isolate that the line of code which is generating the valueerror exception is actually the call to the logger in _write_message which really surprised me:

_LOGGER.debug('TX: %s', msg_info.msg)`

I haven’t had time to troubleshoot it further since then. My issues definitely appear to be associated with the 6 button keypad. My setup is using the 2413U PowerLinc Modem.

Hope that helps.

Impressive work for a “non-programmer”. I suspect the issue is broader than just that one line. It is the conversion of a message to the binary form somehow but it does appear specific to the KPL. Let me see what I can do with this to get it fixed quickly. At a minimum the except ValueError: will allow the system to keep running.

thanks my friend @kbpro , I modified my plm.py, I had to replace “self.log.error” by “LOGGER.error” and the workaround its working.

Also I disabled the Automation that I did to restart HA after each error

So, I will wait if @teharris1 found the definitely solution

Hi, I have the same issue, and I can confirm everything stops working when I press a “secondary key” (not the ones for on or off) and this key is assigned to an automation. I am using Hassio in a raspberry and I would like to use the workarround described but cant find any py file. Do you know where are they located, I’ve used the find command but only 4 or 5 files are being listed.

Can you show me the automation you are using? Does the automation trigger the error every time?

my problem is similar yours, I have an automation, that detect when an button is pressed, and after 2 hours power off this device, but if you power off manually it before reach this 2 hours, HA fail, with this error.
My automation is simple:

  • id: ‘1557535057760’
    alias: Radiador off - 2 horas
    trigger:
    • entity_id: switch.keypadlinc_on_off_4c_12_56_button_a
      platform: state
      to: ‘on’
      condition: []
      action:
    • delay: 02:00:10
    • data:
      entity_id: group.radiador
      service: homeassistant.turn_off

Sometimes fail every time, other no, I couldn’t detect why sometime fail, sometimes no.

I am pushing a change that will keep HA from stopping but does not fix the underlying issue. However, it will better log the issue so we can identify why this is happening. I hope this will be in 0.96.0

Hi @teharris1, do you have news about the change?

This should be in the current release, 0.96.1. Just keep in mind it will not prevent the error from occurring, it will just prevent the Insteon component from stopping and it will better log the issue. When you see the issue in the log (debug mode not required). please post it here so I can find the true underlying cause.

1 Like

Hi @teharris1, I don’t know is the debug log is more extensive now, but, I’m attaching a new log, (it failed again)

Can you confirm what version of HA you are on? This message indicates you are on a version prior to 0.96. The latest version will not stop the modem for this issue. It will only log the issue and restart the writer.

I’m 0.96.5

I have an automation that restart HA after this issue happen, I deactivated it after upgrade to 0.96.5.
But not worked, so, the automation was reactivated, and today, my system working restarting every 36 or 40 hours aprox, sometimes more…