Using new mqtt camera yaml

RECEntly, I noticed that defining the platform mqtt under the camera yaml entry has been deprecated and the camera is now under mqtt.

I had 2 such cameras. To fix this, and also to help identify yaml issues, I put all my mqtt settings in a separate yaml and included this in configuration.yaml. (NB I did also try the code just in confiuration.yaml but want to continue with having mqtt separate if possible).

Configuration.yaml:

mqtt: !include mqtt.yaml

mqtt.yaml:

discovery: true
discovery_prefix: homeassistant
broker: core-mosquitto
username: !secret mosquitto_username
password: !secret mosquitto_password
birth_message:
  topic: 'hass/status'
  payload: 'online'
will_message:
  topic: 'hass/status'
  payload: 'offline'
camera:
  - topic: homeassistant/SideGate/motion/snapshot/image
    name: Sidegate Motion
  - topic: homeassistant/BirdCam/motion/snapshot/image
    name: Birdcam Motion

This results in the following configuration error:

Invalid config for [mqtt]: [camera] is an invalid option for [mqtt]. Check: mqtt->mqtt->camera. (See /config/configuration.yaml, line 200).

The same error occurs if I have all the code in configuration.yaml.

The example I have seen is:

# Example configuration.yaml entry
mqtt:
  camera:
    - topic: zanzito/shared_locations/my-device

I believe mine looks the same format but have clearly misunderstood something. Can someone help please?

Same error here, had any luck ?

I have it under configuration.yaml, but Iā€™m using the MQTT add on, might be a conflict.

mqtt:
  camera:
    - topic: mytopic/some/thing
      name: Alert
      unique_id: camera.alert
      encoding: b64

EDIT:

After updating Core and Operation system, it works.

I just went in circles trying to figure it out and took way to long to just go back and review the docs.
image_encoding is what I had to use.

mqtt:
  camera:
    - topic: mytopic/some/thing
      name: Alert
      unique_id: camera.alert
      image_encoding: b64
1 Like

Yup, just finished running around in those same circles, specifically image_encoding: b64 is the current syntax required.