MQTT Generic Camera Discovery

I know there is already MQTT Camera discovery for a MQTT Camera (where a MQTT message contains the binary image of a frame) but it would be nice if a device could use MQTT Discovery to add a normal camera and take advantage of the generic camera’s supported camera sources.

My particular use case is so I could add my OctoPrint camera on the same device (and without yaml) as the rest of my mqtt octoprint sensors but i’m sure other things could use this functionality.

Should be possible. Do you have details of the MQTT message that would trigger camera discovery?

It could initiate the generic camera config flow populating some or all of the parameters.

Ya that is what I was thinking. It could use the same schema as the normal generic camera. From what I can tell that is how the existing mqtt discoveries have payloads structured too.

As a example this configuration

camera:
 - platform: mjpeg
   name: OctoPrint
   still_image_url: https://<my octoprint url>/webcam/?action=snapshot
   mjpeg_url: https://<my octoprint url>/webcam/?action=stream

could look like this

{
  "camera": 
  [
    {
      "platform": "mjpeg",
      "name": "OctoPrint",
      "still_image_url": "https://<my octoprint url>/webcam/?action=snapshot",
      "mjpeg_url": "https://<my octoprint url>/webcam/?action=stream"
    }
  ]
}

If someone has any other ideas that may work better/be easier to understand I am open to what works best.

Just to clear up any potential misunderstanding, MQTT discovery is triggered by the device. It sends a message to the broker that HA can look out for.

So to make an integration be automatically configurable in HA via MQTT you either need to:

  1. know an MQTT payload structure that devices are already sending,
    Or
  2. come up with a new payload structure and convince device developers to start using it.

In either case that could then be added to the HA generic camera integration manifest and code added to trigger assisted setup where the HA user is prompted with the discovered devices.

For this to work each device would need to be preconfigured to connect to your network’s MQTT broker in order for any of it to be seen by HA.

To be clear, the device initiates this discovery, not HA.

This seems like quite a long stretch, perhaps might be possible for esphome or octoprint cameras but much harder beyond that.

Onvif or zeroconf are much better options if you want to improve the user setup experience (they rely on broadcast messages not an MQTT broker).

By the time you factor in user device configuration of MQTT broker/username /password you are already in the realms of users with quite a high level of technical understanding, who for a similar level of effort could probably configure the camera directly.

Hope this helps.

I was looking exactly for the same thing, was there any change in the mqtt integration to support such things in the past 2 years?