PS Eye camera displaying video but no motion alert

I have channels, have added them to the Thing and added them to the model. The underlying problem is (IMHO) is that they always report NULL, even when there is motion. I don’t know what I have missed or how to dig deeper into it…

Neither do we. Maybe if you shared the detail of the channels that you set up.


openHAB2.pdf (141.3 KB)

The channels created by default. I did find a posting that suggesting changing the type of the item to “contact” rather than “switch”, which I have tried. This did get rid of the NULL and changed it to “closed” which seems more correct to me. However, when I introduce motion (I have it in a controlled environment), it never changed to 'open" (which I would have expected)… The main steps I have done: 1) connected the camera, verified via lsusb it was there. Added Motion and ffmpeg per instructions 2) added it as a thing using the binding IPCAMERA, subtype ONVIF. I adjusted until it did come online and was then showing video. At this point, I am able to see streaming video and I am seeing recorded video as expected. However, the video isn’t really as important as being able to monitor and report activity and this is the part that I am not having any luck with. Perhaps I am monitoring the wrong channel or have the channel settings wrong (most of which were the defaults)

Any assistance is greatly appreciated.

Look at the Thing, look at the channel to see what type it is. The docs say Switch (read-only) which is ambiguous. But the PDF screenshot says Switch. It’s rarely successful linking channels of one type to Items of another.

Some diagnostic aids here -

In particular you can find out if your camera sends anything to openHAB, so at least you know which end to work on.

Here is the thing:
openHAB3.pdf (170.9 KB)

I will go through the forwarded diagnostic aid link & I thank you very much. I have also tried the ffmeg alert but that does not fire as expected either. Again, as a newbie to the world of Linux (although I spent a career in IT on different systems), I may have missed something. I will go through the steps and see if I can’t find it. I thought of writing something to look for new files and report it, but that seems like it shouldn’t be necessary.

Again, thank you for assistance.

Regarding the other device ( z-wave smoke detector), have look into this Thread

I got the binding to log and got this collection of errors, which I am unsure of the meaning.

org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to delete 1, /var/log/openhab/openhab.log.1.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to copy file /var/log/openhab/openhab.log.1.gz to /var/log/openhab/openhab.log.0.gz: java.nio.file.FileSystemException /var/log/openhab/openhab.log.0.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to delete 1, /var/log/openhab/openhab.log.1.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to copy file /var/log/openhab/openhab.log.1.gz to /var/log/openhab/openhab.log.0.gz: java.nio.file.FileSystemException /var/log/openhab/openhab.log.0.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to delete 1, /var/log/openhab/openhab.log.1.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to copy file /var/log/openhab/openhab.log.1.gz to /var/log/openhab/openhab.log.0.gz: java.nio.file.FileSystemException /var/log/openhab/openhab.log.0.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to delete 1, /var/log/openhab/openhab.log.1.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to copy file /var/log/openhab/openhab.log.1.gz to /var/log/openhab/openhab.log.0.gz: java.nio.file.FileSystemException /var/log/openhab/openhab.log.0.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to delete 1, /var/log/openhab/openhab.log.1.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to copy file /var/log/openhab/openhab.log.1.gz to /var/log/openhab/openhab.log.0.gz: java.nio.file.FileSystemException /var/log/openhab/openhab.log.0.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to delete 1, /var/log/openhab/openhab.log.1.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to copy file /var/log/openhab/openhab.log.1.gz to /var/log/openhab/openhab.log.0.gz: java.nio.file.FileSystemException /var/log/openhab/openhab.log.0.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to delete 1, /var/log/openhab/openhab.log.1.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to copy file /var/log/openhab/openhab.log.1.gz to /var/log/openhab/openhab.log.0.gz: java.nio.file.FileSystemException /var/log/openhab/openhab.log.0.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to delete 1, /var/log/openhab/openhab.log.1.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to copy file /var/log/openhab/openhab.log.1.gz to /var/log/openhab/openhab.log.0.gz: java.nio.file.FileSystemException /var/log/openhab/openhab.log.0.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to delete 1, /var/log/openhab/openhab.log.1.gz: Read-only file system
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to copy file /var/log/openhab/openhab.log.1.gz to /var/log/openhab/openhab.log.0.gz: java.nio.file.FileSystemException /var/log/openhab/openhab.log.0.gz: Read-only file system

looks like a permissions issue but I am unsure of next steps…any suggestions?

Some progress…I did manage to fix the aforementioned permissions and now am getting the trace information. First thing I am seeing is this entry: Sending ONVIF request:GetSystemDateAndTime

It is repeated. Could this be the clue?

Does the camera have onvif support? I could not see any evidence it does with a quick Google. Onvif cameras should get auto discovered and set themselves up.

You would need to setup as generic thing type and supply the urls for the camera manually via the config fields.

Second point is if you wish to use ffmpeg to do motion detection you would use the channel ffmpegMotion which should be described in the documentation for the binding in its own section.

It is a PSEye, which is a 'toy" camera that I was using as a learning aide. The documentation says it is supposed to be an ONVIF camera, but I agree that it look suspiciously like it isn’t supporting it. I will try it as a generic IP camera. Any suggestions on a camera that is KNOWN to work? I may be driving myself nuts with the wrong hardware.
Thanks again!

