Wifi camera MQTT Discovery device attributes

Hello everyone, i’ve been lurking for a while and now it’s time to post a question :slight_smile:

I’m working on a device that will have an onboard camera and a bunch of other sensors/actuators. I am planning to use mqtt as communication protocol, and mqtt discovery to interface with HA. My intention is to send multiple discovery packets having the same “device” object, as supposedly supported based on the docs.

I started testing it with mosquitto, sending discovery messages for the camera, but i haven’t been able to register the new device. The issue i got is due to HA not recognizing “device” object in the JSON payload.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/camera.py", line 47, in async_discover
    config = PLATFORM_SCHEMA(discovery_payload)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 267, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 589, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 427, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['device']

I experimented with other kind of device type (like binary_sensor) and all went well at the very first try.

I doubt it is due to sintax of the packet, especially after seeing the log in this topic from the Xiaomi IP cam:
https://community.home-assistant.io/t/mqtt-auto-discovery-not-working/112251

in the mentioned log, each entity has a discovery paylod containing the “device” object, except for the camera one.

Is this a bug or i’m missing something?
I’m using 0.97.2 and i can post the discovery payloads if needed.

Thanks,
D