Comments (6)
yep pretty much
from cameraevents.
Hi.
No there's a call in there (a curl command) to an API on the camera/nvr that is a stream of events. So when an event is triggered it writes to that stream (the code is in the OnReceive method at this point), it then looks for some info in the received event and then calls for a snapshot image and post out an mqtt message.
from cameraevents.
OnReceive
So This line?
Line 841 in ed54c3e
I am new to cURL but familiar with HTTP requests. Can I see a cURL as a sort of 'hotline' (read: direct connection) and refreshes automatically the content on the line as frequent as possible and doesn't close the connection like a HTTP request does?
Sort of like a website and F5 refresh is pushed as much as possible so the content gets updated every time?
from cameraevents.
thats setting an option for pycurl -to use the onreceive method for any data written by pycurl.
Pycurl, is a python implemention of the cUrl binary. So instead of a single call, which exits, the dahua api, keeps the stream open, and when events occur they write to that open curl stream.
Eg:
--myboundary
Content-Type: text/plain
Content-Length:37
Code=VideoMotion;action=Start;index=5
--myboundary
Content-Type: text/plain
Content-Length:37
Code=VideoMotion;action=Start;index=5
Is what is received for a videomotion event. So when I see that, I can see the camera (index 5) and that it's a start. A stop event is also triggered which is the end of the event.
Most of the pycurl stuff came from another source. THen I added the MQTT and snapshot extraction.
from cameraevents.
Thanks for the info. So there is only one initial connection (continuously) made to the Dahua device from your python script and the Dahua NVR or CAM PUSHes data, like your example above, towards the stream when a event occurs. Then in your code this is followed by a function like IF data is received AND you find string-data like 'VideoMotion' and 'action=Start' THEN to do some MQTT handling ELSE do x. Like this?
from cameraevents.
Thanks! cURL and open stream are the keywords :-) I do understand now. Thumps up for the app. I shall close the issue.
from cameraevents.
Related Issues (20)
- Can not find config file when executet from another directory HOT 1
- [enhancement] Patch to add auth support for MQTT HOT 20
- Add Dahua VTO support HOT 1
- Invalid Syntax on Raspbian HOT 3
- Question: Names of the IVS configurations HOT 7
- AlarmLocal on NVR HOT 49
- Configuration: channels index range HOT 1
- Configure Home Assistant to receive image HOT 5
- NetAlarm HOT 7
- IP Camera unreachable after a while
- Invalid authority HOT 4
- Supporting additional audio events HOT 17
- Cannot connect to Amcrest NVR HOT 4
- "alerts" config parameter ignored HOT 10
- Never sends snapshot images HOT 1
- Payload error in event VideoMotion when stop. HOT 5
- Travis Build failing for armv6/7 arm64 images
- No snapshot published to MQTT HOT 8
- small bug fixes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cameraevents.