MySensors integration broken? MySensors Invalid message data

Hi All!

I have a problem with MySensors integration in HA.
I’ve written a sketch with Serial transport with Arduino Mega board, connected to Home Assistant Raspberry Pi.
Now i’ve got following errors in log

2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;255;3;0;14;Gateway startup complete.
2021-09-28 16:15:19 INFO (MainThread) [mysensors.handler] n:0 c:255 t:3 s:14 p:Gateway startup complete.
2021-09-28 16:15:19 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 0 child 255
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Sending 255;255;3;0;20;
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;0;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;0;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;1;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;1;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;2;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;2;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;3;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;3;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;4;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;4;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;5;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;5;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;6;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;6;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;7;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;7;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;8;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;8;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;9;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;9;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;10;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;10;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;11;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;11;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;12;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;12;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;13;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;13;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;14;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;14;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;15;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;15;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;16;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;16;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;17;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;17;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;18;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;18;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;19;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;19;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;20;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;20;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;21;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;21;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;22;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;22;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;23;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;23;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;24;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;24;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;25;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;25;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;26;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;26;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;27;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;27;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;28;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;28;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;29;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;29;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;30;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;30;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''
2021-09-28 16:15:19 DEBUG (MainThread) [mysensors.transport] Receiving 0;31;1;0;2;
2021-09-28 16:15:19 WARNING (MainThread) [mysensors] Invalid <Message data="0;31;1;0;2;">: value must be either 0 or 1 for object value @ data['payload']. Got ''

Actually 0;31;1;0;2 is real answer from my atMega board, so what is going on here?
Tried several version of library (development, 2.4, also downgraded to 2.0), but nothing helps :disappointed:

Home assistant version is current - freshly installed.

Thank you for any help!

No actual clue about MySensors, but a quick look at the doc makes me think you specified a wrong type for the sensor in your sketch.

It is set to S_BINARY:

for(size_t i = 0; i < m_lights_size; ++i ) {
  present( i, S_BINARY, m_lights[i].description );
}

Isn’t it correct?

Obviously not.
Then HA expects 0 / 1, as it explicitly says in the error message.

But it’s not possible. Here’s my present(). I’ve also added to be sure that MyMessage is set to V_LIGHT:

// Send the sketch version information to the gateway and Controller
  sendSketchInfo( MY_HOSTNAME, SKETCH_VERSION );

  // Tell the MySensors gateway what kind of sensors this node has, and what their ID's on the node are, as defined in the code above.
  for(size_t i = 0; i < m_lights_size; ++i ) {
    m_lights[i].message->setType(V_LIGHT);
    present( i, S_LIGHT, m_lights[i].description );
  }
}

Still no luck.
If its not correct answer from board, what is correct?

All right, it seems my sensors needs to do set on message before presentation :slight_smile:
Works ok now, topic can be closed :slight_smile: