Skip to main content

ONVIF smart home integration, free and open source

ONVIF integration for Gladys Assistant

ONVIF IP cameras on the local network: images, pan, tilt, zoom, presets and detections.

Bring your ONVIF IP cameras into Gladys, over your local network: Hikvision, Dahua, Amcrest, Reolink, TP-Link Tapo and VIGI, Axis, Foscam, Annke, Uniview, and most network video recorders. Gladys finds them, shows their image without you typing any stream address, turns and zooms the motorized ones, recalls their preset positions, and follows what they detect (motion, person, vehicle, animal, line crossing, intrusion, tampering), with a dashboard widget, a scene trigger and two scene actions. No cloud: Gladys talks to each camera directly.

Developed without the hardware: feedback welcome. This integration was built and tested against the Happytime ONVIF server (a complete software camera), against simulated cameras answering like Hikvision and TP-Link Tapo models, and against real event messages recorded by the onvif-parsers project, not against a real camera. If something does not work as described, please say so on the Gladys forum or in the issues.

What you need​

  • Gladys Assistant 5.1.0 or later.
  • Cameras on the same network as Gladys, with ONVIF turned on, and the user name and password of an ONVIF account. Where to find it:
    • TP-Link Tapo: in the Tapo app, camera settings, Advanced settings → Camera account: create a user name and a password (they are not your TP-Link account). ONVIF answers on port 2020.
    • Reolink: ONVIF is on by default on most models (port 8000); on recent firmware, check Settings → Network → Advanced → Server settings. Use a camera user.
    • Hikvision: in the web page of the camera, Configuration → Network → Advanced Settings → Integration Protocol: turn on Open Network Video Interface and add an ONVIF user there (it is a separate list of users).
    • Dahua, Amcrest: Setup → Network → Access Platform (or ONVIF): turn it on; the camera users work.
    • Other brands: look for "ONVIF" in the network settings.
  • For the detections: turn the detections on in the camera itself (motion, person, line crossing…). Some brands only report them over ONVIF when they are linked to an action, such as "Notify surveillance center" on Hikvision.

Set up​

  1. Install the integration from the Gladys catalog.
  2. Open its Configuration:
    • User name and Password: the ONVIF account of your cameras.
    • Camera addresses: only for the cameras not found automatically, separated by commas, with :port when ONVIF is not on port 80 (for example 192.168.1.20, 192.168.1.21:2020).
    • Other accounts (optional): if your cameras do not share one account, add up to two more. Each camera is tried with the accounts in order and keeps the one it accepts.
    • Image refresh: how often each camera image is sent to Gladys, from 10 seconds to 15 minutes (1 minute by default).
    • Movement length: how long a motorized camera turns or zooms for one tap, when no stop follows (1 second by default).
    • Language of the names: English, French, German or Spanish (French by default), for the names given to the features when a camera is added.
  3. Open the Discovery tab of the integration: the cameras appear, with their brand and model. Add the ones you want.
  4. The Search for cameras button of the Configuration looks again, tries the accounts again and reports what each camera offers (PTZ, presets, events), and which addresses refused the account.

A camera that refuses an account is not asked again with it until you change the accounts or run Search for cameras: many cameras lock an account after a few wrong passwords.

The Gladys devices​

One device per camera (a recorder or a camera with several lenses gives one device per video channel), named after its brand and model. Its features:

  • Image: the camera image, sent to Gladys at the chosen pace, plus a fresh one a few seconds after a detection or a movement. It shows in the Gladys camera widget, and the "Send a camera image" scene action takes a fresh one. Images are reduced to fit the 150 KB Gladys allows (1280 pixels wide at most).
  • Movement (PTZ), for motorized cameras: Left, Right, Up, Down, Zoom in, Zoom out, only those the camera can do. A movement lasts as long as you hold the button in Gladys, and stops by itself after the Movement length.
  • Preset position, for motorized cameras: the positions saved in the camera app, by their names. They are read again every 15 minutes and on each search: a new or renamed position appears by itself.
  • One sensor per detection the camera reports: Motion detection, Person detection, Vehicle detection, Animal detection, Line crossing, Intrusion detection (1 = detected) and Tampering. A detection the camera only reports later is added then: Gladys offers to update the device in the Discovery tab.

Dashboard widget​

ONVIF camera: the camera image with the time it was taken, what the camera detects right now, and up to four buttons. Its settings:

  • Camera: the camera to show.
  • Buttons: Left, up, down, right (by default), Zoom and two presets, Four presets or No button. A tap moves the camera for the movement length, or to the position, and the widget comes back with the new view.
  • Preset buttons: the names of the positions to show, separated by commas; empty for the first ones.

