meltaxa / solariot

Leverage your IoT enabled Solar PV Inverter to stream your solar energy usage data to a real time dashboard.
https://solariot.live
MIT License
207 stars 70 forks source link

UTF-8 error #11

Closed crazycusti closed 4 years ago

crazycusti commented 4 years ago

SMA SB3.6-1AV-41 Firmware 3.0.7R + Python 2.7/3.7 (Debian 10 Buster)

Error:

Exception in thread Thread-4: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 754, in run self.target(*self.args, **self.__kwargs) File "solariot.py", line 177, in publish_influx target=flux_client.write_points([metrics]) File "/usr/local/lib/python2.7/dist-packages/influxdb/client.py", line 530, in write_points consistency=consistency) File "/usr/local/lib/python2.7/dist-packages/influxdb/client.py", line 598, in _write_points protocol=protocol File "/usr/local/lib/python2.7/dist-packages/influxdb/client.py", line 331, in write data = make_lines(data, precision).encode('utf-8') File "/usr/local/lib/python2.7/dist-packages/influxdb/line_protocol.py", line 158, in make_lines value = _escape_value(field_value) File "/usr/local/lib/python2.7/dist-packages/influxdb/line_protocol.py", line 94, in _escape_value value = _get_unicode(value) File "/usr/local/lib/python2.7/dist-packages/influxdb/line_protocol.py", line 109, in _get_unicode return data.decode('utf-8') File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 24: invalid start byte

my config:

inverter_ip = "192.168.178.21" inverter_port = 502

slave = 3 model = "sma-SBn_n-1AV-40" timeout = 3 scan_interval = 10

influxdb_ip = "**" influxdb_port = 8086 influxdb_user = "*" influxdb_password = "" influxdb_database = "inverter3" influxdb_ssl = False influxdb_verify_ssl = False

crazycusti commented 4 years ago

i commented out the useless data from modbus-sma-SBn_n-1AV-40.py

['30531 - Total yield (kWh)',30531,'U32','FIX0'], ['30533 - Total yield (MWh)',30533,'U32','FIX0'], ['30535 - Daily yield (Wh)',30535,'U32','FIX0'], ['30537 - Daily yield (kWh)',30537,'U32','FIX0'], ['30769 - DC current input [1] (A)',30769,'S32','FIX3'], ['30771 - DC voltage input [1] (V)',30771,'S32','FIX2'], ['30773 - DC power input [1] (W)',30773,'S32','FIX0'], ['30775 - Power (W)',30775,'S32','FIX0'], ['30783 - Grid voltage phase L1 (V)',30783,'U32','FIX2'], ['30953 - Internal temperature (C)',30953,'S32','TEMP'],

is enough for me.

work perfect with influxdb 1.x, python 3.7.x and a SMA SB3.6-1AV-41 Firmware 3.0.7R

:)

meltaxa commented 4 years ago

Looks like there are slight differences between models / versions and modbus maps. Good work on getting the data you need.