HA: moisture sensor ValueError: could not convert string to float: '2.1.1'
-
@mrhutchinsonmn I am revisiting this issue, attempting to get a mysensors wifi moisture sensor device working in my Homeassistant install. No one from my sensors or homeassistant was able to assist when I first created this topic. The setup and errors are the same. I am hoping someone has learned what the issue is that is causing the error and preventing the moisture sensor from appearing in the homeassistant gui. I am open to a different approach, if there is a better solution.
@mrhutchinsonmn - values in mysensors json looks very strange.
"values": { "37": "3" }Not sure what else. did you try to stop HA and remove the node from mysensors json and preesnt it again?
-
Yes, I removed mysensors.json and restarted. I just finished doing a new install of HA in case it was simply a version issue. I have more info now from the logs. What do you make of this output?:```
2020-02-25 11:45:07 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 105 child 255 2020-02-25 11:45:07 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,105-105-0,s=255,c=3,t=12,pt=0,l=3,sg=0:1.0 2020-02-25 11:45:07 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 105 child 255 2020-02-25 11:45:07 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,105-105-0,s=0,c=0,t=35,pt=0,l=0,sg=0: 2020-02-25 11:45:07 WARNING (MainThread) [mysensors] Not a valid message: Not valid message sub-type: 35 for dictionary value @ data['sub_type'] 2020-02-25 11:45:07 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,105-105-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 2020-02-25 11:45:07 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:TSF:MSG:SEND,0-0-105-105,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 2020-02-25 11:45:07 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,105-105-0,s=0,c=1,t=37,pt=4,l=4,sg=0:1 2020-02-25 11:45:07 WARNING (MainThread) [mysensors] Child 0 is unknown 2020-02-25 11:45:07 DEBUG (SyncWorker_1) [mysensors.persistence] Saving sensors to persistence file /home/raymond/.homeassistant/mysensors1.pickle -
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? -
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?@Meach
I guess there's only one way to find out: Add theS_MOISTUREdefinition on line 36 insensors.pymanually, restart HA and give it a try."V_LEVEL": { "S_SOUND": ["dB", "mdi:volume-high"], "S_VIBRATION": ["Hz", None], "S_LIGHT_LEVEL": ["lx", "mdi:white-balance-sunny"], "S_MOISTURE": ["%", "mdi:water-percent"], },Since the measurement in your sketch seems to be tensiometric, I'm not certain if % is the correct unit to choose here, but I guess in general people would assume that
S_MOISTUREis a volumetric measurement representing the percentage of water per volume in the soil. So you might want to change it to[None, "mdi:gauge"]or[kPa, "mdi:gauge"].It's weird though that the logs from both of you complain about the MySensors version string, which of course, isn't a valid float and can't be converted with
float(varString). -
Out of curiosity, I just setup a node with the sketch that @mrhutchinsonmn posted in the first post, but uploaded dummy data instead of measuring actual values (shouldn't be a problem, I just don't have a soil moisture sensor at hand). I also tried the latest version of the SoilMoistSensor.ino sketch.
Unfortunately, I was unable to reproduce the issue. Serial output is fine, the HA log shows no errors, the sensor value is displayed in the GUI. So I doubt that the change mentioned above will have any effect. It's most likely just used to display a default unit and icon in the GUI. If there's no matching sensor type, as is the case with
S_MOISTURE, it will default to a unit-less display. At least that's my understanding.I used MySensors 2.3.2 and Home Assistant 0.105.5 (in Docker).
-
That particular error went away with a new HA install 0.103.6. However, I continue to get data type and child unknown errors:
020-02-26 07:47:33 WARNING (MainThread) [mysensors] Not a valid message: Not valid message sub-type: 35 for dictionary value @ data['sub_type'] 2020-02-26 07:47:34 WARNING (MainThread) [mysensors] Child 0 is unknown 2020-02-26 07:48:05 WARNING (MainThread) [mysensors] Child 0 is unknown 2020-02-26 07:48:36 WARNING (MainThread) [mysensors] Child 0 is unknown 2020-02-26 07:49:07 WARNING (MainThread) [mysensors] Child 0 is unknown 2020-02-26 07:49:30 WARNING (MainThread) [mysensors] Not a valid message: Not valid message sub-type: 21 for dictionary value @ data['sub_type'] 2020-02-26 07:49:38 WARNING (MainThread) [mysensors] Child 0 is unknown 2020-02-26 07:50:09 WARNING (MainThread) [mysensors] Child 0 is unknownCorresponding serial monitor info:
5235 TSF:MSG:SEND,105-105-0-0,s=0,c=1,t=37,pt=4,l=4,sg=0,ft=0,st=OK:-2 5244 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255 5250 TSF:TDI:TSL 5252 MCO:SLP:WUP=-1 5253 TSF:TRI:TSB 10 0 10 10 0 10 0 0 0 0 4 0 0 0 0 0 -10 0 0 0 0 -1 resistance bias =5 sensor bias compensated value = 1 5307 TSF:MSG:SEND,105-105-0-0,s=0,c=1,t=37,pt=4,l=4,sg=0,ft=0,st=OK:1 5316 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255 5321 TSF:TDI:TSL -
That particular error went away with a new HA install 0.103.6. However, I continue to get data type and child unknown errors:
020-02-26 07:47:33 WARNING (MainThread) [mysensors] Not a valid message: Not valid message sub-type: 35 for dictionary value @ data['sub_type'] 2020-02-26 07:47:34 WARNING (MainThread) [mysensors] Child 0 is unknown 2020-02-26 07:48:05 WARNING (MainThread) [mysensors] Child 0 is unknown 2020-02-26 07:48:36 WARNING (MainThread) [mysensors] Child 0 is unknown 2020-02-26 07:49:07 WARNING (MainThread) [mysensors] Child 0 is unknown 2020-02-26 07:49:30 WARNING (MainThread) [mysensors] Not a valid message: Not valid message sub-type: 21 for dictionary value @ data['sub_type'] 2020-02-26 07:49:38 WARNING (MainThread) [mysensors] Child 0 is unknown 2020-02-26 07:50:09 WARNING (MainThread) [mysensors] Child 0 is unknownCorresponding serial monitor info:
5235 TSF:MSG:SEND,105-105-0-0,s=0,c=1,t=37,pt=4,l=4,sg=0,ft=0,st=OK:-2 5244 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255 5250 TSF:TDI:TSL 5252 MCO:SLP:WUP=-1 5253 TSF:TRI:TSB 10 0 10 10 0 10 0 0 0 0 4 0 0 0 0 0 -10 0 0 0 0 -1 resistance bias =5 sensor bias compensated value = 1 5307 TSF:MSG:SEND,105-105-0-0,s=0,c=1,t=37,pt=4,l=4,sg=0,ft=0,st=OK:1 5316 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255 5321 TSF:TDI:TSLHow have you configured MySensors in Home Assistant? I get the "not a valid message" error when I switch back to the old 1.4 protocol, which is still the default in HA.
So I suspect that you are using the old protcol version. Please have a look at your
configuration.yamland see if you specified the current version withversion: '2.0'or even 2.3. It should look something like this:mysensors: gateways: - device: mqtt persistence_file: '/config/mysensors.json' topic_in_prefix: 'mysensors-out' topic_out_prefix: 'mysensors-in' optimistic: false persistence: true retain: true version: '2.0'@Meach's issue might be down to an old HA version then, if an update fixed this particular error.
-
Yes!! That worked for me!
Thank you!