HomeAssistant not seeing MySensors Gateway

Hi All - First of all, great work!

I am trying to use HomeAssistant with a number of MySensors nodes I already have set up. Unfrotunately, although the mysensors component loads, HomeAssistant refuses to show any information re. the gateway or sensors.

I know the MySensors side of things is working, and messages are being received as I can see them if I run a serial console (or use a specific MySensors controller - MySController in this case).

My setup is Win 7 with Python 3.5 (x64). I can see the component load, and I know its going to the right port (if I change the port in configuration.yaml or the gateway is not connected, then I get errors).

Any clues as to what might be happenning/how to debug?



Check out this thread on the Mysensors forum to see how I was able to get a motion sensor working on HASS running on an RPi- forum.mysensors.org/topic/2388/h … s-nodes/24
My problem turned out to be related to the MySensors library not recognizing Arduino Leonardo-type boards. However, you will find useful suggestions there which might apply to your setup. For example, much depends on which HASS version your using.

I also have troubles with MySensors connected to HomeAssistant using serial gateway.
My testing configuration is:
MySensors 1.4 & 1.5 built with Arduino Nano 328.
Home-Assistant v.0.9.1
Python 3.4
PySerial 2.7
PC: Linux Mint 17.2 & 17.3

Serial Gateway - Arduino IDE 1.6.5 monitor:

0;0;3;0;14;Gateway startup complete. 0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0: 255;255;3;0;3; 0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0: 255;255;3;0;3; 0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0: 255;255;3;0;3; 0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0: 255;255;3;0;3;

Relay Actuator - Arduino IDE 1.6.5 monitor:

nreq node id send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok: repeater started, id 255 req node id send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok: req node id send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok: req node id send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:

Home-Assistant configuration.yaml:

  • platform: mysensors
    gateway: serial
    port: /dev/ttyUSB0

Error from home-assistant.log:
mysensors.mysensors: Error decoding message from gateway, probably received bad byte.
I have modified the port speed in MyConfig.h from 115200 to 9600 and get the message on terminal:

INFO:homeassistant.loader:Loaded sensor.mysensors from homeassistant.components.sensor.mysensors INFO:homeassistant.components.sensor.mysensors:sensor_update sensor_update: node 1
but nothing shown in HomeAssistant page.
May I have to manually declare each sensor built in MySensors inside the configuration.yaml? How they should appear there?
Thank you.


pySerial 2.7 has a bug that in some cases gives garbage upon reconnect of the port. This was solved in the pyserial master branch at github, but there’s no new release yet. I’m waiting for a new release, cause that will give the option of upgrading the dependency in pymysensors without conflicting with the other component that uses pyserial in homeassistant, hopefully. My own solution right now is to downgrade to pyserial 2.5, but that’s not a viable solution in the long run, in my opinion.

The warning “Error decoding message from gateway, probably received bad byte.” is a sign there’s a problem with the serial communication. Could be to the bug mentioned above. But sometimes it helps just restarting homeassistant. So try that a couple of times. But you should solve the other problems first, see below.

You shouldn’t change the baudrate of mysensors, since that’s not supported by the current implementation of mysensors in homeassistant. Default is 115200, so don’t change that.

I guess you know that you can’t have more than one connection to the gateway serial port at one time. For example you can’t have the serial monitor in the Arduino IDE watching the gateway port at the same time as starting homeassistant with mysensors for that port. The serial interface is exclusive.

From the serial log, it looks as if the node requests an id from the controller. Try setting a fixed node id in your sketch, instead, and see what happens then. I haven’t tried using the auto request id function that much yet, so can’t say if that’s working properly or not, but I like narrowing down possible problems when troubleshooting.

Are you using any other sensors in your homeassistant config? If so, you should increment them with a number, like: sensor, sensor 2, sensor 3 etc. That’s documented on the homeassistant web page. Your config looks a bit incorrect. Compare with my own:



platform: mysensors
port: “/dev/ttyUSB0”



sensor 2:
platform: forecast
api_key: censored
- summary
- precip_type
- precip_intensity
- temperature
- dew_point
- wind_speed
- wind_bearing
- cloud_cover
- humidity
- pressure
- visibility
- ozone

Thank you for very detailed explanation and advices. Unfortunately I had no luck with the serial gateway, but, because I liked booth Home Assistant and MySensors, I spend some time in this direction and then succeed to make them work fine together. I have opened a new topic about Home Assistant and MySensors using MQTT at viewtopic.php?f=4&t=91 , there is the link to my work.

Hello Mihai,

The link doesn’t work anymore. Can you post it again? Or describe your work in a new post?
I’m starting with HA and Mysensors. For the moment HA can connect to the gateway and I see the sensor data on the HA log but I need to figure out to to see the sensors in HA interface… I don’t know if they should appear automatically somehow or I need to declare them on the configuration.

Thank you.

Hi Alfredo,
The project description is here: https://forum.mysensors.org/topic/3478/home-automation