reinhard-brandstaedter / solarflow-statuspage

A simple statuspage with live-data from Zendure's Solarflow Hub for those who do not want to use the App
23 stars 6 forks source link

Stops Working if homeUsage is float #33

Closed ricariel closed 7 months ago

ricariel commented 10 months ago

When hichi ir is configured to send float values. Statuspage stops working.

2023-11-08T10:37:00.443444269Z 2023-11-08 11:37:00,443:ERROR: Error converting payload to int: 47.0
2023-11-08T10:37:00.443489437Z Exception in thread Thread-1 (_thread_main):
2023-11-08T10:37:00.443513969Z Traceback (most recent call last):
2023-11-08T10:37:00.443518326Z   File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
2023-11-08T10:37:00.443838639Z     self.run()
2023-11-08T10:37:00.443850696Z   File "/usr/local/lib/python3.10/threading.py", line 953, in run
2023-11-08T10:37:00.444134705Z     self._target(*self._args, **self._kwargs)
2023-11-08T10:37:00.444149970Z   File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3591, in _thread_main
2023-11-08T10:37:00.445014943Z     self.loop_forever(retry_first_connection=True)
2023-11-08T10:37:00.445028277Z   File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 1756, in loop_forever
2023-11-08T10:37:00.445514364Z     rc = self._loop(timeout)
2023-11-08T10:37:00.445528738Z   File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 1164, in _loop
2023-11-08T10:37:00.445947187Z     rc = self.loop_read()
2023-11-08T10:37:00.445960129Z   File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 1556, in loop_read
2023-11-08T10:37:00.446346464Z     rc = self._packet_read()
2023-11-08T10:37:00.446355853Z   File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 2439, in _packet_read
2023-11-08T10:37:00.446815436Z     rc = self._packet_handle()
2023-11-08T10:37:00.446825932Z   File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle
2023-11-08T10:37:00.447400419Z     return self._handle_publish()
2023-11-08T10:37:00.447427521Z   File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3327, in _handle_publish
2023-11-08T10:37:00.448239169Z     self._handle_on_message(message)
2023-11-08T10:37:00.448282176Z   File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message
2023-11-08T10:37:00.449174523Z     on_message(self, self._userdata, message)
2023-11-08T10:37:00.449203506Z   File "//solarflow-status.py", line 190, in on_local_message
2023-11-08T10:37:00.449312997Z     socketio.emit('updateSensorData', {'metric': 'homeUsage', 'value': int(payload), 'date': round(time.time()*1000)})
2023-11-08T10:37:00.449323513Z ValueError: invalid literal for int() with base 10: '47.0'
reinhard-brandstaedter commented 10 months ago

Fixed in release 0.16: https://github.com/reinhard-brandstaedter/solarflow-statuspage/releases/tag/0.16