Yes there is a whole thread on this. Milestone 3 fixes this for most people but the latest jar and milestone 4 (due out in 1-2 weeks) should have it resolved.
@alexkarageorgis
This post should have all the info in it that you need.
Yes there is a whole thread on this. Milestone 3 fixes this for most people but the latest jar and milestone 4 (due out in 1-2 weeks) should have it resolved.
@alexkarageorgis
This post should have all the info in it that you need.
@JimT, I made rules for my Dahua and Hikvision cameras to change the switch times based on the Astro binding. Let me know if you’d like to see how I did it.
I’d love to see your code. I just use Sun elevation (also from astro). I’d like to also do it based on light level, e.g. when it’s very overcast / raining during the day, switch it to night profile too. I haven’t figured out how to determine the light level. I’d like to do it based on the camera / camera feed itself, and not have to use extra external lux sensors.
Here’s my current code, written in JRuby OpenHAB Rules System
require 'openhab'
require 'net/http'
require 'net/http/digest_auth'
SUN_ELEVATION_THRESHOLD = 5 # Threshold for switching camera profile to day/night
def http_digest_get(url, user:, pass:)
digest_auth = Net::HTTP::DigestAuth.new
uri = URI(url)
uri.user = CGI.escape(user)
uri.password = CGI.escape(pass)
h = Net::HTTP.new uri.host, uri.port
req = Net::HTTP::Get.new uri.request_uri
res = h.request req
# res is a 401 response with a WWW-Authenticate header
auth = digest_auth.auth_header uri, res['www-authenticate'], 'GET'
# create a new request with the Authorization header
req = Net::HTTP::Get.new uri.request_uri
req.add_field 'Authorization', auth
# re-issue request with Authorization
h.request req
end
def dahua_set_profile(ip, profile, user, pass)
profile = { day: '0', night: '1' }[profile]
http_digest_get("http://#{ip}/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=#{profile}",
user: user, pass: pass)
end
rule 'Dahua: Profile switch to day' do
changed Sun_Elevation
on_start
run do |event|
if Sun_Elevation > SUN_ELEVATION_THRESHOLD && (event.nil? || event.was <= SUN_ELEVATION_THRESHOLD)
profile = :day
elsif Sun_Elevation < SUN_ELEVATION_THRESHOLD && (event.nil? || event.was >= SUN_ELEVATION_THRESHOLD)
profile = :night
else
next
end
logger.info("DAHUA PROFILE switched to: #{profile}")
dahua_set_profile(CAMERA_IP['Street'], profile, CAM_USER, CAM_PASS)
end
end
hi matt1, I am on milestone3 actually already.
For now I am ok after the unistall/re-install of the binding. Reading up on the link TY and waiting on m4.
the only thing which is strange (besides +10C temp on the RPI) is that the HLS stream isn’t consistent on my Amazon Firehd tables/Habpanel. It is better on my mobile phone (samsung note10).
so I have this
but some streams work better/appear and some just stay blank like below. (same setup ofcourse and all from the same NVR)
Is there some way to make the HLS stream faster to load?
Snapshots work ok every 5 seconds (question 2 - do snapshots keep getting “taken” even when the clickable widget isnt the active window?)
This is covered in the documentation here
IP Camera - Bindings | openHAB
With 20 cameras yes I am not surprised that M3 is still an issue, I have not tested that many before but you do not need to wait for M4 as I have uploaded the jar if you wish to try it out.
That is difficult to answer as it depends on the browser and the widget. You can easily check yourself by using DEBUG log output. Sometimes it is needed to press refresh on a browser after you leave the page to stop some streams.
Your streams not starting whilst others do, are any of them hikvision with digest? if so see here…
@matt1 I read that part - but I assumed that given I am talking to all cams through an NVR - same ip of NVR for all 20 cams/RTSP/different channels it isnt relevant to me? Should either work or not.
will try the new jar and revert after I read the debug info also.
thanks
Newer jar just uploaded for the hik digest bug. I have fixed a lot of bugs since M3 so you may find it now works with the newer jar. A NVR can be setup to allow each camera to be accessed via its own port, in that case it would depend on the cameras settings.
my NVR is a hybrid one - some analogue and some ip cameras. - it doesnt offer the option of port specific access. this is why i access via rtsp / channel by channel
@matt1 uploaded the jar from here - http://www.pcmus.com/openhab/IpCameraBinding/
added it into the folder - usr/share/openhab/addons.
rebooted the rpi for good measure.
how do i know if it updated? does the below make sense? (it says the old Bundle is waiting)
Just updated and enabled CGI on the cameras. Everything seem ok now. No more repeating INFO messages.
Still can’t SCAN though, but adding manually works fine.
Thanks.
I use curl within Rules.
val logName = "Update Camera Schedule"
val String DawnHour = astro_NauticDawnEnd_dt.state.format("%1$tH") //%1$td.%1$tm.%1$ty %1$tH:%1$tM"
val String DawnMinute = astro_NauticDawnEnd_dt.state.format("%1$tM")
val String DuskHour = astro_NauticDuskStart_dt.state.format("%1$tH")
val String DuskMinute = astro_NauticDuskStart_dt.state.format("%1$tM")
logInfo(logName, "Updating Camera Schedules: " + DawnHour + ":" + DawnMinute + " " + DuskHour + ":" + DuskMinute)
//Amcrest
// curl --anyauth --globoff -u username:yourpassowrd "http://10.1.1.201/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunriseHour=23"
val strA = "http://10.1.1.208/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunriseHour=" + DawnHour
createTimer(now.plusSeconds(1), [| executeCommandLine("curl", "--anyauth", "--globoff", "-u", "username:yourpassowrd", strA) ])
val strB = "http://10.1.1.208/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunriseMinute=" + DawnMinute
createTimer(now.plusSeconds(2), [| executeCommandLine("curl", "--anyauth", "--globoff", "-u", "username:yourpassowrd", strB) ])
val strC = "http://10.1.1.208/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunsetHour=" + DuskHour
createTimer(now.plusSeconds(3), [| executeCommandLine("curl", "--anyauth", "--globoff", "-u", "username:yourpassowrd", strC) ])
val strD = "http://10.1.1.208/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunsetMinute=" + DuskMinute
createTimer(now.plusSeconds(4), [| executeCommandLine("curl", "--anyauth", "--globoff", "-u", "username:yourpassowrd", strD) ])
Thanks @msexton187! This is much better than relying on openhab to perform the actual switching. I wasn’t aware of the sunrise / sunset hours being available. Indeed I could just set the time from astro and even add/subtract as I see fit.
@JimT and @msexton187
I created a github feature request here so if you want to do some testing and give feedback, it can be captured in one place to be looked at getting added.
[ipcamera] Day/Night profile switching features · Issue #11470 · openhab/openhab-addons (github.com)
Hi,
first of all, thank you for developing this binding.
I’m testing out a low budget camera Reolink RLC-410W. Some things work, some things don’t. But one step at a time.
First issue I’m trying to solve is HLS Stream. curling /ipcamera.m3u8 gives empty reply. The logs say:
2021-10-30 15:42:21.700 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-hide_banner -loglevel warning -rtsp_transport tcp -i rtsp://admin:********@192.168.0.77:554/h264Preview_01_main -strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 2 -hls_list_size 4 /var/lib/openhab/ipcamera/1ae736639a/ipcamera.m3u8
2021-10-30 15:42:22.591 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Invalid loglevel "warning". Possible levels are numbers or:
2021-10-30 15:42:22.594 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - "q�iet"
2021-10-30 15:42:22.609 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - "panic"
2021-10-30 15:42:22.613 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - "&atal"
2021-10-30 15:42:22.617 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - "error"
2021-10-30 15:42:22.620 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - "warning?verbose"
2021-10-30 15:42:22.624 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - "info"
2021-10-30 15:42:22.626 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - "verbose"
2021-10-30 15:42:22.630 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - "debug"
2021-10-30 15:42:22.640 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - "trace"
So ffmpeg complains about wrong loglevel settings. This is my ffmpeg version: “ffmpeg version 4.1.8-0+deb10u1+rpt1”. Is this a known problem? Binding version is 3.1.0
hmm, seems I’ve fixed it by uninstalling and reinstalling ffmpeg again
Looks like it is as data corruption. Make sure your card is not a counterfeit and is a quality one. Also make sure you have a UPS to protect against power outages when you have not shutdown correctly. Bad power supplies can also cause it. Do backups in case the card is failing.
I found that my Imou camera is set to be restarted every day at midnight. This process takes about 30-40 seconds, and after that camera lost connection with the binding (because I can see no more ONVIF Renew/PullMessages request in the openhab.log since then).
So is there a way to re-establish the connection or reset it frequently? Thank you!
I believe I fixed that in the latest build, you can either download it now or wait around a week for the next milestone (4?) to be released. The event streams and also if you have any open mjpeg streams will continue on after the camera reboots without needing any interaction.
Hm yeah, maybe. Although I can’t observe other inconsistencies.
Next error is, I get a segfault when running this command
sudo -u openhab /usr/bin/ffmpeg -hide_banner -loglevel debug -rtsp_transport tcp -i rtsp://admin:abc@192.168.0.77:554/h264Preview_01_main -strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 2 -hls_list_size 4 /mnt/openhabian/camera/ipcamera.m3u8