I can not see anywhere reliable that it is an ONVIF camera. Does it have RTSP or MJPEG stream URLS? Does it have snapshot URL? If it does not have these then it may not be worth the time trying to get it to work. You can get some pretty cheap ONVIF cameras these days you just have to be careful to get one that has decent ONVIF support programmed in.

mjpegUrl: http://moretrees.world:8085/0/stream
snapshotUrl: http://192.168.0.235/var/lib/motion

These URLS seem to not match each other and may be your attempt at trying to get things online and working but just shoving junk into the binding? What does the camera actually support and what are the URLs?

moretrees.world does work and is correct.
I had been playing with the snapshot URL but hadn’t gotten that properly set.
I disabled the ONVIF thing and created a generic IP camera thing. It is now streaming. However, I have something not set right on the FFMPEG motion alarm It is always showing NULL so I need to dig into that one. Any pointers on that?
I did get the snapshotURL all lined up.
I will get a better camera, but I must say this one has given me a chance to learn a lot. I would like the alarm to work though.
openHAB4.pdf (140.0 KB)

Again, many thanks for all the assistance.

Does it have a usb plug or a rj45 network port on it? If usb, I would class it as a WEBCAM and not an IP Camera and this binding is not a good match, but it may be possible to still get it working if the http://moretrees.world:8085/0/stream url is giving you a real mjpeg stream. Have no idea how it is doing that unless you installed software that is creating the stream for you and serving it at that URL.

Try making a generic camera have these settings…

    snapshotUrl="ffmpeg"
    mjpegUrl="http://moretrees.world:8085/0/stream"
    ffmpegInputOptions="-f mjpeg"
ffmpegInput="http://moretrees.world:8085/0/stream"

This will use ffmpeg to do all the work converting it to what the binding needs so it will create a larger load compared to a true IP Camera that does all this in the onboard ARM processor.

Before buying a camera, make sure you do a search on the brand and model in the below forum to see how the ONVIF support works like…
Home | IP Cam Talk

I truly appreciate your assistance.
It has a USB plug on it. The stream URL is working fine. Honestly, I didn’t keep the right kind of notes on what I installed to get it working but as I recall it was motion and ffmpeg. I don’t recall doing much additional on it. Originally, I had found people posting they were using the device (and since it was cheap and I’m so early in the learning curve, it seemed like a good place to start). At any rate, I have learned enough to disable the ONVIF thing, add a new one and get it to work so I will try your suggestion tomorrow and see how it goes.

Ah the joys of learning (said with embarrassment because I geeked around back in the days when COBOL was “the” language to know and the internet was only used by a few). Thanks again.

It will be the motion software that is turning the usb into a stream, nothing wrong with doing that just the binding is used to having a RTSP stream as the main feed and not a MJPEG stream which is why the “-f mjpeg” options are needed. I have tested using a camera with snapshot and mjpeg urls only and from memory it worked pretty well but I do not test this setup for every release of the binding when a change is made. See the very last post in this thread as it seems you can get a snapshot url working as well and that will be preferred to have both supplied. If you search this forum you may find that there is a way to get motion notifications directly from the motion software. I have never tried the software so no idea what it is like and what is possible.

Motion - still image URL - Raspberry Pi Forums

Again thank you all for the assistance. I have implemented as recommended. The camera is streaming just fine, the snapshot works fine. The only thing that sill isn’t working is the motion alarm.
This is the section from the motion conf file that I think applies — and you will see where I have done some experimenting in there. Any suggestions as to what I need to change to get the motion to raise an event in OPENHAB? (or maybe this isn’t the place to adjust…)

############################################################

Motion detection configuration parameters

############################################################

Always save pictures and movies even if there was no motion.

emulate_motion off

Threshold for number of changed pixels that triggers motion.

threshold 1500
;threshold 25000

Noise threshold for the motion detection.

; noise_level 32

Despeckle the image using (E/e)rode or (D/d)ilate or (l)abel.

despeckle_filter EedDl

Number of images that must contain motion to trigger an event.

minimum_motion_frames 1

Gap in seconds of no motion detected that triggers the end of an event.

event_gap 60

The number of pre-captured (buffered) pictures from before motion.

pre_capture 3

Number of frames to capture after motion is no longer detected.

post_capture 5

Sorry I do not know the motion software at all. I prefer to just use a camera that has it built in.

Did you ever try getting the ffmpeg based motion alarm working from your camera that uses a mjpeg input? What ffmpeg command does the TRACE logs show is getting used to start the alarm if it does not work? As 99% of cameras use a h264 based RTSP stream the binding has been setup and tested to work in that scenario.

Thank you so much for the suggestion. I have tried using the ffmpeg based motion alarm to no avail…however I have not looked at the trace logs. I will work on that later today.

Again, thanks!

I checked the log, as suggested, and it does not show an alarm. It does however, note the recording of motion. Is there any way in OPENHAB that I can monitor for that and raise a motion alarm from that?
Thanks, in advance
PS – will be buying a ‘real’ camera soon, I’m just continuing to learn/experiment with this one