Saltar al contenido principal

Integración domótica MJPEG & snapshot cameras, gratuita y de código abierto

Integración MJPEG & snapshot cameras para Gladys Assistant

ESP32-CAM, MJPEG and JPEG snapshot IP cameras of your network in Gladys, without RTSP.

info

La documentación de esta integración la escribe su autor y, por ahora, solo está disponible en inglés.

Brings the cameras that speak plain HTTP into Gladys: an ESP32-CAM, an older IP camera, a webcam served by motion, motionEye or mjpg-streamer. Two kinds of address work: a JPEG snapshot URL and an MJPEG stream (multipart/x-mixed-replace). No ffmpeg, no RTSP, nothing in the cloud: everything stays on your local network.

For an RTSP camera, use the RTSP camera integration built into Gladys instead: this one is the light path for the cameras that only offer HTTP. Not affiliated with any camera maker; the brand names below only identify compatible products.

What you get​

SurfaceContent
DeviceOne camera device per address, with its image on the dashboard camera widget
Live viewA fresh image each time Gladys asks for one (live view, "show me the camera", the "send a camera image" action)
Scene triggersCamera offline (3 failed captures in a row) and Camera back online
Settings buttonTest cameras: one image of each camera, with its kind, resolution, size and time, or the error
Device badge"Local" while the camera answers, "Unreachable" once offline, an orange dot when its images must be downscaled

Setup​

Type the addresses in Cameras, separated by commas. Each address may be followed by a name, after a space or a |:

http://192.168.1.50:81/stream Garden, http://192.168.1.20/cgi-bin/snapshot.cgi|Front door

Then open Discovery and add the cameras. Only the cameras you add are read. Press Test cameras to check each address.

Common addresses (check the documentation of your camera; <ip> is its address on your network):

CameraSnapshotStream
ESP32-CAM ("CameraWebServer" sketch)http://<ip>/capturehttp://<ip>:81/stream
mjpg-streamerhttp://<ip>:8080/?action=snapshothttp://<ip>:8080/?action=stream
motionEyehttp://<ip>:8765/picture/1/current/http://<ip>:8081/
motion-http://<ip>:8081/
Many IP cameras (Dahua, Amcrest…)http://<ip>/cgi-bin/snapshot.cgi-
Hikvisionhttp://<ip>/ISAPI/Streaming/channels/101/picture-
Axishttp://<ip>/axis-cgi/jpg/image.cgihttp://<ip>/axis-cgi/mjpg/video.cgi
"IP Webcam" Android apphttp://<ip>:8080/shot.jpghttp://<ip>:8080/video

A snapshot address is the lightest choice when the camera offers one. An ESP32-CAM serves its stream to one client at a time: while a browser watches :81/stream, Gladys waits; /capture avoids that.

Passwords​

  • Type them in the address: http://user:[email protected]/…. A special character of the password is written in percent-encoding (@ is %40, a comma %2C).
  • Or type only the user name in the address (http://[email protected]/…) and the password in Camera password: it stays hidden in the configuration screen, unlike a password typed in the address.
  • Basic and Digest (MD5, SHA-256) authentication are supported. The password is never sent before the camera asks for it, it is never sent in clear text to a camera that offers Digest, and it goes to that camera only (never to another address it redirects to, except the same camera over https).
  • An address carrying a token in its query (?user=…&pwd=…) works too: the logs and the statuses never show an address, only the camera name and host.
  • An https camera with a self-signed certificate needs Accept self-signed certificates.

Images and pace​

  • Every camera added sends an image to Gladys every 10 seconds by default (Image refresh, 5 seconds at least: Gladys takes 12 images a minute per camera; 0 for on demand only). The live view and the scenes get a fresh image whatever this setting.
  • Gladys takes images of 150 KB at most. A bigger image is downscaled (halved until it fits) inside the integration, which costs CPU: such a camera is then refreshed every 30 seconds at most, and the status and the device badge say so. Set a lower resolution on the camera instead: VGA (640×480) or SVGA (800×600) with a JPEG quality around 12 on an ESP32-CAM.
  • An image is read once per camera at a time, whoever asks: the periodic image, the live view and the test button share it.
  • An MJPEG stream is never watched continuously: the integration takes its first image, then closes the connection.

Scenes​

  • Camera offline: a camera that was sending images failed 3 captures in a row. Variables: name, error, failures.
  • Camera back online: the same camera sends images again. Variables: name, offline_minutes.

Both have an optional Camera filter (empty: any camera). They come in pairs: a camera that is already down when the integration starts announces nothing, and its return is not announced either. An offline camera is tried again every minute.

To send an image in a message, use the "send a camera image" action of Gladys with one of these cameras.

Status messages and errors​

MessageMeaning
no image within 10 sThe camera does not answer (address, power, an ESP32-CAM busy with a browser)
the camera asks for a user name and passwordAdd them to the address (see Passwords)
user name or password refusedWrong credentials
not a JPEG image (text/html)The address shows a web page (a login page, the camera's home page): fix the path
certificate not trustedAn https camera with a self-signed certificate: see Passwords
TLS handshake failedAn old https camera (TLS 1.0 or 1.1): use its http address
frame over 4 MB or too big to downscale hereLower the camera resolution

Privacy​

Nothing leaves your network and nothing is written on disk: the images go to your Gladys only. The configuration keeps the addresses; the camera devices only show the host of each camera.

Parámetros de configuración​

Estos son los parámetros que MJPEG & snapshot cameras te pide en su pantalla de configuración en Gladys.

ParámetroTipoObligatorioDescripción
Cameras without RTSPsectionNoFor the cameras that speak plain HTTP: an ESP32-CAM, an older IP camera, a webcam behind motion, motionEye or mjpg-streamer. Each address below becomes a camera in Discovery; its image reaches the dashboard every few seconds and whenever you open the live view. Both kinds of address work: a JPEG snapshot URL and an MJPEG stream (the first frame is taken, then the connection is closed). Everything stays on your local network, no ffmpeg. For an RTSP camera, use the RTSP camera integration built into Gladys instead. Not affiliated with any camera maker.
CamerasstringNoAddresses separated by commas, each followed by an optional name after a space or |. A password can go in the address (http://user:password@…, Basic or Digest), or only the user name, with the password in the field below.
Camera password (optional)secretNoUsed for the addresses that carry a user name without a password (http://[email protected]/…): it stays hidden here, unlike a password typed in the address.
Image refresh (seconds)numberNoHow often each camera's image is sent to Gladys: 5 at least (Gladys takes 12 images a minute per camera), 0 for on demand only (the live view and the scenes still get a fresh image).
Accept self-signed certificates (https cameras of your network)booleanNo

Cómo instalar MJPEG & snapshot cameras en Gladys​

  1. En Gladys, abre Integraciones: MJPEG & snapshot cameras aparece en el catálogo junto a las integraciones nativas, con una insignia de comunidad.
  2. Haz clic en Instalar. Gladys descarga la imagen Docker (ghcr.io/lm1lc3n7/gladys-mjpeg-camera:0.1.1), la ejecuta en un entorno aislado del núcleo y genera la interfaz de la integración (dispositivos, descubrimiento y configuración).
  3. Abre la pantalla de Configuración de la integración, rellena los parámetros y guarda.
  4. También puedes instalarla directamente desde la URL de su repositorio: https://github.com/LM1LC3N7/gladys-mjpeg-camera.

MJPEG & snapshot cameras requiere Gladys >=5.1.0. El catálogo de Gladys se actualiza cada hora, así que una nueva versión está disponible como máximo una hora después de publicarse.

¿Todavía no usas Gladys? Es gratuito y de código abierto: sigue la guía de instalación para empezar.

Sobre las integraciones externas​

MJPEG & snapshot cameras es una integración externa: una integración comunitaria empaquetada como contenedor Docker y publicada en GitHub. Gladys la instala con un clic y la ejecuta en un entorno aislado del núcleo. La publica y mantiene LM1LC3N7, no el equipo principal de Gladys.

Suscríbete a la newsletter de Gladys Assistant

Unos pocos correos al mes sobre nuevas versiones y novedades del proyecto. Enviados por Pierre-Gilles Leymarie, fundador del proyecto. Puedes darte de baja cuando quieras 🙂