|
本帖最后由 likaci 于 2019-8-1 23:12 编辑
最近比较火的一款廉价摄像头, 拼夕夕上85块钱.
自称支持 onvif 协议, 但云台不能控制.
自己抓包分析了控制方法, 然后写了个脚本.
分析过程记录如下: https://blog.xiazhiri.com/Mercury-MIPC251C-4-Reverse.html
控制脚本: https://github.com/likaci/mercury-ipc-control
HA 接入很简单:
ffmpeg:
camera:
- platform: onvif
host: 192.168.2.2
port: 2020
username: admin
password: password
控制脚本的使用也很简单:
pip 安装依赖
pip install requests
pip install rsa
用法
python mipcc.py admin password url data
python mipcc.py admin password http://192.168.2.89:80 '{"method":"do","preset":{"goto_preset": {"id": "1"}}}'
数据
云台转动到预置点 {"method":"do","preset":{"goto_preset": {"id": "1"}}}
云台按坐标转动 {"method":"do","motor":{"move":{"x_coord":"10","y_coord":"0"}}}
云台水平步进 {"method":"do","motor":{"movestep":{"direction":"0"}}}
云台垂直步进 {"method":"do","motor":{"movestep":{"direction":"90"}}}
云台停止步进 {"method":"do","motor":{"stop":"null"}}
添加预置点 {"method":"do","preset":{"set_preset":{"name":"name","save_ptz":"1"}}}
静态遮蔽 {"method":"set","lens_mask":{"lens_mask_info":{"enabled":"on"}}}
//手动报警
{"method":"do","msg_alarm":{"manual_msg_alarm":{"action":"start"}}}
{"method":"do","msg_alarm":{"manual_msg_alarm":{"action":"stop"}}}
//绿色led开关
{"method":"set","led":{"config":{"enabled":"off"}}}
{"method":"set","led":{"config":{"enabled":"on"}}}
//智能追踪 摄像机追随移动物体
{"method":"set","target_track":{"target_track_info":{"enabled":"on"}}}
{"method":"set","target_track":{"target_track_info":{"enabled":"off"}}}
//检测到移动物体时报警
{"method":"set","msg_alarm":{"chn1_msg_alarm_info":{"enabled":"on","alarm_type":"0","alarm_mode":["sound"]}}}
{"method":"set","msg_alarm":{"chn1_msg_alarm_info":{"enabled":"on","alarm_type":"0","alarm_mode":["light"]}}}
{"method":"set","msg_alarm":{"chn1_msg_alarm_info":{"enabled":"on","alarm_type":"0","alarm_mode":["sound","light"]}}}
{"method":"set","msg_alarm_plan":{"chn1_msg_alarm_plan":{"enabled":"on","alarm_plan_1":"0000-0000%2c127"}}}
//移动侦测 与 侦测灵敏度
{"method":"set","motion_detection":{"motion_det":{"enabled":"off"}}}
{"method":"set","motion_detection":{"motion_det":{"enabled":"on"}}}
{"method":"set","motion_detection":{"motion_det":{"digital_sensitivity":"20"}}}
{"method":"set","motion_detection":{"motion_det":{"digital_sensitivity":"50"}}}
{"method":"set","motion_detection":{"motion_det":{"digital_sensitivity":"80"}}}
//是否录制与录制计划
{"method":"set","record_plan":{"chn1_channel":{"enabled":"off","monday":"%5b%220000-2400%3a2%22%5d","tuesday":"%5b%220000-2400%3a2%22%5d","wednesday":"%5b%220000-2400%3a2%22%5d","thursday":"%5b%220000-2400%3a2%22%5d","friday":"%5b%220000-2400%3a2%22%5d","saturday":"%5b%220000-2400%3a2%22%5d","sunday":"%5b%220000-2400%3a2%22%5d"}}}
{"method":"set","record_plan":{"chn1_channel":{"enabled":"on","monday":"%5b%220000-2400%3a2%22%5d","tuesday":"%5b%220000-2400%3a2%22%5d","wednesday":"%5b%220000-2400%3a2%22%5d","thursday":"%5b%220000-2400%3a2%22%5d","friday":"%5b%220000-2400%3a2%22%5d","saturday":"%5b%220000-2400%3a2%22%5d","sunday":"%5b%220000-2400%3a2%22%5d"}}}
//重启与定时重启
{"method":"do","system":{"reboot":"null"}}
{"method":"set","timing_reboot":{"reboot":{"enabled":"off","day":"7","time":"03%3a00%3a00"}}}
{"method":"set","timing_reboot":{"reboot":{"enabled":"on","day":"7","time":"03%3a00%3a00"}}}
//云台重置
{"method":"do","motor":{"manual_cali":"null"}}
//个性语音提示
{"method":"set","greeter":{"chn1_greeter_ctrl":{"enabled":"on"}}}
{"method":"set","greeter":{"chn1_greeter_ctrl":{"enabled":"off"}}}
//音量
{"method":"set","greeter":{"chn1_greeter_audio":{"enter_volume":"77","leave_volume":"77"}}}
//播放语音
{"method":"do","greeter":{"test_audio":{"force":"1"}}} 播放默认语音
{"method":"do","greeter":{"test_audio":{"id":"4096","force":"1"}}} 播放指定语音
//id
//0 无
//12288 你好
//4096-4104 依次为 你好欢迎光临 .....
//设置进入或离开语音
{"method":"set","greeter":{"chn1_greeter_audio":{"enter_audio_id":"0"}}} 无
{"method":"set","greeter":{"chn1_greeter_audio":{"leave_audio_id":"4104"}}}
然后就可以实现一些自动化的功能, 比如晚上自动遮蔽镜头 转向面墙的方向.
家中无人 PIR 触发通知, 通知里查看监控画面等
|
评分
-
查看全部评分
|