fail presentation



  • hello I am using latest Home Assistant with mysensors installed and I am getting this strange error in log after connecting humidity sensor node

     INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 192.168.1.10
    Apr 17 21:46:51 luc3as-ha hass[11884]: INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 25-25-0 s=255,c=3,t=15,pt=2,l=2,sg=0:0
    Apr 17 21:46:54 luc3as-ha hass[11884]: INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 25-25-0 s=255,c=3,t=11,pt=0,l=8,sg=0:Humidity
    Apr 17 21:46:54 luc3as-ha hass[11884]: INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 25-25-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
    Apr 17 21:46:54 luc3as-ha hass[11884]: INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 25-25-0 s=0,c=0,t=7,pt=0,l=0,sg=0:
    Apr 17 21:47:00 luc3as-ha hass[11884]: Exception in thread Thread-2:
    Apr 17 21:47:00 luc3as-ha hass[11884]: Traceback (most recent call last):
    Apr 17 21:47:00 luc3as-ha hass[11884]: File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    Apr 17 21:47:00 luc3as-ha hass[11884]: self.run()
    Apr 17 21:47:00 luc3as-ha hass[11884]: File "/root/.homeassistant/lib/mysensors/mysensors.py", line 328, in run
    Apr 17 21:47:00 luc3as-ha hass[11884]: response = self.handle_queue()
    Apr 17 21:47:00 luc3as-ha hass[11884]: File "/root/.homeassistant/lib/mysensors/mysensors.py", line 233, in handle_queue
    Apr 17 21:47:00 luc3as-ha hass[11884]: reply = func(*args, **kwargs)
    Apr 17 21:47:00 luc3as-ha hass[11884]: File "/root/.homeassistant/lib/mysensors/mysensors.py", line 115, in logic
    Apr 17 21:47:00 luc3as-ha hass[11884]: self._handle_presentation(msg)
    Apr 17 21:47:00 luc3as-ha hass[11884]: File "/root/.homeassistant/lib/mysensors/mysensors.py", line 49, in _handle_presentation
    Apr 17 21:47:00 luc3as-ha hass[11884]: self.sensors[msg.node_id].add_child_sensor(msg.child_id,
    Apr 17 21:47:00 luc3as-ha hass[11884]: KeyError: 25
    Apr 17 21:47:00 luc3as-ha hass[11884]: INFO:homeassistant.components.device_tracker.asuswrt:Checking ARP
    
    

  • Contest Winner

    @Luc3as it seems that you have found a bug in Home Assistant. Haven't seen a Stack trace in a while. I think it would help the developers if you can post the log file including the stack trace.


  • Plugin Developer

    @Luc3as

    This is due to the node not being presented before any sensors are presented. That radio message was probably dropped.

    A fix for the error has been merged at pymysensors already, buy you still need to make sure the node is presented before sensors can be added.

    The node presentation message is sent automatically when gw.begin or similar in dev branch is called.

    You can resend the presentation with the present method. To present the node use child id 255 and sensor type 17 for regular node or 18 for repeater node.

    See
    https://github.com/theolind/pymysensors/pull/38

    and for discussion
    https://github.com/theolind/pymysensors/pull/37

    The fix will be included in the next release of home assistant.



  • Hi, I also struggle with the presentation of my sensors.

    I've installed HA 0.18.2 over pip. My config on a raspberry pi looks as follows:

    ...
    sensor:
      platform: mysensors
    
    mysensors:
      gateways:
        - device: '/dev/ttyUSB0'
          persistence_file: '/home/pi/.homeassistant/mysensors.json'
          baud_rate: 115200
      debug: true
      persistence: true
      version: '1.5'
      optimistic: false
    

    On HA startup I get:

    INFO:mysensors.mysensors:Trying to connect to /dev/ttyUSB0
    INFO:homeassistant.components.http:Starting web interface at http://0.0.0.0:8123
    INFO:homeassistant.core:Timer:starting
    INFO:mysensors.mysensors:/dev/ttyUSB0 is open...
    INFO:mysensors.mysensors:Connected to /dev/ttyUSB0
    INFO:homeassistant.components.http:"GET /api/stream?api_password=no_password_set&restrict=state_changed,component_loaded,service_registered HTTP/1.1" 200 -
    INFO:netdisco.service:Scanning
    INFO:homeassistant.components.http:"GET /api/bootstrap HTTP/1.1" 200 -
    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:gateway started, id=0, parent=0, distance=0
    

    I've set up a node with the orginal Binary-Sensor example from https://home-assistant.io/components/binary_sensor.mysensors/.
    If I power the node up, I get in the log:

    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 0-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0:0
    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 0-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0:1.5.4
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 0-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 0-0-0 s=255,c=3,t=11,pt=0,l=12,sg=0:BinarySensor
    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 0-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 0-0-0 s=1,c=0,t=0,pt=0,l=0,sg=0:
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 0-0-0 s=1,c=1,t=16,pt=2,l=2,sg=0:0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    

    and if I push the button on the node I get:

    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 0-0-0 s=1,c=1,t=16,pt=2,l=2,sg=0:1
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 0-0-0 s=1,c=1,t=16,pt=2,l=2,sg=0:0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    INFO:homeassistant.components.mysensors:No sketch_name: node 0
    

    So for me it looks like everything is working, but the sensor dont show up on the web interface.

    What am I missing?


  • Plugin Developer

    @kielnino

    Hi!

    First you should remove:

    sensor:
      platform: mysensors
    

    Then your node has id 0, which is usually reserved for the gateway. So that is kinda strange. It shouldn't matter for the pymysensors API, though, I think. It seems as if the sketch name is not picked up by pymysensors/home-assistant for node 0 even though that message is received.

    Only dev branch is able to have sensors on gateway, and you're running version 1.5.4, and you said you connected a separate node with binary sensor.

    If you don't specify a node id in the begin method in the sketch and the node hasn't got a stored old node id in the eeprom, pymysensors will provide a node id, automatically. But the lowest automatic node id should be 1. So is it possible that you have a stored node id of 0 in the eeprom of your arduino node?

    You can try clearing the eeprom with the clear eeprom config sketch in the mysensors library.
    https://github.com/mysensors/Arduino/blob/1.5.4/libraries/MySensors/examples/ClearEepromConfig/ClearEepromConfig.ino



  • This post is deleted!


  • @martinhjelmare

    Wow thank you so much.

    I've cleared the eeprom and now it gets node id 1. After removing the persistence file the sensor now shows on the web interface.



Suggested Topics

47
Online

11.4k
Users

11.1k
Topics

112.6k
Posts