Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Controllers
  3. Home Assistant
  4. HA: moisture sensor ValueError: could not convert string to float: '2.1.1'

HA: moisture sensor ValueError: could not convert string to float: '2.1.1'

Scheduled Pinned Locked Moved Home Assistant
12 Posts 5 Posters 1.3k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M mrhutchinsonmn

    @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.

    S Offline
    S Offline
    sundberg84
    Hardware Contributor
    wrote on last edited by
    #3

    @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?

    Controller: Proxmox VM - Home Assistant
    MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
    MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
    RFLink GW - Arduino Mega + RFLink Shield, 433mhz

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrhutchinsonmn
      wrote on last edited by
      #4

      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
      
      1 Reply Last reply
      0
      • M Offline
        M Offline
        Meach
        wrote on last edited by
        #5

        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?

        BearWithBeardB 1 Reply Last reply
        0
        • M Meach

          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?

          BearWithBeardB Offline
          BearWithBeardB Offline
          BearWithBeard
          wrote on last edited by
          #6

          @Meach
          I guess there's only one way to find out: Add the S_MOISTURE definition on line 36 in sensors.py manually, 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_MOISTURE is 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).

          1 Reply Last reply
          0
          • BearWithBeardB Offline
            BearWithBeardB Offline
            BearWithBeard
            wrote on last edited by BearWithBeard
            #7

            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).

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mrhutchinsonmn
              wrote on last edited by
              #8

              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 unknown
              

              Corresponding 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
              
              BearWithBeardB 1 Reply Last reply
              0
              • M mrhutchinsonmn

                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 unknown
                

                Corresponding 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
                
                BearWithBeardB Offline
                BearWithBeardB Offline
                BearWithBeard
                wrote on last edited by BearWithBeard
                #9

                @mrhutchinsonmn

                How 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.yaml and see if you specified the current version with version: '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.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Meach
                  wrote on last edited by
                  #10

                  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 :)

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mrhutchinsonmn
                    wrote on last edited by
                    #11

                    Yes!! That worked for me!
                    Thank you!

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      moli
                      wrote on last edited by
                      #12

                      Worked for me too!! Using RPi Gateway.
                      Thank you

                      1 Reply Last reply
                      0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      14

                      Online

                      12.1k

                      Users

                      11.2k

                      Topics

                      113.4k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular