martenjacobs / py-otgw-mqtt

Python OTGW MQTT bridge
MIT License
9 stars 16 forks source link

Issue with float #15

Closed andriej closed 5 years ago

andriej commented 5 years ago

Yesterday I've moved to TCP branch and after few hours of working properly now I've got errors in syslog. Read from bottom to top as it's how I get it reported:

python[5652]: ValueError: could not convert string to float: unavailable
python[5652]:     lambda _ :"OT={:.2f}".format(float(_)),
python[5652]:   File "/usr/lib/py-otgw-mqtt/__main__.py", line 66, in 
python[5652]:     command = command_generator(msg.payload)
python[5652]:   File "/usr/lib/py-otgw-mqtt/__main__.py", line 79, in on_mqtt_message
python[5652]:     self.on_message(self, self._userdata, message)
python[5652]:   File "./paho/mqtt/client.py", line 2647, in _handle_on_message
python[5652]:     self._handle_on_message(message)
python[5652]:   File "./paho/mqtt/client.py", line 2500, in _handle_publish
python[5652]:     return self._handle_publish()
python[5652]:   File "./paho/mqtt/client.py", line 2305, in _packet_handle
python[5652]:     rc = self._packet_handle()
python[5652]:   File "./paho/mqtt/client.py", line 1849, in _packet_read
python[5652]:     rc = self._packet_read()
python[5652]:   File "./paho/mqtt/client.py", line 1284, in loop_read
python[5652]:     rc = self.loop_read(max_packets)
python[5652]:   File "./paho/mqtt/client.py", line 1003, in loop
python[5652]:     rc = self.loop(timeout, max_packets)
python[5652]:   File "./paho/mqtt/client.py", line 1481, in loop_forever
python[5652]:     self.loop_forever(retry_first_connection=True)
python[5652]:   File "./paho/mqtt/client.py", line 2650, in _thread_main
python[5652]:     self.__target(*self.__args, **self.__kwargs)
python[5652]:   File "/usr/lib/python2.7/threading.py", line 754, in run
python[5652]:     self.run()
python[5652]:   File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
python[5652]: Traceback (most recent call last):
python[5652]: Exception in thread Thread-1:
python[5652]: INFO:__main__:Connected with result code 0
python[5652]: INFO:__main__:Running
python[5652]: INFO:__main__:Initializing OTGW
python[5652]: INFO:__main__:Initializing MQTT
martenjacobs commented 5 years ago

This error seems to occur due to ‘unavailable’ being published to the outside temperature topic. This is likely due to your temperature sensor being unavailable and your home assistant configuration not handling this correctly (i.e. you should make sure only numbers are published to this topic)