I have created an app that supports ONVIF compatible video cameras. The cameras must support the following requirements:
- S and T profiles of the ONVIF specification,
- Provide a snapshot URL to obtain a JPEG snapshot,
- Support Pull points for motion capabilities. (version 0.0.22 adds WS_BasicEvents, also known as Push points, but is not fully tested).
The main differences between this app and the Homey IP camera support are discovery and motion detection.
There are two snapshot views for each camera, the ‘live’ image and one at the point that the last motion was detected (or delayed by a user specified amount after the motion detection). Motion will also generate a trigger for flows and both snapshots are available as tags to be used with other action cards. That allows you to send the image to your phone, etc.
I will attempt to publish it so just need to see if Athom will allow it.
The app is now live. The release version is here:
Sometimes there may be a test version available here:
Not all cameras support motion detection via ONVIF, even if they have motion detection capabilities. Sometimes this is because the manufacture does the motion detection offline rather than in the actual camera. Other times it is just because they have not implemented the Pull Points part of the specification.
Cameras known to be test so far:
- H.View HV-E800
- Unbranded HI3516EV200
- FOSCAM FI9900EP V5 (does not support motion detection via ONVIF)
- DBPOWER hd Cam: Chinese cheap outdoor cam full HD, already included in Homey, immediately recognise and working with your app, I did not test the motion alarm yet
- IMOU IPCG22: new full HD outdoor cam, already included in Homey, IP recognise but it returns the following error - Cannot read property ‘width’ of undefined
- EBITCAM F220: outdoor full HD cam, IP not recognised - I’m sure this cam needs a token to grab a snapshot so it may be not usable with your app
- Dahua DH-SD22204t-GN-W and Dahua HDBW1320E are working with version 0.0.22.
- Neo CoolCam NIP-55 working
- HiKam S6 does not have a still image URL so not possible to show either image in Homey.
- Chinese unbranded DG-MYQ, motion works but no image URL.
- Eminent EM6330 cameras are working but No ONVIF motion detection.
- Milesight 360 panoramatic
- Imou Ranger iq (IPC‑A26HIP) fully working
- Imou Looc (IPC-C26E) fully working
- Imou New Bullet (IPC-G26E) fully working
- Reolink RLC-410W fully working
- Reolink RLC-520 fully working
- HikVision DS-2CD2183G0-I
- Imou bullet lite, not detected.
- Imou cue 2, no snapshot or motion.
- TP-Link C100, no snapshot.
If you have experience with other cameras that either fully work, partially work, or don’t work please reply to this topic with the details and I will update the list.
**To add a camera, ** use the standard add device method of Homey.
During the process, the app should discover all the ONVIF cameras on you LAN and present the list to you. This can take about 15 seconds so please be patient.
Version 1.1.18 and later add an entry on the end which is an option to manually add a camera by specifying the IP and port required to connect.
Once the list is displayed you can select one camera to add and then tap Next. You will see the screen to enter the camera login credentials (note some cameras have different credentials for ONVIF and standard access). If you chose the manual entry, then you also enter the IP and port number. Once you have entered the details, select Next. The app will try to login to the camera to verify the credentials and if all goes well the camera will be added.
If the ‘Camera’ is actually an NVR that supports multiple cameras by channel number, you will see an extra list of cameras connected to the NVR. You can then select which of these cameras are added to Homey.
If you have any issues, then the app has a Diagnostics Log feature that can be switched on in the Apps - Configure app section:
Switch the logging on by ticking the LOG ENABLED option. The setting is remembered through app restarts so it can be used to log the complete start up process.
The log is limited to 30kB at which point it will remove the first 5kB to make space for more information.
Note: Logging will add extra load to Homey so it is recommended not to keep it switched on all the time.
You can clear the log if required by taping on Clear Log and you can send the log to me by taping on Send Log. You will see a confirmation message before sending the log. Only the information in the log window is sent and there is no identifiable information included so if you are reporting a problem then please contact me either on here, via a PM or on GitHub to follow up on the problem.
The app looks like this:
Image from the last motion event (drop list set to MOTION EVENT)
Image from last snapshot (drop list set to SNAPSHOT).
This can be refreshed at any time by pressing the round arrows below the image.
It is possible to enable / disable the motion detection here (the image shows motion detection switched off): When the motion is switched off, the trigger will not activate, and the image will not update unless you use a flow card action.
You can view the current state of the alarms, etc:
The OFFLINE alarm is triggered if the app has recently lost communication with the camera. It can take up to 30 seconds to detect. After about 1 to 2 minutes the app shows ‘Not Available’.
This could mean the camera has been disconnected or the IP address has changed. If the IP address has changed you can use the Repair option to redetect the camera or change it manually in the advanced settings (see below).
The CAMERA TIME is the time reported by the camera. However, the Event times are taken from Homey.
Taping on the cog (top right of the images) takes you to the settings screen:
Here are the standard Name and Zone settings plus you can open the Advanced settings:
The Username and Password are the credentials required to log into the camera via ONVIF. Check your camera settings to make sure this has been setup.
Camera Enabled: You can temporarily disable a camera if required. This will halt the online / tamper checks, etc. If you are going to disconnected a camera for any length of time then it will save some processing time if you disable it. Also if you have a problem camera that you want to capture logs for, disabling all the other cameras can reduce the amount of ‘noise’ in the logs and make it easier to debug.
Device Class: If the class is set to Sensor then you will see the red triangle in the tile when motion is detected. If you set it to Camera then it is possible to configure some dashboards to show the camera image on the main display.
Single: when set, this option determines if just one snapshot per new trigger is captured, e.g., the trigger must be cleared by the camera before another image is captured. if it is not set then an image is captured each time a new motion event is triggered even if the last one is still active.
Delay: this is the time before the image is captured after the trigger is enabled. Some cameras are overly sensitive and will trigger before the person has fully entered the image, in which case you might only get the edge of them.
Channel: If the IP is an NVR that supports multiple cameras on channels, this field shows the channel number of the camera and can be changed. Set to -1 to prevent the channel number being changed if it is not an NVR.
Token: If the IP is for an NVR that supports multiple cameras on channels, the event notification will include a Token to identify which camera has sent the notification. This should be filled in during the pairing process, but can be changed or set if required.
Prefer Pull Events: When a camera supports both Pull and Push events, the app will use Push events by default. Switch this option is on to override that and force the app to use Pull events. Push events are more efficient then Pull events but there may be times that they won’t work, such as on different VLANS.
Time format: allows you to choose from a few options for the time and date shown on the alarms view. The default is Short HH:MM DD-MM which is a format that fits the space provided by the view on most phones.
The last section mainly shows information about the camera provided during pairing, but there are a few options that can be changed:
USER Snapshot URL: If you enter a URL in this field, it will override the one returned by the camera.
ONVIF Motion Notification to use: Some cameras support multiple notification events. They are listed in the field above this entry. Even though a particular type is supported, it might not be enabled in the camera, plus some types are more reliable than others. If you are not getting notified for motion then try selecting a different option here. If you are getting false notifications, e.g. events when the light changes or a bush moves in the wind, then try selecting a different option.
Event Object ID: For cameras that support regions of face recognition, etc, they might send an Object ID to identify the region or face. If this field is empty then any ID will generate an event. If an ID is specified then it must match the ID sent in the event notification. You can specify multiple ID’s by separating them with a comma, in which case an event will be generated if any one of the specified ID’s is received.
The Maintenance screen has an option to set the cameras time to the same as Homey and an option to run the repair routine:
Motion image is ready within… flow condition
This Condition card can be added to the AND section of the flows. It allows you to wait for the image to be capture before running the Action cards.
So, to use it you would first trigger the motion capture with the relevant Action card in a flow. This might be in response to an external motion sensor for example. Then in another flow that is triggered by, say, the doorbell button press for example, you would add this card to the And section to make sure the image is ready to send to your phone, etc by the Action cards.
**Change log: **
- First beta release.
- Complete re-write of the discovery process as some cameras required authentication to obtain some of the basic information.
- Added a log page to the Configure app button in the Apps - ONVIF section of Homey. This provides debug information to help solve any issues with specific cameras.
- Extra error traps to reduce crashes.
- Improves reconnecting to a camera that has been offline,
- Added Repair feature to reconnect a camera when the IP address or login details have changed,
- Added a button to the Log screen to send the log to me.
Version 0.0.20 / 0.0.21
- Added Digest Authorization with auto detection when none, Basic, Digest headers are required.
- Partial implementation of ONVIF Basic WS_Notifications (push events).
- New flow trigger card for ‘Motion Image Ready.
- Updated push event method
- Added motion alarm to device tile.
- Added option to switch between push and pull events when both are available.
- Tidy up of switching events on and off.
- Added retries to event image capture.
- Implemented Push Events Refresh instead of unsubscribing and subscribing.
- Now detects IsTamper event and set the ‘Offline / Tamper alarm’.
- Optimised network timeout for pull events.
- Re-enable events when camera comes back online.
- Made device class settable between camera and sensor in Advanced Settings.
- Optimized libraries to reduce the size of the app.
- Extra diagnostics and fix for invalid video source object
- Extra diagnostics for connect camera function
- Added German, Dutch, and Italian.
- Try getSystemDateAndTime with credentials if it fails without.
- Moved camera offline check to the app to smooth out processor demand when lots of cameras are added.
- Filter out devices that are not proper ONVIF cameras from search
- Fixed case where the password was appearing in the log.
- Fixed issue with Sync Time function.
- A bad snapshot URI is rechecked during the camera check.
- Fix crash when Sync. Time fails
- Send log change for better reliability
- Added a few more checks for bad data from cameras.
- Changed order of images so the ‘Now’ image is the default when the section is selected.
- Added “Motion image is ready within…” flow condition
- Deprecated “Update Now snapshot” flow action
- Added “Update Motion snapshot” flow action.
- Motion image available even when camera does not support it so that the flow trigger can update it.
- More logging
- Handle missing time from camera.
- Put catch around each image retrieval method instead of relying on camera returning a failure message.
- Switches log off when full instead of clearing it.
- Added diagnostics to find a specific problem
- More logging
- Fix 255.255.255.255 IP address returned from pull point subscription on some cameras
- Allow channel to stay set to 0
- Extra error logging
- Fixed enable / disable flow actions. Improved robustness against network failures.
- More diagnostics in parseSOAPString
- More diagnostics for invalid soap
- Change to 3 levels of logging. Handle an uncaught exception. Fixed typo in discovery message.
- Fix to cope with a single service.
- Fix to cope with a single video source.
- Fix to cope with a numeric serial number.
- Added an option to include a camera manually by specifying the IP and port.
- Fix to cope with custom services
- Fix error when manually adding a DVR
- Another fix error when manually adding a DVR
- Stop polling for camera check when logging more than errors so the log is not flooded.
- Added an option to the Advanced settings to select the motion trigger source.
- Added an option to set the event object ID.
- Stability improvements with regards to events.
- Added an option to disable a camera.
- Small memory optimisation (removed homey-log library).
- Fix for adding multiple cameras on a different VLAN.
Version 1.1.28 & 29
- Fixed issues with pull point subscription introduced in 1.1.26
- Changed NOW to SNAPSHOT for the 'Live image.
- Fix for cameras that are not supporting pull refresh correctly