home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.15k stars 31.13k forks source link

MySensors updates not working anymore - ValueError: 132 is not a valid SetReq #9269

Closed Br3nda closed 6 years ago

Br3nda commented 7 years ago

Home Assistant release (hass --version): 0.52.1

Python release (python3 --version): 3.5.2

Component/platform: MySensors (serial gateway)

Description of problem:

I've had a serial Mysensors gateway running for months, and haven't made any config changes for a long long while -- however in a recent hass versions, the readings from sensors cause an error in the HA logs, and does not update that value in HA.

I'm running mysensors version 2 - and a serial gateway is an arduino uno on a usb port

When messages arrive on the USB serial, this appears in the home assistant log file:

2017-09-03 10:32:40 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 247, in async_update_ha_state
    device_attr = self.device_state_attributes
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/mysensors.py", line 584, in device_state_attributes
    attr[set_req(value_type).name] = value
  File "/usr/lib/python3.5/enum.py", line 241, in __call__
    return cls.__new__(cls, value)
  File "/usr/lib/python3.5/enum.py", line 476, in __new__
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 109 is not a valid SetReq
2017-09-03 10:32:43 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 247, in async_update_ha_state
    device_attr = self.device_state_attributes
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/mysensors.py", line 584, in device_state_attributes
    attr[set_req(value_type).name] = value
  File "/usr/lib/python3.5/enum.py", line 241, in __call__
    return cls.__new__(cls, value)
  File "/usr/lib/python3.5/enum.py", line 476, in __new__
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 132 is not a valid SetReq

The Value changes for every message - the Node_id of the sensor is apparently the interger 132 or 109 being used as a SetReq. (there are about 40 sensors that his gateway can hear)

There's one of these errors logged on every message the gateway receives.

Expected:

Problem-relevant configuration.yaml entries and steps to reproduce:

mysensors:
  gateways:
    - device: '/dev/ttyUSB0'
      baud_rate: 115200
  optimistic: true
  version: 2.0
MartinHjelmare commented 7 years ago

If you have a JSON persistence file we can check that to see if we find a value type with a bad number.

MartinHjelmare commented 7 years ago

This thread has a similar story: https://community.home-assistant.io/t/mysensors-value-type-101-is-not-valid-for-mysensors-version-2-0/24884

Br3nda commented 7 years ago

thanks - i've mv mysensors.json mysensors.json.bak and now the readings are coming in from lots of nodes.

Br3nda commented 7 years ago

Alas, that only fixed it temporarily. It goes back to not saving any of the nodes after a few minutes.

$ grep "is not a valid SetReq" /var/log/upstart/homeassistant.log

ValueError: 132 is not a valid SetReq
ValueError: 109 is not a valid SetReq
ValueError: 132 is not a valid SetReq
ValueError: 109 is not a valid SetReq
ValueError: 109 is not a valid SetReq
ValueError: 132 is not a valid SetReq
ValueError: 109 is not a valid SetReq
ValueError: 109 is not a valid SetReq
ValueError: 109 is not a valid SetReq
ValueError: 132 is not a valid SetReq
ValueError: 132 is not a valid SetReq
ValueError: 101 is not a valid SetReq
ValueError: 101 is not a valid SetReq
ValueError: 132 is not a valid SetReq

These were working great for a long time -- so what's changed? it seems like whatever condition triggers this stops all mysensors nodes from being understood by HomeAssistant

MartinHjelmare commented 7 years ago

We have to find out where these values come from. They are not valid value types for set or req messages according to the mysensors serial API. A serial log of a node that has the bad value and a parallel log of home assistant could shed some light.

Br3nda commented 7 years ago

How about the bad SetReq is caught before it's written to the file? Cos right now, one bad presentation makes all sensors stop working.

MartinHjelmare commented 7 years ago

All messages received should be validated before being passed on. I'm not sure why that doesn't happen in your case.

balloobbot commented 6 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

balloobbot commented 6 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