Mysensors RGB node not added with "Not a valid message" error

I’m runnin home-assistant 0.89.2 (also tried upgrading to 0.90 beta 4) on hassbian. Also running mysensors gateway 2.3.1 on the same rpi. Also I have test mysensors node (v. 2.3.1) presented as “S_RGB_LIGHT”. Problem is that home-assistant gives me an error and doesn’t add this node to the list.

18 22:57:37 hassbian hass[9235]: 2019-03-18 22:57:37 DEBUG (MainThread) [mysensors] Receiving 10;255;3;0;6;0
18 22:57:37 hassbian hass[9235]: 2019-03-18 22:57:37 DEBUG (MainThread) [mysensors] Sending 10;255;3;0;6;M
18 22:57:37 hassbian hass[9235]: 2019-03-18 22:57:37 DEBUG (MainThread) [mysensors] Receiving 10;255;3;0;11;RGB Dimmable Light
18 22:57:37 hassbian hass[9235]: 2019-03-18 22:57:37 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 10 child 255
18 22:57:37 hassbian hass[9235]: 2019-03-18 22:57:37 DEBUG (MainThread) [mysensors] Sending 0;255;3;0;2;
18 22:57:37 hassbian hass[9235]: 2019-03-18 22:57:37 DEBUG (MainThread) [mysensors] Receiving 10;255;3;0;12;1.0
18 22:57:37 hassbian hass[9235]: 2019-03-18 22:57:37 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 10 child 255
18 22:57:37 hassbian hass[9235]: 2019-03-18 22:57:37 DEBUG (MainThread) [mysensors] Receiving 10;1;0;0;26;RGB_test
18 22:57:37 hassbian hass[9235]: 2019-03-18 22:57:37 WARNING (MainThread) [mysensors] Not a valid message: Not valid message sub-type: 26 for dictionary value @ data['sub_type']
18 22:57:37 hassbian hass[9235]: 2019-03-18 22:57:37 DEBUG (MainThread) [mysensors] Receiving 0;255;3;0;2;2.3.1

“26” - is a type value for “S_RGB_LIGHT” in mysensors Serial API. Somehow home-assistant doesn’t recognize it. The same node is working with domoticz on the other rpi.
mysgw log:

Mar 18 23:13:10 DEBUG TSF:MSG:READ,80-80-0,s=255,c=3,t=11,pt=0,l=18,sg=0:RGB Dimmable Light
Mar 18 23:13:10 DEBUG TSF:MSG:READ,80-80-0,s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
Mar 18 23:13:10 DEBUG TSF:MSG:READ,80-80-0,s=1,c=0,t=26,pt=0,l=8,sg=0:RGB_test
Mar 18 23:13:10 DEBUG TSF:MSG:READ,80-80-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
Mar 18 23:13:10 DEBUG TSF:MSG:SEND,0-0-80-80,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1

What’s your mysensors config bit of your configuration.yaml?

mysensors:
  gateways:
     - device: '127.0.0.1'
        tcp_port: 5003
        persistence_file: '/home/homeassistant/.homeassistant/mysensors.json'
    persistence: false

Here’s your fix:

mysensors:
  gateways:
     - device: '127.0.0.1'
        tcp_port: 5003
        persistence_file: '/home/homeassistant/.homeassistant/mysensors.json'
    persistence: false
    version: 2.0

The default is 1.4 which didn’t have S_RGB_LIGHT

Yes, about that. I forgot to mention, that I tried adding versions “2.3.1”, “2.3”, “2.0”. It gives another error:

