I found a solution for my problem. In configuration.yaml I changed:
version: '2.3.2'
to
version: '2.3'
Now the errors don't show up anymore and my node is working
I found a solution for my problem. In configuration.yaml I changed:
version: '2.3.2'
to
version: '2.3'
Now the errors don't show up anymore and my node is working
I actually have the same problem and do not know where it is coming from.
I tried several time to delete mysensors.json file and restart AH to try to troubleshoot it without success.
This is the errors I get exactly:
2020-02-25 19:07:32 ERROR (MainThread) [homeassistant.components.mysensors.device] Error updating Grow monitor 30 3
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mysensors/device.py", line 108, in update
await self._async_update_callback()
File "/usr/src/homeassistant/homeassistant/components/mysensors/device.py", line 134, in _async_update_callback
await self.async_update_ha_state(True)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 330, in _async_write_ha_state
unit_of_measurement = self.unit_of_measurement
File "/usr/src/homeassistant/homeassistant/components/mysensors/sensor.py", line 85, in unit_of_measurement
float(self.gateway.protocol_version) >= 1.5
ValueError: could not convert string to float: '2.3.2'
I checked the file mentioned in the last line here: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/mysensors/sensor.py
I see that V_LEVEL doesn't have a S_MOISTURE corresponding it to (line 32).
Could the error comes from the unit of measurement is not mentioned for S_MOISTURE type of sensors?
You were right, there was a character problem when copy/pasting the command to the terminal.
Now I can build MySensor with username and password and it works fine.
Thanks for the help!
I made some more tests and I think it doesn't work because when I setup Mosquitto, I created a user/password but didn't do it when building MySensor gateway.
I looked at the list of options from this page and added the next 2 configuration options:
--my-mqtt-user=pi
--my-mqtt-password=raspberry
(pi / raspberry being the same user / password I set my Mosquitto user during the installation)
But when I configure the MySensor gateway I see this in the console:
[WARNING] Unknown option detected:--my-mqtt-user=pi, ignored
[WARNING] Unknown option detected:--my-mqtt-password=raspberry, ignored
Is there any other way I could try to build the gateway with user/password than this? Or is this a bug? Those 2 options are clearly written in the configuration options page for the Raspberry Pi gateway.
Hello,
I am struggling to make the initial setup of MySensors with Hassbian. I am running both on same Raspberry Pi 3.
I installed MySensor gateway on the RPi with following configuration
./configure --my-transport=rf24 --my-rf24-ce-pin=18 --my-rf24-cs-pin=24 --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mygateway1-out --my-mqtt-subscribe-topic-prefix=mygateway1-in --my-mqtt-client-id=mygateway1
In Hassbian I installed Mosquitto and this is how my configuration.yaml file look like:
# MQTT gateway
mqtt:
broker: 127.0.0.1
client_id: mygateway1
username: pi
password: raspberry
# MySensor
mysensors:
gateways:
- device: mqtt
persistence_file: '/home/homeassistant/.homeassistant/mysensors.json'
topic_in_prefix: 'mygateway1-out'
topic_out_prefix: 'mygateway1-in'
optimistic: false
persistence: true
retain: true
version: '2.3.1'
# Debug logger
logger:
default: info
logs:
homeassistant.components.mysensors: debug
mysensors: debug
I followed the instructions from Home Assistant page and made a dummy sensor node with following code:
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_RF24
// Enable repeater functionality for this node
#define MY_REPEATER_FEATURE
#include <MySensors.h>
#define CHILD_ID 1
#define MY_NODE_ID 1
bool initialValueSent = false;
bool state = false;
MyMessage msg(CHILD_ID, V_LIGHT);
void setup() { }
void presentation() {
sendSketchInfo("Relay+button", "1.0");
present(CHILD_ID, S_LIGHT);
}
void loop()
{
// Need to send initial values for Home Assistant
if (!initialValueSent) {
Serial.println("Sending initial value");
send(msg.set(state));
Serial.println("Requesting initial value from controller");
request(CHILD_ID, V_LIGHT);
wait(2000, C_SET, V_LIGHT);
}
}
void receive(const MyMessage &message) {
if (message.isAck()) {
Serial.println("This is an ack from gateway");
}
if (message.type == V_LIGHT) {
// We got initial values from Home Assistant
if (!initialValueSent) {
Serial.println("Receiving initial value from controller");
initialValueSent = true;
}
// Write some debug info
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", New status: ");
Serial.println(message.getBool());
}
}
I make sure that I send the sensor S_TYPE in the presentation and that I also send an initial value out.
The Arduino console output is the following:
16 MCO:BGN:INIT REPEATER,CP=RNNRA---,REL=255,VER=2.3.1
26 TSM:INIT
27 TSF:WUR:MS=0
34 TSM:INIT:TSP OK
36 TSF:SID:OK,ID=1
37 TSM:FPAR
74 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
2081 !TSM:FPAR:NO REPLY
2083 TSM:FPAR
2119 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
4127 !TSM:FPAR:NO REPLY
4129 TSM:FPAR
4165 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
6173 !TSM:FPAR:NO REPLY
6175 TSM:FPAR
6211 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
8219 !TSM:FPAR:FAIL
8220 TSM:FAIL:CNT=1
8222 TSM:FAIL:DIS
8224 TSF:TDI:TSL
18226 TSM:FAIL:RE-INIT
I tried using MySensor log parser and if I understand correctly the node does not get answer from the gateway.
On the Raspberry Pi, I checked the logs from Home Assistant and they seem fine.
2019-09-12 07:39:12 DEBUG (SyncWorker_17) [mysensors.persistence] Loading sensors from persistence file /home/homeassistant/.homeassistant/mysensors.json
2019-09-12 07:39:12 DEBUG (SyncWorker_6) [mysensors.persistence] Saving sensors to persistence file /home/homeassistant/.homeassistant/mysensors.json
2019-09-12 07:39:12 INFO (MainThread) [mysensors.gateway_mqtt] Setting up initial MQTT topic subscription
2019-09-12 07:39:12 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mygateway1-out/+/+/0/+/+, qos: 0
2019-09-12 07:39:12 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mygateway1-out/+/+/3/+/+, qos: 0
2019-09-12 07:39:12 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to mygateway1-out/+/+/0/+/+
2019-09-12 07:39:12 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to mygateway1-out/+/+/3/+/+
So then I stopped MySensor gateway service and run it myself using the command
cd MySensors
sudo ./bin/msgw
This is what I have as output
pi@hassbian:~/MySensors $ sudo ./bin/mysgw
Sep 12 10:12:32 INFO Starting gateway...
Sep 12 10:12:32 INFO Protocol version - 2.3.1
Sep 12 10:12:32 DEBUG MCO:BGN:INIT GW,CP=RNNGL---,REL=255,VER=2.3.1
Sep 12 10:12:32 DEBUG TSF:LRT:OK
Sep 12 10:12:32 DEBUG TSM:INIT
Sep 12 10:12:32 DEBUG TSF:WUR:MS=0
Sep 12 10:12:32 DEBUG TSM:INIT:TSP OK
Sep 12 10:12:32 DEBUG TSM:INIT:GW MODE
Sep 12 10:12:32 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
Sep 12 10:12:32 DEBUG MCO:REG:NOT NEEDED
Sep 12 10:12:32 DEBUG MCO:BGN:STP
Sep 12 10:12:32 DEBUG MCO:BGN:INIT OK,TSP=1
Sep 12 10:12:32 DEBUG GWT:RMQ:MQTT RECONNECT
Sep 12 10:12:32 DEBUG connected to 127.0.0.1
Sep 12 10:12:32 DEBUG TSM:READY:NWD REQ
Sep 12 10:12:32 DEBUG TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
Sep 12 10:12:32 DEBUG GWT:RMQ:MQTT RECONNECT
Sep 12 10:12:32 DEBUG connected to 127.0.0.1
Sep 12 10:12:32 DEBUG GWT:RMQ:MQTT RECONNECT
Sep 12 10:12:32 DEBUG connected to 127.0.0.1
...
(infinite amount of reconnect message)
...
Sep 12 10:12:32 DEBUG GWT:RMQ:MQTT RECONNECT
Sep 12 10:12:32 DEBUG connected to 127.0.0.1
Sep 12 10:12:32 DEBUG GWT:RMQ:MQTT RECONNECT
Sep 12 10:12:32 DEBUG connected to 127.0.0.1
Sep 12 10:12:32 DEBUG TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
Sep 12 10:12:32 DEBUG TSF:MSG:BC
Sep 12 10:12:32 DEBUG TSF:MSG:FPAR REQ,ID=1
Sep 12 10:12:32 DEBUG TSF:CKU:OK,FCTRL
Sep 12 10:12:32 DEBUG TSF:MSG:GWL OK
Sep 12 10:12:33 DEBUG !TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
Sep 12 10:12:33 DEBUG GWT:RMQ:MQTT RECONNECT
Sep 12 10:12:33 DEBUG connected to 127.0.0.1
...
I would assume the problem comes from the gateway that do not stay connected and constantly reconnect but I am out of clues of what I am doing wrong.
Any idea is appreciated, thanks!