Scenes​

Trigger​

ONVIF camera detection: a camera starts detecting something. Filters: Camera and Detection: Motion, Person, Vehicle, Animal, Line crossing, Intrusion, Tampering, Sound, Doorbell pressed (for instance the button of a Reolink doorbell). Leave a filter empty for all. Variables: the detection (motion, person…) and the name of the camera rule that fired, when it gives one. One event per start of a detection, never one per second.

Actions​

  • Move a camera to a preset: turns the camera to one of its preset positions, given by its name (as in the camera app) or its number. Output: the position reached.
  • Move a camera: turns or zooms the camera in one direction (Left, Right, Up, Down, Zoom in, Zoom out) for 1 to 10 seconds, then stops it.

To get a picture in a message, use the Gladys Send a camera image action: it asks the integration for a fresh image.

Scene ideas​

  • At night, when the garden camera detects a person, send its image to your phone, and turn the outdoor lights on.
  • When everybody leaves home, turn the living room camera to its "Door" preset; when the first person comes back, turn it to the "Wall" preset.
  • When the Reolink doorbell is pressed, send its image and announce "Someone at the door" on the speakers.

Troubleshooting​

  • No camera in the Discovery tab: check that ONVIF is on, then run Search for cameras. Some cameras only answer the discovery on the multicast address, which Gladys cannot use from its sandbox: type their address in Camera addresses (with :2020 for Tapo, :8000 for Reolink).
  • "Account refused": the ONVIF user is often a separate account (Tapo camera account, Hikvision ONVIF user). Check it, save the configuration, then run Search for cameras.
  • No image: the integration first uses the snapshot address of the camera, then a frame of its video stream (RTSP); both need the account.
  • No detection: turn the detection on in the camera, and for Hikvision link it to "Notify surveillance center". The camera must support ONVIF event subscriptions (PullPoint): Search for cameras says "events" when it does.
  • The camera moves too far, or not enough: change Movement length.
  • The integration logs say more: Integrations → ONVIF → Logs.

Limits​

  • Images, not video: one image every 10 seconds at best (Gladys takes 12 a minute per camera), reduced to 1280 pixels wide.
  • Events are read by the integration from the camera (it cannot receive them from the camera inside its sandbox), so a detection reaches Gladys within a second or two.
  • One movement at a time, at half speed. Presets are recalled, not created: save them in the camera app.
  • Cameras speaking only the newer ONVIF media service (Profile T without Profile S) are not supported yet.
  • Sound and doorbell are scene triggers only, without a sensor.
  • Developed without a real camera (see above): feedback welcome.

Configuration settings​

These are the settings ONVIF asks for in its configuration screen in Gladys.

SettingTypeRequiredDescription
Your camerassectionNoTurn ONVIF on in each camera (in its app or web page, often with a dedicated user), then enter that account below. Cameras on the same network as Gladys are found automatically: open the Discovery tab.
User namestringNoThe ONVIF account of the cameras (Tapo: the camera account created in the Tapo app).
PasswordsecretNo
Camera addressesstringNoOptional, separated by commas: only for the cameras not found automatically. Add :port when ONVIF is not on port 80 (Tapo: 2020, Reolink: 8000).
Other accounts (optional)sectionNoIf your cameras do not share one account, add up to two more. Each camera is tried with the accounts in order and keeps the one it accepts; an account it refused is not tried again until you change the accounts or run a search.
Second user namestringNo
Second passwordsecretNo
Third user namestringNo
Third passwordsecretNo
OptionssectionNo
Image refreshselectNoHow often each camera image is sent to Gladys. A detection or a movement also sends a new one.
Movement lengthselectNoHow long the camera turns or zooms for one tap, a widget button or a scene, when no stop follows.
Language of the namesselectNoNames given to the features when a camera is added (Image, Motion detection, Left…).

How to install ONVIF in Gladys​

  1. In Gladys, open Integrations: ONVIF appears in the catalog, next to the native integrations, with a community badge.
  2. Click Install. Gladys pulls the Docker image (ghcr.io/guim31/gladys-onvif:1.0.1), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration).
  3. Open the Configuration screen of the integration, fill in the settings, and save.
  4. You can also install it directly from its repository URL: https://github.com/guim31/gladys-onvif.

ONVIF requires Gladys >=5.1.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.

Not running Gladys yet? It is free and open source: follow the installation guide to get started.

About external integrations​

ONVIF is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by guim31, not by the Gladys core team.

Subscribe to the Gladys Assistant newsletter

A few emails per month about new releases and project news. Sent by Pierre-Gilles Leymarie, founder of the project. Unsubscribe anytime 🙂