18 23:38:51 hassbian hass[9235]: 2019-03-18 23:38:51 DEBUG (MainThread) [mysensors] Sending 0;255;3;0;2;
18 23:38:52 hassbian hass[9235]: 2019-03-18 23:38:52 DEBUG (MainThread) [mysensors] Receiving 0;255;3;0;2;2.3.1
18 23:39:02 hassbian hass[9235]: 2019-03-18 23:39:02 DEBUG (MainThread) [mysensors] Sending 0;255;3;0;2;
18 23:39:02 hassbian hass[9235]: 2019-03-18 23:39:02 DEBUG (MainThread) [mysensors] Receiving 0;255;3;0;2;2.3.1
18 23:39:12 hassbian hass[9235]: 2019-03-18 23:39:12 DEBUG (MainThread) [mysensors] Sending 0;255;3;0;2;
18 23:39:12 hassbian hass[9235]: 2019-03-18 23:39:12 DEBUG (MainThread) [mysensors] Receiving 0;255;3;0;2;2.3.1
18 23:39:13 hassbian hass[9235]: 2019-03-18 23:39:13 DEBUG (MainThread) [mysensors] Receiving 80;255;0;0;17;2.3.1
18 23:39:13 hassbian hass[9235]: 2019-03-18 23:39:13 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 80 child 255
18 23:39:13 hassbian hass[9235]: 2019-03-18 23:39:13 DEBUG (MainThread) [mysensors] Receiving 80;255;3;0;6;0
18 23:39:13 hassbian hass[9235]: 2019-03-18 23:39:13 DEBUG (MainThread) [mysensors] Sending 80;255;3;0;6;M
18 23:39:13 hassbian hass[9235]: 2019-03-18 23:39:13 DEBUG (MainThread) [mysensors] Receiving 80;255;3;0;11;RGB Dimmable Light
18 23:39:13 hassbian hass[9235]: 2019-03-18 23:39:13 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 80 child 255
18 23:39:13 hassbian hass[9235]: 2019-03-18 23:39:13 DEBUG (MainThread) [mysensors] Receiving 80;255;3;0;12;1.0
18 23:39:13 hassbian hass[9235]: 2019-03-18 23:39:13 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 80 child 255
18 23:39:13 hassbian hass[9235]: 2019-03-18 23:39:13 DEBUG (MainThread) [mysensors] Receiving 80;1;0;0;26;RGB_test
18 23:39:13 hassbian hass[9235]: 2019-03-18 23:39:13 WARNING (MainThread) [mysensors.sensor] child_id 1 already exists in children of node 80, cannot add child

After trying to make it this way I’ve deleted “version” string from config and was getting those other errors.

Can you post your sketch?

// Enable debug prints
#define MY_DEBUG

// Enable and select radio type attached

#define MY_RADIO_RF24
#define MY_RF24_CHANNEL 88
#define MY_NODE_ID 80

#include <MySensors.h>
#include <Adafruit_NeoPixel.h>

#define RGBPIN PD3
#define NUMPIXELS 12

#define SN "RGB Dimmable Light"
#define SV "1.0"

MyMessage rgbMsg(1, V_RGB);

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, RGBPIN, NEO_GRB + NEO_KHZ800);

void setup()
{
  pixels.begin();
}

void presentation()
{
  // Send the Sketch Version Information to the Gateway
  sendSketchInfo(SN, SV);

  present(1, S_RGB_LIGHT, "RGB_test");

}

void loop()
{
}

void receive(const MyMessage &message)
{
  if (message.type == V_RGB) {
    Serial.println( "V_RGB command: " );
    Serial.println(message.data);
    long number = (long) strtol( message.data, NULL, 16);

    // Split it up into r, g, b values
    byte red = number >> 16;
    byte green = number >> 8 & 0xFF;
    byte blue = number & 0xFF;
    setRGB(red, green, blue);
  }
}

void setRGB(int r, int g, int b)
{
  for (int i = 0; i < NUMPIXELS; i++) {

    pixels.setPixelColor(i, pixels.Color(r, g, b)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(300); // Delay for a period of time (in milliseconds).

  }
}

As I’ve mentioned this same sketch works as it should with domoticz.

Everything looks ok, I’d suggest sending the RGB color back to home assistant with the send function.

What’s in your /home/homeassistant/.homeassistant/mysensors.json ?

1 Like

Nothing. I disabled persistence and deleted json file while trying to deal with this. That didn’t help though :slight_smile:
Ok, I will now try your suggestion about sending value first.

YAY! That worked. So as I understand you need to send something from node to home-assistant to register it. Even if it primarily receiving node. Bad that it isn’t said anywhere explicitly.
Thanks for the help, man :slight_smile:

Actually it says in the presentation section on:

Send at least one initial value per V_TYPE. In version 2.0 of MySensors, this has to be done in the
loop function. See below for an example in 2.0 of how to make sure the initial value has been received
by the controller.

No worries tho I made the same mistake with my RGB Light strip.

You’re right, my bad. It slipped from my attention. I thought in was related to mysensors part, I am just used to other logic of doing this type of things :slight_smile:

That’s why the forums exist :smiley: