mKeRix / room-assistant

Presence tracking and more for automation on the room-level
https://www.room-assistant.io
MIT License
1.28k stars 122 forks source link

Home Assistant unable to auto-discover two specific sensors. #304

Closed frdbonif closed 4 years ago

frdbonif commented 4 years ago

Describe the bug Home Assistant produces an error in the log when trying to add sensors through MQTT autodiscovery from a Room Assistant sensor.

To reproduce Add MiFlora device to Room Assistant.

Relevant logs Log output that correlates to the bug. You can get debug output with room-assistant -v. No relevent logs from Room Assistant, the error message from Home Assistant is posted.

Exception in async_discover_sensor when dispatching 'mqtt_discovery_new_sensor_mqtt': ({'payload_available': 'online', 'payload_not_available': 'offline', 'name': 'kitchenPlant moisture', 'device': {'sw_version': '2.9.1', 'identifiers': '0000000007c84ac9', 'name': 'Kitchen', 'model': 'BCM2835 - Pi 3 Model B', 'manufacturer': 'Raspberry Pi Foundation'}, 'unique_id': 'room-assistant-kitchen-kitchenplant-moisture', 'state_topic': 'room-assistant/sensor/kitchen-kitchenplant-moisture/state', 'json_attributes_topic': 'room-assistant/sensor/kitchen-kitchenplant-moisture/attributes', 'availability_topic': 'room-assistant/sensor/kitchen-kitchenplant-moisture/status', 'device_class': 'moisture', 'unit_of_measurement': '%', 'platform': 'mqtt'},) Traceback (most recent call last): File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/mqtt/sensor.py", line 83, in async_discover_sensor config = PLATFORM_SCHEMA(discovery_payload) File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: value is not allowed for dictionary value @ data['device_class'] 
Exception in async_discover_sensor when dispatching 'mqtt_discovery_new_sensor_mqtt': ({'payload_available': 'online', 'payload_not_available': 'offline', 'name': 'kitchenPlant fertility', 'device': {'sw_version': '2.9.1', 'identifiers': '0000000007c84ac9', 'name': 'Kitchen', 'model': 'BCM2835 - Pi 3 Model B', 'manufacturer': 'Raspberry Pi Foundation'}, 'unique_id': 'room-assistant-kitchen-kitchenplant-fertility', 'state_topic': 'room-assistant/sensor/kitchen-kitchenplant-fertility/state', 'json_attributes_topic': 'room-assistant/sensor/kitchen-kitchenplant-fertility/attributes', 'availability_topic': 'room-assistant/sensor/kitchen-kitchenplant-fertility/status', 'device_class': 'fertility', 'unit_of_measurement': '', 'platform': 'mqtt'},) Traceback (most recent call last): File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/mqtt/sensor.py", line 83, in async_discover_sensor config = PLATFORM_SCHEMA(discovery_payload) File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: value is not allowed for dictionary value @ data['device_class'] 

Expected behavior A clear and concise description of what you expected to happen.

Environment

Additional context Also posted on Home Assistant Forum. (https://community.home-assistant.io/t/exception-with-mqtt-autodiscovery/235647) The Illiminance and Temperature sensor from the same MiFlora device are correctly discovered and added to Home Asssistant. I'm not sure if this is a Home Assistant fault but I suspect room-assistant because other sensors are available as expected in Home Assistant.

mKeRix commented 4 years ago

Yep, that looks like a small issue in the discovery information that room-assistant sends for these two specific sensors. Thanks for reporting complete with the HA logs! I'll try to fix this ASAP.

github-actions[bot] commented 4 years ago

:tada: This issue has been resolved in version 2.11.0-beta.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 4 years ago

:tada: This issue has been resolved in version 2.10.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 4 years ago

:tada: This issue has been resolved in version 2.11.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: