IpCamera: New IP Camera Binding

Your correct, I just went and checked the code and it is missing a single line to update the current position when asked to refresh so it is not something you are doing wrong. 99% of the coding is done and is simple to get this going and it looks like your camera is compatible, BUT see my previous reply to Dave…

ptzLocation = getPtzPosition();

@matt1, thanks for quick reply!
No sweat, any time you tinker with the code again, keep this in mind (hope rain is in your local forecast :wink: )

New build 2019-05-23 is now available with these changes:

  • Uses new bnd bundle build system to work in future releases of Openhab. I am using it under 2.4 stable for around 4 days now with no issues.
  • Can disable the ipwhitelist if you make it equal DISABLE in all caps. @delid4ve requested this ability.
  • The PTZ can now fetch updated locations, but only if you request the PAN is updated first. @sl92656 requested this feature.
  • Bug fixes for httponly thing types as they had some issues using the new stream features in all previous builds.

There are now a number of extra Jar files that you MUST drop into the addons folder for the binding to work, they are all in the zip file together.

Also when upgrading you MUST clean the cache and tmp folders as the binding is now built differently and no old cache can remain or you will get issues…

Under linux this can be done with this command:


sudo service openhab2 stop && sudo rm -rf /var/lib/openhab2/cache/* && sudo rm -rf /var/lib/openhab2/tmp/* && sudo reboot
1 Like

@matt1, this is great news! Thank you very much for spending all the time to implement all these changes. I wished I could help, but the programming at that level is above my grade. I tend to stick to embedded systems…
BTW, with your motion GIF feature I learned that we have a frequent visitor at our house, see here:
ipcamera1
ipcamera2
It’s good a long weekend is coming and I can “Labor for a Day” to check out the new features…

1 Like

No problems, glad you enjoy the binding. Great to see some examples of the animated GIF feature. Do you happen to have a chromecast as I am keen to hear from anyone that uses the HLS feature to cast the camera.

Feedback is always a big help as all cameras handle things differently and I can not own lots of cameras. For example with your gifs above, where is the cat when the trigger that starts the creation occurs? Do you have a tripwire alarm setup at the steps or is it a normal motion alarm and the camera takes some time to provide the feed from where the cat triggers the alarm?

For reasons why I am interested, see this thread…
https://github.com/Skinah/IpCamera/issues/26

@matt1,

I tried your new version, but did not succeed. No IP camera access possible anymore.
My camera model is: Amcrest IP4M-1051
I am running on a Rpi 3.
My openhab version is:

###############################################################################
################# openHABianPi #################################### 7.05.170509 
###############################################################################
##        Ip = 192.168.1.200
##   Release = Raspbian GNU/Linux 8 (jessie)
##    Kernel = Linux 4.9.35-v7+
##  Platform = Raspberry Pi 3 Model B Rev 1.2
##    Uptime = 5 day(s). 2:36:10
## CPU Usage = 2.06 % avg over 4 cpu(s)  (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.17, 5m: 0.41, 15m: 0.58
##    Memory = Free: 0.08GB (9%), Used: 0.85GB (91%), Total: 0.94GB
##      Swap = Free: 0.09GB (95%), Used: 0.00GB (5%), Total: 0.09GB
##      Root = Free: 101.93GB (96%), Used: 3.64GB (4%), Total: 110.07GB
##   Updates = 121 apt-get updates available.
##  Sessions = 1 sessions
## Processes = 138 running processes of 32768 maximum processes
###############################################################################

              Welcome to            __  _____    ____  _
            ____  ____  ___  ____  / / / /   |  / __ )(_)___ _____
           / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  / / __ `/ __ \
          / /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ / / /_/ / / / /
          \____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/_/\__,_/_/ /_/
              /_/
                  openHAB 2.3.0-1 (Release Build)

Here is the filtered log:

2019-05-25 19:17:28.924 [WARN ] [org.apache.felix.fileinstall                      ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.ipcamera-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [197]
2019-05-25 21:17:52.750 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Loading model 'ipcam.items'
2019-05-25 21:20:06.499 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'ipcam.rules', using it anyway:
2019-05-25 21:20:06.516 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Loading model 'ipcam.rules'
2019-05-25 21:20:51.921 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Loading model 'ipcamera.things'
2019-05-25 21:21:16.787 [ERROR] [org.openhab.binding.ipcamera                      ] - FrameworkEvent ERROR - org.openhab.binding.ipcamera
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [197]
2019-05-25 21:21:39.114 [WARN ] [org.apache.felix.fileinstall                      ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.ipcamera-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [197]
2019-05-25 19:17:28.924 [WARN ] [org.apache.felix.fileinstall                      ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.ipcamera-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [197]
2019-05-25 21:17:52.750 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Loading model 'ipcam.items'
2019-05-25 21:20:06.499 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'ipcam.rules', using it anyway:
2019-05-25 21:20:06.516 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Loading model 'ipcam.rules'
2019-05-25 21:20:51.921 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Loading model 'ipcamera.things'
2019-05-25 21:21:16.787 [ERROR] [org.openhab.binding.ipcamera                      ] - FrameworkEvent ERROR - org.openhab.binding.ipcamera
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [197]
2019-05-25 21:21:39.114 [WARN ] [org.apache.felix.fileinstall                      ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.ipcamera-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [197]
2019-05-25 19:17:28.924 [WARN ] [org.apache.felix.fileinstall                      ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.ipcamera-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [197]
2019-05-25 21:17:52.750 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Loading model 'ipcam.items'
2019-05-25 21:20:06.499 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'ipcam.rules', using it anyway:
2019-05-25 21:20:06.516 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Loading model 'ipcam.rules'
2019-05-25 21:20:51.921 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Loading model 'ipcamera.things'
2019-05-25 21:21:16.787 [ERROR] [org.openhab.binding.ipcamera                      ] - FrameworkEvent ERROR - org.openhab.binding.ipcamera
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [197]
2019-05-25 21:21:39.114 [WARN ] [org.apache.felix.fileinstall                      ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.ipcamera-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [197]
2019-05-25 19:17:28.924 [WARN ] [org.apache.felix.fileinstall                      ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.ipcamera-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [197]
2019-05-25 21:17:52.750 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Loading model 'ipcam.items'
2019-05-25 21:20:06.499 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'ipcam.rules', using it anyway:
2019-05-25 21:20:06.516 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Loading model 'ipcam.rules'
2019-05-25 21:20:51.921 [INFO ] [.smarthome.model.core.internal.ModelRepositoryImpl] - Loading model 'ipcamera.things'
2019-05-25 21:21:16.787 [ERROR] [org.openhab.binding.ipcamera                      ] - FrameworkEvent ERROR - org.openhab.binding.ipcamera
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [197]
2019-05-25 21:21:39.114 [WARN ] [org.apache.felix.fileinstall                      ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.ipcamera-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [197]

Could it be, the problem is me running openHAB 2.3? I am not ready to move to 2.4 or 2.5 because of all the MQTT changes that I read about…
Hope this helps.

Good morning all.
Has anyone configured a TTGO -TCamera ESP32 with the binding?

I ordered some a while ago to play/learn with before purchasing a real camera.
Future will be outdoor cams for front and back of my house, however I am experimenting with setting one of the ESP32 cams up as an indoor monitor, more or less as a baby cam (lol!) for my 5 year old ‘still a puppy’ Boxer.

I have flashed the following on one of the modules, but have not had much success with the binding configs as I have very little experience with cameras having never owned one before.

I have added the 2019-05-23 IpCamera binding, and am attempting to set a TTGO-T Camera module up as a generic HTTP camera. Success when adding it as a thing, but i them become stumped with other settings, including for the RTSP section.
I’ve been reading and attempting to set one up as much as I can before asking for help, but am now at that point where I’m not certain if I’m doing something incorrect or this will actually work as I have not had any success.

openHAB 2.5 Snapshot#1555, as Debian VM running under ESXI 6.7 with more than enough RAM and a Xeon processor, and ffmpeg is installed.

Any help is appreciated, I just need that starting point boost!

Note: From the linked page for the firmware for the ESP32 module I was not able to get the RTSP stream to work with VLC (Windows 10 machine which I rarely use due to a random reboot ‘feature’ that I can’t track down and resolve…) so maybe a firmware issue?
Note2: tried the rtsp feed with VLC on ChromeOS (android app) and success! so should be fine.

Thanks in advance for your help,
Craig

Edit: Fix typos, add openHAB version, note on VLC streaming

It is possible as I do not know how far back the binding will work now that it is using the newer bundle format. If you cleaned out the cache and tmp, then I would suspect it is your version. I have it working on 2.4 Stable… I would recommend you do upgrade when you get a chance as the mqtt issue is easily solved and my guess is that the next 2.5 will take ages to get it as stable and bug free as the current builds. Hopefully I am wrong about it, but too much has been changed for it not to ripple bugs and regressions.

No and I am not too keen on getting one as I have heard that they overheat if you stream non stop for any length of time plus they lack nightvision. For taking a quick look at your dog and not leaving the stream open I guess it could be a great value way to get a cheap camera.

Great, can you post the rtsp link that worked in VLC as that seems to be missing from every guide I have read. What would be ideal if the camera can provide a snapshot, mjpeg and also a h264 stream all at the same time. My guess is the heat will be an issue if trying to tax it that much so it will probably be limited to a single stream. Please let us know what you find.

I cleared cache and temp and also rebooted the Pi, to no avail.
I will have to switch back to your previous version until I make the jump to 2.4, thanks!

Try this project: It allows you to fetch a mjpeg stream with this address…

http://192.168.0.206:81/stream

Note it uses port 81 so this needs to be changed in the binding to match.

@matt1 Great binding! I just tried it with a Hikvision camera to enable / disable motion and line detection. Seems to work great! However I constantly get Warnings in my log file:

`The alarm checking stream was not running. Cleaning channels and then going to re-start it now` 

My ipcambinding user is a regular user, not an admin. Does the user need specific rights enabled? I have enabled CGI but not ONVIF as I do not have a PTZ cam.

Sorry if this has been already discussed here, but I could not find the solution for this - other than disabling warnings in the log file…

Regards, Bernd

I was trying this, but RPI3 did not have the performance that was needed will try lator on an Windows installation.

@tnemrap
My guess is the RPIx will be limited by the speed of the SD cards as HLS streams need to be written and then read from the SD card unless you do what I recommend and that is setup a tmpfs location to use ram instead. Because of the way HLS works, you only need a 10mb sized tmpfs location to handle most cameras as the files are deleted and created at the same time. I am using an Odroid C2 (arm based) with a micro SD card and tmpfs for the hls feature and it runs great, I have never tried using the SD card as I suspect it would not work very well. Before giving up on the Pi, perhaps give the tmpfs a try.

@bernd_d
I have never tried using a lower user, I always use admin. Best place to start is by turning on TRACE log output which will show you the replies back from the camera and if that is occurring it should tell you the rights are insufficient or another reply will help work out what is wrong. To reduce the log output when fault finding it may be a good idea to turn off the snapshots from updating. The alarm checking stream should stay open so something is wrong hence the warning.

The readme has the info on how to enable the logs…

INFO is the default log output.
DEBUG gives a general overview of what is going on with single line logs.
TRACE gives you the whole lot and includes the data from the camera which is missing from DEBUG.

@matt1 Thanks for your reply. Looks like the reason was not using the admin user. I changed to admin user and the above warning about alarm checking stream not running only comes once at startup but not every couple of seconds. The switch to enable / disable e.g. line detection works great on my Hikvision DS-2CD2555 :+1:

Regards, Bernd

Thanks @matt1, I’ll look into the link you posted above this weekend when I have some spare time.

I may not have the RTSP stream working as I thought, being so new to this and beginning to understand how all is supposed to work. I can see the stream in VLC but when trying to access the transcode with my browser, no dice.

I just input “rtsp://yourdevipaddr:8554/mjpeg/1” per the page I linked (at the bottom of the page) into the ‘Stream’ menu section and can see the video in VLC.

I’ll spin up Linux VM this weekend with a GUI since my Windows machine is not reliable and see if I can come up with something.

And thanks for your help, much appreciated!

Craig

The binding will need a snapshot url that works for the camera to come up as ONLINE.
The binding will not accept a rtsp url for mjpeg streams, it needs to be a http starting url which on a limited processor like the esp32 is going to be a better solution.

What would be cool is if someone writes a firmware for the esp32-camera that…

  1. Is precompiled and ready to flash.
  2. Allows you to connect to a wifi AP to provide your wifi details and password so you don’t need to compile the password into the firmware.
  3. Uses MQTT to pass details to Openhab for things like PIR sensor and button pushes.
  4. Can provide a snapshot and mjpeg stream.

If that was done it would be very easy to setup and people would not need to compile code to get them running. If something like Homie was used it would mean autodetection, this is probably what people have done with the ESP-Home firmware.

Good luck and hope to see what you can come up with.

@sl92656
@rastus_rob
@posixx

I am looking at extending the features for the animated gif, if you want input you can read about what is planned at the link below. It will be new features and will not break what is already working.

Has anyone had any luck in getting Axis cameras working with this binding? I’ve tried a few things but no joy yet. Just wondering if I should persist or if it’s a fruitless endeavour.

Thanks

@matt1

I like your idea of making this pre-fetch optional, reason being, that I’d like to control the amount of data going over the wireless link. I am not sure how much a constant snapshot prefetch will impact my wireless link, nor how my RPi will be able to handle it.
Having the option to turn pre-fetch on and then off, when it is too taxing, is great.
BY THE WAY, I assume that the RTSP stream will add a steady load to wireless and RPi?
Do you have any idea how that compares to the Snapshots?
Another thing, in order to remove the confusion about the meaning of GIF_PREROLL and GIF_POSTROLL, remove any reference to time (i.e. seconds) and only refer to number of Snapshots with a note, that the timespan covered will depend on the Snapshot update rate definition.

To be clear, it is not optional in realtime, you have to change a config setting so it is easy to do. Because it sets aside RAM for this task I do not want it being changeable in realtime.

No it only opens the stream to create the gif and then closes it back down so the network load is only for a short period of time. The same goes for HLS streaming, it auto starts when you cast a camera to a chromecast and then shuts everything down a little bit after you stop casting the feed.

The snapshots are 1/4 of the data amount compared to my h264 stream at 2mp and 12 FPS. There are so many variables but this is what my camera is set to. It is common to drop the frames back to save on network traffic and disk storage for security systems.

Yes I will have to find a short easy way to explain this that gets shown in PaperUI. I also do not know how many users actually achieve the ability to do 1 second snapshots as it is possioble some cameras are unable to do it.

@Gerry_Maguire
Axis cameras should work if you setup as a ONVIF camera, see the readme on how to enable DEBUG log output which will help guide you as to what is wrong.