bouwew / sems2mqtt

GoodWe SEMS MQTT-componenent for Home Assistant
MIT License
10 stars 9 forks source link

Mqtt values dont match #15

Closed jonisnet closed 2 years ago

jonisnet commented 2 years ago

Hello,

It seems somewhere in the codes (dont know where) the givin values from sems2mqtt dont match MQTT requirements. Can you take a look for me.

2021-11-20 12:22:22 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_sensor_mqtt': ({'name': 'sems_battery_soh', 'unit_of_measurement': '%', 'value_template': '{{ value_json.battery_soh }}', 'icon': 'mdi:medical-bag', 'state_topic': 'sems/sensors', 'state_class': 'measurement', 'device_class': None, 'unique_id': 'sems_battery_soh_sensor', 'device': {'identifiers': 'Goodwe Inverter', 'name': 'GoodWe Inverter', 'model': 'GW3600D-NS', 'manufacturer': 'GoodWe'}, 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 198, in async_discover config = schema(discovery_payload) File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 218, in __call__ return self._exec((Schema(val) for val in self.validators), v) File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 341, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 337, in _exec v = func(v) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable return schema(data) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: value must be one of ['aqi', 'battery', 'carbon_dioxide', 'carbon_monoxide', 'current', 'date', 'energy', 'gas', 'humidity', 'illuminance', 'monetary', 'nitrogen_dioxide', 'nitrogen_monoxide', 'nitrous_oxide', 'ozone', 'pm1', 'pm10', 'pm25', 'power', 'power_factor', 'pressure', 'signal_strength', 'sulphur_dioxide', 'temperature', 'timestamp', 'volatile_organic_compounds', 'voltage'] for dictionary value @ data['device_class']

Greets Kees

bouwew commented 2 years ago

First a tip: put the all the copied error-text between 2 time 3 ` s:

Like this
And this
This too

Open my message with Edit to see what I mean.

bouwew commented 2 years ago

@jonisnet Can you please test version 0.4.5-beta0? Does that version work for you?

jonisnet commented 2 years ago

Thanks for the tip, will remember that next time.

Installed the beta, did a couple of restarts and seems to work for now. Will take a look again tommorow.

bouwew commented 2 years ago

Thanks for testing!

Issue is fixed: closing.