667bdrm / sofiactl Goto Github PK
View Code? Open in Web Editor NEWsofiactl is an open source cross-platform tool and sdk to control Sofia powered Hi35xx DVR devices
sofiactl is an open source cross-platform tool and sdk to control Sofia powered Hi35xx DVR devices
Hello ....
i only wanted to let you know .... maybe interested someone ....
well,
i have no solved my problems ....
not sure, where to post for now ... maybe you want to publish it ...
i will explain:
1.) i wanted to have my cameras - motion detection in home assistant
2.) i want that if a new alarm comes inot, that "holfer (input_boolean will be set to "state: on"
3.) this i can then use to play a audio file, if an alarm or whatever (in hass - autmation), and when alarm handling done, then i set the helper ((input_boolean ) to off, and so on ...
so, i checked on ONVIF, XM / IPC / http cgi what is possible and found that my NVR, can deliver the alarms to another server - typically 15002 or 15003 (not sure)
how i did it:
1.) in HASS:
create all helpers "input_boolean" to have them "read-write" eg: in my case 16 channels
nvr_alarm_motiondetection_ch01 to nvr_alarm_motiondetection_chch16
2.) on my hass server,
there rewrote an other existing "dvr-alarm-server" to my usage: "nvr-alarm-server" ... and install and running it as service
and listening on alarms on port 15003 (standard on xmeye nvr servers compatible (most on (XM IPC) port 34567 and 80 port to configure)
This perl service script is now getting the alarms, and then calling the HASS API to set the status as wanted ..
AND
2a) via curl cmd use the HASS rest api to call the "input_boolean" entities to set it to {"state": "on"} - based on alarm aevent and channel infos...
if an moton detection with "start" comes into .. then i update the entity ....
the rest .... can be done in home assistant to handle this entities on automation ...
thats it and working great ...
if anyone is interrested to get the code and infos ... let me know ...
basically - most of the parts were found on project: "sofiactl" (which is doing "alarm event 2 mqqt" .... but not sure, if that was on github ...
maybe i can send the code to the real code owner to review and adapt it ....
cu camel
currently my command im using is:
/home/pi/sofiactl/sofiactl.pl -u -p -host -port -c Download -bt 2022-05-27T08:45:00Z -et 2022-05-27T09:00:00Z -ch 7 --dl
I'm doing the download from the same network as the DVR is host on. The download seems to take forever, 15 min 200MB file, takes 30 min to download....why so long??
Hi. Can I shutdown the DVR via sofiactl? I have OpenWrt-based Wi-Fi router with UPS connected to USB via Network Ups Tools. I want to automate shutdown. OpenWrt will send shutdown command to DVR, then power off UPS.
Is there an API for triggering alarm events?
My NVR doesn't have digital I/O ports, so it would be very useful to be able to trigger alarm programmaticaly.
Is it possible to download the audio stream from a recording along with the h264 video? My camera supports it and the iCsee app support it as well.
I tried to modify the existing FileQuery code to look for common audio extensions but none has returned any match,
Hello friend, what is the correct form of the command to change the title of the channel. ? ChannelTitleSet, help me!
I have full access to my camera (telnet root) which uses sofia. I would like to extract the full firmware bin. Is this possible with sofiactl or by some other means?
del
I get this
./sofiactl.pl --user admin --pass 'password' --host 192.168.100.9 --port 34567 --command OPFileQuery --bt '2020-10-21T00:00:00Z' --et '2020-10-21T00:30:00Z' -ch 0 --dl
decode_json exception. data:{ "AliveInterval" : 21, "ChannelNum" : 8, "DeviceType " : "HVR", "ExtraChannel" : 0, "Ret" : 100, "SessionID" : "0x00000041" }
decode_json exception. data:{ "Name" : "OPFileQuery", "OPFileQuery" : [ { "BeginTime" : "2020-10-21 00:10:20", "DiskNo" : 0, "EndTime" : "2020-10-21 00:10:29", "FileLength" : "0x000006E3", "FileName" : "/idea0/2020-10-21/001/00.10.20-00.10.29[M][@71a][0].h264", "SerialNo" : 0 } ], "Ret" : 100, "SessionID" : "0x41" }
I run this command. I see video setting updated new config. But cammera not apply that config.
Cammera apply new config When i change some thing config on my phone and click save button. Please help me.
Thank you.
./sofiactl.pl -u admin -p xxx -host xxx -port 8000 --c ConfigSet --co AVEnc.Encode[0] --if ./channel01.json --jp --d
And my content channel01.json { "ExtraFormat": [ { "Audio": { "BitRate": 0, "MaxVolume": 0, "SampleRate": 0 }, "AudioEnable": false, "Video": { "BitRate": 954, "BitRateControl": "VBR", "Compression": "H.264", "FPS": 21, "GOP": 2, "Quality": 4, "Resolution": "D1" }, "VideoEnable": true }, { "Audio": { "BitRate": 10, "MaxVolume": 10, "SampleRate": 10 }, "AudioEnable": false, "Video": { "BitRate": 384, "BitRateControl": "VBR", "Compression": "H.264", "FPS": 21, "GOP": 2, "Quality": 4, "Resolution": "D1" }, "VideoEnable": true }, { "Audio": { "BitRate": 10, "MaxVolume": 10, "SampleRate": 10 }, "AudioEnable": false, "Video": { "BitRate": 384, "BitRateControl": "VBR", "Compression": "H.264", "FPS": 21, "GOP": 2, "Quality": 4, "Resolution": "D1" }, "VideoEnable": true } ], "MainFormat": [ { "Audio": { "BitRate": 0, "MaxVolume": 0, "SampleRate": 0 }, "AudioEnable": false, "Video": { "BitRate": 2560, "BitRateControl": "VBR", "Compression": "H.264", "FPS": 25, "GOP": 2, "Quality": 4, "Resolution": "720P" }, "VideoEnable": true }, { "Audio": { "BitRate": 0, "MaxVolume": 0, "SampleRate": 0 }, "AudioEnable": false, "Video": { "BitRate": 2560, "BitRateControl": "VBR", "Compression": "H.264", "FPS": 25, "GOP": 2, "Quality": 4, "Resolution": "720P" }, "VideoEnable": false }, { "Audio": { "BitRate": 0, "MaxVolume": 0, "SampleRate": 0 }, "AudioEnable": false, "Video": { "BitRate": 2560, "BitRateControl": "VBR", "Compression": "H.264", "FPS": 25, "GOP": 2, "Quality": 4, "Resolution": "720P" }, "VideoEnable": false } ], "SnapFormat": [ { "Audio": { "BitRate": 10, "MaxVolume": 10, "SampleRate": 10 }, "AudioEnable": false, "Video": { "BitRate": 512, "BitRateControl": "VBR", "Compression": "H.264", "FPS": 21, "GOP": 2, "Quality": 4, "Resolution": "D1" }, "VideoEnable": true }, { "Audio": { "BitRate": 10, "MaxVolume": 10, "SampleRate": 10 }, "AudioEnable": false, "Video": { "BitRate": 512, "BitRateControl": "VBR", "Compression": "H.264", "FPS": 21, "GOP": 2, "Quality": 4, "Resolution": "D1" }, "VideoEnable": false }, { "Audio": { "BitRate": 10, "MaxVolume": 10, "SampleRate": 10 }, "AudioEnable": false, "Video": { "BitRate": 512, "BitRateControl": "VBR", "Compression": "H.264", "FPS": 21, "GOP": 2, "Quality": 4, "Resolution": "D1" }, "VideoEnable": false } ] }
One of my cameras have poor ONVIF support, so NVR cannot get stream from it.
I'm trying to set RTSP stream address for a channel directly, using sofiactl.pl
As I see, there are several options, probably responding for this: MainRtspUrl, SubRtspUrl, Protocol.
But when I set direct RTSP stream in NVR channel 1 (MainRtspUrl), nothing happens, the picture does not appear.
Does anyone know if this is possible and can suggest the correct format for the above options?
./sofiactl.pl --user admin --host nvr-32 --port 34567 --command ConfigGet -co NetWork.RemoteDeviceV3[0] | jq
{
"NetWork.RemoteDeviceV3[0]": {
"TourIntv": 10,
"SynchResolution": false,
"ConnType": "SINGLE",
"EnCheckTime": true,
"Decoder": [
{
"PassWord": "",
"ConfName": "chConfig1",
"IPAddress": "192.168.1.41",
"Enable": true,
"MacAddr": "",
"SerialNo": "",
"UserName": "admin",
"StreamType": "MAIN",
"SubRtspUrl": "",
"Interval": 0,
"MainRtspUrl": "",
"Channel": 0,
"Port": 34567,
"DevType": "IPC",
"Protocol": "TCP"
}
],
"SingleConnId": "0x00000001",
"Enable": true
}
}
HI, thank for reversing it. Played with it a little bit and found some weird thing. So calling ChannelTitleSet from CMS (software) - changing the title and also updates it immediately in the video stream (so the new title immediately appears on the video from the cam). Calling the same thing from you .pl script does update channel title, but nothing happens to video. So old channel title is still there. Why this can be?
I'm pulling out my hair finding the modules in Archlinux.
Thank you so very much for this tool though, I don't really want to use the Chinese malware to configure my cameras.
Hi,
I'm newbie with Perl, I downloaded your project and try to run in cmd (win 10) , it works well for some commands. => good try
Now i want to search file with command OPFileQuery
I used WireShark to find this log from my camera :
{ "Name" : "OPFileQuery", "OPFileQuery" : { "BeginTime" : "2021-08-17 00:00:00", "Channel" : 0, "DriverTypeMask" : "0x0000FFFF", "EndTime" : "2021-08-17 23:59:59", "Event" : "*", "StreamType" : "0x00000000", "Type" : "h264" }, "SessionID" : "0x57" }
Then i used this command following your git:
sofiactl.pl --user "admin" --pass "correct_password" --host "correct_host" --port 34567 --command "OPFileQuery" --bt "2021-08-17 00:00:00" --et "2021-08-19 23:59:59" --ch 0 --d
I enter correct paramters , but it not return any data, this is the log:
Could you please help to advise.
Thanks.
My device has telnet disabled. I think it could be enabled by OPTelnetControl
command but I don't know the syntax. Is there some documentation where this can be looked up?
The strings in Sofia suggest that this should be possible:
$ strings Sofia | grep -i telnet
telnet
OnTelnetControl
OPTelnetControl
TelnetCommand
TelnetDisEnable
TelnetEnable
Is it possible to download the recorded files? I can see that its possible to download log files and configuration, is there any way to download the actual recordings? The ActiveX plugin and XMeye have this facility but it is really slow. I would be nice to be able to automate it via a script if possible.
Thanks
Hello,
I played with ConfigSet
method and I think I broke the camera configuration on HI3516
.
Now if I call
sofiactl.pl --user admin --host 192.168.1.10 --port 34567 --command ConfigGet --co AVEnc
I get a response that doesn't contain some of the fields, for example Encode:
'Encode' => undef,
'VideoColor' => undef,
'VideoWidget' => undef,
Do you know if there's a way to restore this configuration to get camera back to life?
P.S.
I have telnet access to the camera, but I couldn't find where this configuration is stored.
Thanks
When it try to download video files, after a bunch of downloads, the dvr crashes and the connection disconnects. has anyone else had this experience?
Im attempting to backup a full days worth of data via a script i wrote
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.