Firstly, thank you very much to all who have put in so much work to Home Assistant, Mysensors and everything else.
Since the update to 0.52, I’ve lost all my mysensors sensors. I’ve searched the forum and read a couple of other topics that seem very related but I haven’t been able to solve it. It looks to me to be something to do with the new message validation, but I haven’t been able to work it out. The protocol version isn’t null, and I have one value reported per child ID. To help testing, I’ve removed everything except the gateway (serial) that also has a temperature sensor attached, and this doesn’t get added either. I’ve removed mysensors.json to try to start again.
I’ve read through the serial api of mysensors, and as far as I can tell the mesages look correct.
This is the mysensors part of my configuration.yaml:
mysensors:
gateways:
device: '/dev/ttyACM0'
persistence_file: '/var/lib/hass/mysensors.json'
baud_rate: 115200
optimistic: false
persistence: true
retain: true
version: 2.0
This is the gateway sketch:
#define MY_DEBUG
// Define node ID
#define MY_NODE_ID 0
// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69
#define MY_SIGNING_SOFT
#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
#define MY_SIGNING_REQUEST_SIGNATURES
// Enable serial gateway
#define MY_GATEWAY_SERIAL
// Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
#if F_CPU == 8000000L
#define MY_BAUD_RATE 38400
#endif
// Flash leds on rx/tx/err
// Uncomment to override default HW configurations
#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin
#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin
#define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED
#include <MySensors.h>
#include <DallasTemperature.h>
#include <OneWire.h>
// Send temperature only if changed? 1 = Yes 0 = No
#define COMPARE_TEMP 1
// Pin where dallas sensor is connected
#define ONE_WIRE_BUS 2
// Sleep time between reads (in milliseconds)
unsigned long SLEEP_TIME = 60000;
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass the oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// arrays to hold device address
DeviceAddress insideThermometer;
#define CHILD_ID_TEMP 0
float lastTemperature;
// Initialize temperature message
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
void setup()
{
sensors.begin();
if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0");
// set the resolution to 12 bit (Each Dallas/Maxim device is capable of several different resolutions)
sensors.setResolution(insideThermometer, 12);
Serial.print("Device 0 Resolution: ");
Serial.print(sensors.getResolution(insideThermometer), DEC);
Serial.println();
}
void presentation()
{
// Present locally attached sensors
// Send the sketch version information to the gateway and Controller
sendSketchInfo("Gateway Temp", "1.2");
// Present all sensors to controller
present(CHILD_ID_TEMP, S_TEMP);
}
void loop()
{
// Send locally attached sensor data here
// Fetch temperatures from Dallas sensors
sensors.requestTemperatures();
float temp = sensors.getTempC(insideThermometer);
// Only send data if temperature has changed and no error
#if COMPARE_TEMP == 1
if (lastTemperature != temp && temp != -127.00 && temp != 85.00) {
#else
if (temp != -127.00 && temp != 85.00) {
#endif
// Send in the new temperature
Serial.print("Sending temp: "); Serial.println(temp);
send(msgTemp.set(temp,1));
// Save new temperatures for next compare
lastTemperature=temp;
}
wait(SLEEP_TIME);
}
This what I see monitoring the serial output of the gateway:
0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGAS-,VER=2.1.1
0;255;3;0;9;TSM:INIT
0;255;3;0;9;TSF:WUR:MS=0
0;255;3;0;9;TSM:INIT:TSP OK
0;255;3;0;9;TSM:INIT:GW MODE
0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
0;255;3;0;9;MCO:REG:NOT NEEDED
0;255;3;0;14;Gateway startup complete.
0;255;0;0;18;2.1.1
0;255;3;0;11;Gateway Temp
0;255;3;0;12;1.2
0;0;0;0;6;
0;255;3;0;9;MCO:BGN:STP
Device 0 Resolution: 12
0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
Sending temp: 28.50
0;0;1;0;0;28.5
Sending temp: 28.37
0;0;1;0;0;28.4
mysensors.json:
{"0": {"sensor_id": 0, "children": {"0": {"id": 0, "type": 6, "description": "", "values": {"0": "28.5"}}}, "type": 18, "sketch_name": "Gateway Temp", "sketch_version": "1.2", "_battery_level": 0, "protocol_version": "2.1.1"}}[
and finally home-assistant.log:
2017-09-02 15:57:02 WARNING (SyncWorker_0) [homeassistant.components.mysensors] Invalid values: {0: '28.5'}: sensor platform: node 0 child 0: S_TEMP requires value_type V_TEMP @ data[0]
2017-09-02 15:57:02 INFO (Thread-3) [mysensors.gateway_serial] Trying to connect to /dev/ttyACM0
2017-09-02 15:57:02 INFO (Thread-3) [mysensors.gateway_serial] /dev/ttyACM0 is open...
2017-09-02 15:57:02 INFO (Thread-3) [mysensors.gateway_serial] Connected to /dev/ttyACM0
2017-09-02 15:57:04 DEBUG (Thread-3) [mysensors] n:0 c:255 t:3 s:9 p:MCO:BGN:INIT GW,CP=RNNGAS-,VER=2.1.1
2017-09-02 15:57:04 DEBUG (Thread-3) [mysensors] n:0 c:255 t:3 s:9 p:TSM:INIT
2017-09-02 15:57:04 DEBUG (Thread-3) [mysensors] n:0 c:255 t:3 s:9 p:TSF:WUR:MS=0
2017-09-02 15:57:04 DEBUG (Thread-3) [mysensors] n:0 c:255 t:3 s:9 p:TSM:INIT:TSP OK
2017-09-02 15:57:04 DEBUG (Thread-3) [mysensors] n:0 c:255 t:3 s:9 p:TSM:INIT:GW MODE
2017-09-02 15:57:04 DEBUG (Thread-3) [mysensors] n:0 c:255 t:3 s:9 p:TSM:READY:ID=0,PAR=0,DIS=0
2017-09-02 15:57:04 DEBUG (Thread-3) [mysensors] n:0 c:255 t:3 s:9 p:MCO:REG:NOT NEEDED
2017-09-02 15:57:04 INFO (Thread-3) [mysensors] n:0 c:255 t:3 s:14 p:Gateway startup complete.
2017-09-02 15:57:04 DEBUG (Thread-3) [homeassistant.components.mysensors] Node update: node 0 child 255
2017-09-02 15:57:04 DEBUG (Thread-3) [homeassistant.components.mysensors] Not a child update for node 0
2017-09-02 15:57:04 DEBUG (Thread-3) [homeassistant.components.mysensors] Node update: node 0 child 255
2017-09-02 15:57:04 DEBUG (Thread-3) [homeassistant.components.mysensors] Not a child update for node 0
2017-09-02 15:57:04 WARNING (Thread-3) [mysensors] child_id 0 already exists in children of node 0, cannot add child
2017-09-02 15:57:04 DEBUG (Thread-3) [mysensors] n:0 c:255 t:3 s:9 p:MCO:BGN:STP
2017-09-02 15:57:04 WARNING (Thread-3) [mysensors] Error decoding message from gateway, bad data received: Device 0 Resolution: 12
2017-09-02 15:57:04 WARNING (Thread-3) [mysensors] Not a valid message:
2017-09-02 15:57:04 DEBUG (Thread-3) [mysensors] n:0 c:255 t:3 s:9 p:MCO:BGN:INIT OK,TSP=1
2017-09-02 15:57:04 DEBUG (Thread-3) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
2017-09-02 15:57:05 WARNING (Thread-3) [mysensors] Error decoding message from gateway, bad data received: Sending temp: 28.25
2017-09-02 15:57:05 WARNING (Thread-3) [mysensors] Not a valid message:
2017-09-02 15:57:05 DEBUG (Thread-3) [homeassistant.components.mysensors] Node update: node 0 child 0
2017-09-02 15:57:05 WARNING (Thread-3) [homeassistant.components.mysensors] Invalid values: {0: '28.3'}: sensor platform: node 0 child 0: S_TEMP requires value_type V_TEMP @ data[0]
I’m sure I’m doing something silly, but just can’t figure it out. Thanks very much in advance for any help.
P.S. This is my first post and while I’ve tried to use code blocks, apologies if I’ve got it wrong.