home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.15k stars 29.83k forks source link

Announcing Number Entity via MQTT no longer works: expected NumberDeviceClass or one of 'temperature' for dictionary value @ data['device_class'] #74879

Closed ejohb closed 2 years ago

ejohb commented 2 years ago

The problem

Announcing Number entities used to work but now fails.

Announce message:

2022-07-10 12:07:57 INFO  amniotic.tools   : Queue: publish:homeassistant/number/development_amniotic_master_volume/config>
{
   "name":"Development Amniotic Master Volume",
   "unique_id":"development_amniotic_master_volume",
   "object_id":"development_amniotic_master_volume",
   "device":{
      "connections":[
         [
            "mac",
            "development-amniotic-00155d216ca5"
         ]
      ],
      "sw_version":"0.3.9",
      "name":"Development Amniotic",
      "model":"Amniotic",
      "manufacturer":"Frontmatter",
      "identifiers":"development-amniotic-00155d216ca5"
   },
   "device_class":"number",
   "force_update":true,
   "payload_available":"Online",
   "payload_not_available":"Offline",
   "availability_topic":"tele/development/amniotic/LWT",
   "state_topic":"stat/development/amniotic/master/volume/state",
   "command_topic":"stat/development/amniotic/master/volume/command",
   "icon":"mdi:volume-high",
   "min":0,
   "max":100
}

Error in log:

Exception in async_discover when dispatching 'mqtt_discovery_new_number_mqtt': ({'name': 'Bedroom Amniotic Master Volume', 'unique_id': 'bedroom_amniotic_master_volume', 'object_id': 'bedroom_amniotic_master_volume', 'device': {'connections': [['mac', 'bedroom-amniotic-dca632f63093']], 'sw_version': '0.3.9', 'name': 'Bedroom Amniotic', 'model': 'Amniotic', 'manufacturer': 'Frontmatter', 'identifiers': 'bedroom-amniotic-dca632f63093'}, 'device_class': 'number', 'force_update': True, 'payload_available': 'Online', 'payload_not_available': 'Offline', 'availability_topic': 'tele/bedroom/amniotic/LWT', 'state_topic': 'stat/bedroom/amniotic/master/volume/state', 'command_topic': 'stat/bedroom/amniotic/master/volume/command', 'icon': 'mdi:volume-high', 'min': 0, 'max': 100, 'platform': 'mqtt'},)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 309, in async_discover config = schema(discovery_payload)
File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 232, in __call__ return self._exec((Schema(val) for val in self.validators), v)
File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 355, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path)
File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 351, in _exec v = func(v)
File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 818, in validate_callable return schema(data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: expected NumberDeviceClass or one of 'temperature' for dictionary value @ data['device_class']

What version of Home Assistant Core has the issue?

2022.7.2

What was the last working version of Home Assistant Core?

2022.6.x

What type of installation are you running?

Home Assistant Container

Integration causing the issue

https://github.com/fmtr/amniotic

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

Hey there @emontnemery, mind taking a look at this issue as it has been labeled with an integration (mqtt) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


mqtt documentation mqtt source (message by IssueLinks)

emontnemery commented 2 years ago

The discovery message is incorrect, please refer to https://github.com/home-assistant/core/issues/74533 for details