Homey Community Forum

Support for ONVIF compatible cameras

I have created an app that supports ONVIF compatible video cameras. The cameras have to 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 knows as Push points, but is not fully tested).

The main differences between this app and the Homey IP camera support is 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 the maybe 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 actually 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 cheep 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 pretty sure this cam needs a token to grab a snapshot so it my 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 camera’s are working but No ONVIF motion detection.
  • Milesight 360 panoramatic

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 updated the list.

To add a camera, use the standard add device method of Homey.
During the process the app will discover all the ONVIF cameras on you LAN and show the list to you. This can take about 15 seconds so please be patient.
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). Enter the details and the 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 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 startup process.
The log is limited to 15kB at which point it will reset and start again. Logging will add extra load to Homey so it is recommend 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 NOW). 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.

  • 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 about 30 seconds to detect. After about 1 to 2 minutes the app shows ‘Not Available’.
    This could mean the camera has been disconnected or maybe the IP address has changed. If the IP address has changed you can use the Repair option to redetect the camera.

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 User Name and Password are the credentials required to log into the camera via ONVIF. Check you camera settings to make sure this has been setup.

  • Has Motion: is detected during the pairing process but you can override it here if you believe it is incorrect. Note that the camera must support ONVIF PullPoint’s and motion detection on the camera for this to work so activating the option for a camera that does not support the feature will not make it work. (Removed form version 0.0.20 onwards)

  • Single: when set, this option determines if just one snapshot per new trigger is captured, e.g. the trigger has to be cleared by the cammer 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 very sensitive and will trigger before the person has fully entered the image, in which case you might only get the edge of them.

  • Override ONVIF snapshot URL with: You can enter any URL into here to instead of the one specified by the camera during pairing. Most cameras report the correct URL but it seems a few will provide a URL that does not work so you change it here. It is also possible to capture an image from a different camera if that is what you want. Leave the setting empty to use the default URL. (Removed form version 0.0.20 onwards)

  • Add Authorization header: When set to Yes, the app will generate HTML headers with the Authorization header set with the login details. If you see that the ONVIF URL does not contain a user name and password then it is a good indication that this needs to be switched on. (Removed form version 0.0.20 onwards)

  • 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 shows information about the camera provided during pairing.

  • The Maintenance screen has an option to set the cameras time to the same as Homey and and 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:

Version 0.0.2:

  • First beta release.

Version 0.0.6:

  • 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.

Version 0.0.10:

  • 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.

Version 0.0.22

  • Partial implementation of ONVIF Basic WS_Notifications (push events).
  • New flow trigger card for ‘Motion Image Ready.

Version 0.0.36

  • 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 considerably reduce the size of the app.
  • Extra diagnostics and possible 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.

Version 0.1.1

  • 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.

Great work, thx!
If not allowed by Homey, please publish it elsewhere, so we can sideload it…

It is on GitHub https://github.com/AdyRock/com.onvif
The more testing the better :wink:

I currently have two different cameras on it. One is an H.View HV-E800 and the other is an unbranded camera in a bird box.

Thanks to @Rocodamelsheki for pointing out that I had not included the onvif lib on GitHub. I have now added that and hopefully it should work.
Note: I have modified the original lib to make it work as it had several issues. I’m not sure if it is my cameras or general problems but it couldn’t cope with the returned data structures.

1 Like

And again thanks to @Rocodamelsheki for helping me find that there are a few other dependencies that the onvif lib relies on. These are now in the node_modules directory up on GitHub.

1 Like

My first submission was rejected because I had the description in the first line of the readme. But it has given me a chance to update it to the latest version.
It now uses the latest version of the ONVIF library which works without my modifications. i have also added capabilities to show when the motion event occured, when the camera went offline plus the time from the camera. Also there is now a maintenance button to set the camera time to Homey time.

1 Like

Good work :grinning:

I hope to link my camera also with this to homey.
it now works with VLC http://123.456.789.0/videostream.asf?user=xxxxx&pswd=xxxxx.

Probably won’t work with my app as I spotted this on the link you gave:
De onvif protocol is niet ondersteund, en de maximale geheugenkaart is 128G!

sorry wrong link, it is

That looks more hopefully :grin:

Adrian, the app is live thanks for that. unfortunately the app does not find my camera. is there anything I can do to get it working?

The first release went live the is morning and there is now the first update available at:

Should hopefully fix a few bugs that have been discovered with the help of @Rocodamelsheki


Can you try the \test version linked above to see if that works?

Adrian. Version 005 installed. After 8 sec same error: no camera found. My Hdminicampro app has lost the camera also. I have removed the app 005 and installed it again on homey and restart the camera and after that my Hdminicampro app functioned again but the 005 version on homey did not find the camera after 8 sec. of searching the error: no camera found again. the Hdmincampro keeps working.

I have a crash dump from around 16:56 so not sure if that came from you (no identification is included with them).
That shows an invalid response from a camera couldn’t be handled by the ONVIF lib. Unfortunately it doesn’t show what the response was but I can see where better error handling is required so it doesn’t crash the app.
I will also add a log page like I have in my other apps so more diagnostic information can be gathered.
Watch this space for updates :wink:

Hello Adrian,
perhaps this was mine, 17:56 german summer time. Perhaps this ist the reason for the 1 hour difference.
I tried to search for cameras (HiKam S6 and Lutec lamp with camera).
The app doesn’t find a camera. It shows a timeout message.
Would it be possible to create a device with settings (IP, Port or URL) if the search doesn’t work?
I’ll wait for the new test version with some log information. Perhaps I can find the reason why search is not successful.
Thanks for this app. I would like to use it, because Athom added some checks for virtual cameras that prevents adding a valid URL (error message EHOSTUNREACH in Homey-app, but in Browser it’s ok).

I have posted a new test version 0.0.6.
This adds a log page to the Configure app in the Apps section of Homey. If you have issues then go to that screen and enable the logging. Then repeat the troublesome task, e.g. pairing, and when finished return to the log screen to view the diagnostics message. If you could send then to me by PM or create an issue on GitHub (link is in the app store by clicking on Report an issue) then I can try to improve the app.
To copy the log on Android you can long press on the log text until the menu pops up and then touch ‘Select All’ followed by ‘Copy’. After that you can paste the text into the target view.

I have also added extra error traps to the ONVIF library so hopefully the previous crashes will not happen.

The only problem is if the discovery fails then the forced connection will probably fail. Discovery is a mandatory feature of ONVIF, so provided the camera is ONVIF compliant then it ‘should’ work. As this is the first release there are possibly issues with my code at the moment. I only have H.View cameras and an unbranded camera in a bird box to test with, which are working fine.
The problem I can foresee is coping with the various revisions of the ONVIF protocol so that may take some help from users to get established.