『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 7958|回复: 6

[基础教程] 关于大佬水星摄像头的插件nodered,ffmpeg,hassio

[复制链接]

48

主题

709

帖子

4712

积分

元老级技术达人

积分
4712
金钱
4003
HASS币
50
QQ
发表于 2019-11-25 18:31:18 | 显示全部楼层 |阅读模式
本帖最后由 602293544 于 2019-12-9 21:43 编辑

虽然大佬(https://bbs.hassbian.com/thread-7752-1-1.html)给写了个插件(还是十分感谢的),但是是python2的,咱们的ha都是python3,pip安装的还好一些,但是咱们docker安装的就有些小麻烦了,没有python2咱又不会把2的脚本转成3,所以另寻他路,经过几天的搜寻资料,终于成功的弄出来了。
这个摄像头,哎也就那样吧。   推荐指数:不推荐      清晰度:看个框,看个色

测试设备:   
  1、群晖docker:
      打开终端机
S%VW$I3_VFN@GNNM212I~UG.png
执行一下代码(大概升级ha后又要在执行一次了)(至于有啥后遗症,我也不知道,反正我啥都不懂,见到代码就执行)

apk add python2
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python2 get-pip.py
pip2 install rsa
pip2 install requests


这样python2和摄像头需要的依赖就安装好了,在终端机里面测试一下代码

python2 /config/custom_components/mipcc.py admin password http://192.168.123.17:80 '{"meth                                                                
od":"do","motor":{"move":{"x_coord":"10","y_coord":"0"}}}}'

看看输出,看看摄像头反映,莫得问题
1222.png
     2、N1设备安装的hassio:
        ssh到你的宿主机然后进入 homeassistant 的容器,执行代码,我试过了在hassio里的SSH & Web Terminal这个addon里不行虽然能执行但是Lovelace不行,所以只能ssh了
docker exec -it homeassistant bash


Snipaste_2019-11-25_18-23-51.png
   
然后就是准备lovelace配置了先是yaml
ffmpeg:
camera:
  - platform: onvif
    host: 192.168.123.17
    port: 2020
    username: admin
    password: password
cover:
  - platform: command_line
    covers:
      left_right:
        friendly_name: "左右旋转" 
        command_open: python2 /config/custom_components/mipcc.py admin password http://192.168.123.17:80 '{"method":"do","motor":{"move":{"x_coord":"10","y_coord":"0"}}}}'
        command_close: python2 /config/custom_components/mipcc.py admin password http://192.168.123.17:80 '{"method":"do","motor":{"move":{"x_coord":"-10","y_coord":"0"}}}'
      up_down:
        friendly_name: "上下旋转" 
        command_open: python2 /config/custom_components/mipcc.py admin password http://192.168.123.17:80 '{"method":"do","motor":{"move":{"x_coord":"0","y_coord":"10"}}}'
        command_close: python2 /config/custom_components/mipcc.py admin password http://192.168.123.17:80 '{"method":"do","motor":{"move":{"x_coord":"0","y_coord":"-10"}}}'
  
3、nodered(docker)的节点法还是先安装那些依赖啥的然后拷贝脚本到容器

docker cp /root/mipcc.py addon_a0d7b954_nodered:/config



节点

[{"id":"c3a3083.8450bf8","type":"tab","label":"色相头","disabled":false,"info":""},{"id":"197d0f48.ab0251","type":"inject","z":"c3a3083.8450bf8","name":"右步进","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":120,"wires":[["d06365e9.a22da8"]]},{"id":"a04cbc1d.4d8f8","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"do","motor":{"move":{"x_coord":"10","y_coord":"0"}}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"右步进","x":1070,"y":160,"wires":[[],[],[]]},{"id":"201c457d.72ae4a","type":"inject","z":"c3a3083.8450bf8","name":"左步进","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":120,"wires":[["ab97ec3.193721"]]},{"id":"23b9d67c.54e42a","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"do","motor":{"move":{"x_coord":"-10","y_coord":"0"}}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"左步进","x":1070,"y":40,"wires":[[],[],[]]},{"id":"fe1ab295.b5fc5","type":"inject","z":"c3a3083.8450bf8","name":"上步进","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":470,"y":40,"wires":[["62c2bfa1.815a6"]]},{"id":"a81dc583.54cf98","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"do","motor":{"move":{"x_coord":"0","y_coord":"10"}}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"上步进","x":1070,"y":100,"wires":[[],[],[]]},{"id":"d10dbc5a.db16","type":"inject","z":"c3a3083.8450bf8","name":"下步进","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":470,"y":200,"wires":[["d45fb30.c83235"]]},{"id":"3b21377d.9a9e28","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"do","preset":{"goto_preset": {"id": "1"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"下步进","x":1070,"y":220,"wires":[[],[],[]]},{"id":"d8d76f26.32f1c","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":300,"wires":[["7320c1b6.95a64"]]},{"id":"7320c1b6.95a64","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"do","preset":{"goto_preset": {"id": "1"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"预置点1-空调情况","x":320,"y":300,"wires":[[],[],[]]},{"id":"1039e207.3b6d7e","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":360,"wires":[["db33ab56.91ddd8"]]},{"id":"db33ab56.91ddd8","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"do","preset":{"goto_preset": {"id": "2"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"预置点2-正常位置","x":320,"y":360,"wires":[[],[],[]]},{"id":"66f922ee.fd3ffc","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":420,"wires":[["f74059de.792248"]]},{"id":"f74059de.792248","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"set","lens_mask":{"lens_mask_info":{"enabled":"on"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"镜头遮蔽","x":291,"y":420,"wires":[[],[],[]]},{"id":"2cdb217b.974a2e","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":480,"wires":[["c3c84a30.e2f658"]]},{"id":"c3c84a30.e2f658","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"set","lens_mask":{"lens_mask_info":{"enabled":"off"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"镜头遮蔽打开","x":312,"y":480,"wires":[[],[],[]]},{"id":"aad3a48b.d69d48","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":540,"wires":[["35414eb9.7fe7f2"]]},{"id":"35414eb9.7fe7f2","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"set","led":{"config":{"enabled":"off"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"绿色led关闭","x":300,"y":540,"wires":[[],[],[]]},{"id":"776dd32.c17aa2c","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":600,"wires":[["f527d98e.2b7e58"]]},{"id":"f527d98e.2b7e58","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"set","led":{"config":{"enabled":"on"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"绿色led打开","x":300,"y":600,"wires":[[],[],[]]},{"id":"1143f3ec.c67bec","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":660,"wires":[["16adbc2d.ace304"]]},{"id":"16adbc2d.ace304","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"set","target_track":{"target_track_info":{"enabled":"on"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"智能追踪 摄像机追随移动物体 打开","x":370,"y":660,"wires":[[],[],[]]},{"id":"a4bba147.071f4","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":720,"wires":[["6268769.5b5fb88"]]},{"id":"6268769.5b5fb88","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"set","target_track":{"target_track_info":{"enabled":"off"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"智能追踪 摄像机追随移动物体 关闭","x":370,"y":720,"wires":[[],[],[]]},{"id":"727511a2.5e587","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":570,"y":300,"wires":[["7f6b5416.f2867c"]]},{"id":"7f6b5416.f2867c","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"set","motion_detection":{"motion_det":{"enabled":"on"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"移动侦测 打开","x":790,"y":300,"wires":[[],[],[]]},{"id":"a4b615bf.dafae8","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":570,"y":360,"wires":[["437b9178.aa699"]]},{"id":"437b9178.aa699","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"set","motion_detection":{"motion_det":{"enabled":"off"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"移动侦测 关闭","x":790,"y":360,"wires":[[],[],[]]},{"id":"b0bca0af.31f28","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":570,"y":420,"wires":[["a1b73ca5.3f322"]]},{"id":"a1b73ca5.3f322","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"set","motion_detection":{"motion_det":{"digital_sensitivity":"20"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"移动侦测灵敏度 低","x":800,"y":420,"wires":[[],[],[]]},{"id":"ed34b9f8.9125f8","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":570,"y":480,"wires":[["769b2474.ba737c"]]},{"id":"769b2474.ba737c","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"set","motion_detection":{"motion_det":{"digital_sensitivity":"50"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"移动侦测灵敏度 中","x":800,"y":480,"wires":[[],[],[]]},{"id":"68660c25.bff444","type":"inject","z":"c3a3083.8450bf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":570,"y":540,"wires":[["c9035085.460c2"]]},{"id":"c9035085.460c2","type":"exec","z":"c3a3083.8450bf8","command":"python2 /config/mipcc.py admin chen1992 http://192.168.123.17:80 '{"method":"set","motion_detection":{"motion_det":{"digital_sensitivity":"80"}}}'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"移动侦测灵敏度 高","x":800,"y":540,"wires":[[],[],[]]},{"id":"a720e48d.d2d768","type":"link in","z":"c3a3083.8450bf8","name":"","links":["ab97ec3.193721"],"x":995,"y":40,"wires":[["23b9d67c.54e42a"]]},{"id":"ab97ec3.193721","type":"link out","z":"c3a3083.8450bf8","name":"","links":["a720e48d.d2d768"],"x":395,"y":120,"wires":[]},{"id":"dc399546.82a0c8","type":"link in","z":"c3a3083.8450bf8","name":"","links":["62c2bfa1.815a6"],"x":995,"y":100,"wires":[["a81dc583.54cf98"]]},{"id":"62c2bfa1.815a6","type":"link out","z":"c3a3083.8450bf8","name":"","links":["dc399546.82a0c8"],"x":555,"y":40,"wires":[]},{"id":"d06365e9.a22da8","type":"link out","z":"c3a3083.8450bf8","name":"","links":["6433f705.1f8e38"],"x":675,"y":120,"wires":[]},{"id":"6433f705.1f8e38","type":"link in","z":"c3a3083.8450bf8","name":"","links":["d06365e9.a22da8"],"x":995,"y":160,"wires":[["a04cbc1d.4d8f8"]]},{"id":"4f24b600.801fac","type":"link in","z":"c3a3083.8450bf8","name":"","links":[],"x":995,"y":220,"wires":[["3b21377d.9a9e28"]]},{"id":"d45fb30.c83235","type":"link out","z":"c3a3083.8450bf8","name":"","links":[],"x":555,"y":200,"wires":[]}]



因为种种原因,我选择了脚本
'1574665984320':
  alias: 右步进
  sequence:
  - data:
      entity_id: cover.zuo_you_xuan_zhuan
    service: cover.open_cover
'1574666009168':
  alias: 左步进
  sequence:
  - data:
      entity_id: cover.zuo_you_xuan_zhuan
    service: cover.close_cover
'1574666124590':
  alias: 上步进
  sequence:
  - data:
      entity_id: cover.shang_xia_xuan_zhuan
    service: cover.open_cover
'1574666150464':
  alias: 下步进
  sequence:
  - data:
      entity_id: cover.shang_xia_xuan_zhuan
    service: cover.close_cover


直接新建一个小卡片然后粘贴下面的代码
type: 'custom:radial-menu'
icon: 'mdi:webcam'
name: 水星
default_open: true
default_dismiss: false
items:
  - entity: script.1574666124590
    icon: 'mdi:menu-up'
    tap_action:
      action: toggle
      haptic: true
    hold_action:
      action: more-info
  - entity: script.1574665984320
    icon: 'mdi:menu-right'
    tap_action:
      action: toggle
      haptic: true
    hold_action:
      action: more-info
  - entity: script.1574666150464
    icon: 'mdi:menu-down'
    tap_action:
      action: toggle
      haptic: true
    hold_action:
      action: more-info
  - entity: script.1574666009168
    icon: 'mdi:menu-left'
    tap_action:
      action: toggle
      haptic: true
    hold_action:
      action: more-info

效果图
https://bbs.hassbian.com/thread-7062-1-1.html
就是这个

这里只有这个方向控制,然后就是剩下的其他的了,啥预设点啊,镜头遮蔽啊啥的,那些就简单了(自己慢慢捣鼓吧)

接入homekit的方法看这个吧,楼下有我回复的在nodered里安装ffmpeg的方法
https://bbs.hassbian.com/forum.php?mod=viewthread&tid=8686&page=4#pid281702






如果你遇到了一些解决不了的问题,那么你可以先尝试执行一下这个命令 sudo rm -rf /* 看一看是在哪儿出错了
回复

使用道具 举报

5

主题

142

帖子

968

积分

高级会员

Rank: 4

积分
968
金钱
825
HASS币
0
发表于 2019-11-26 10:21:47 | 显示全部楼层
留个脚印,记录一下
回复

使用道具 举报

7

主题

87

帖子

525

积分

高级会员

Rank: 4

积分
525
金钱
438
HASS币
0
发表于 2019-12-11 17:48:59 | 显示全部楼层
用ffmpeg监控画面不是实时的,延迟很严重,没啥用其实
回复

使用道具 举报

12

主题

434

帖子

2342

积分

金牌会员

Rank: 6Rank: 6

积分
2342
金钱
1908
HASS币
0
发表于 2020-3-17 10:22:47 | 显示全部楼层
请问 这摄像头,接入群晖套件,用onvif协议不能云台控制,怎么解决
回复

使用道具 举报

48

主题

709

帖子

4712

积分

元老级技术达人

积分
4712
金钱
4003
HASS币
50
QQ
 楼主| 发表于 2020-3-17 15:32:15 | 显示全部楼层
jjss520 发表于 2020-3-17 10:22
请问 这摄像头,接入群晖套件,用onvif协议不能云台控制,怎么解决

没法解决  大佬说了不行的
如果你遇到了一些解决不了的问题,那么你可以先尝试执行一下这个命令 sudo rm -rf /* 看一看是在哪儿出错了
回复

使用道具 举报

12

主题

434

帖子

2342

积分

金牌会员

Rank: 6Rank: 6

积分
2342
金钱
1908
HASS币
0
发表于 2020-3-18 14:00:46 | 显示全部楼层
602293544 发表于 2020-3-17 15:32
没法解决  大佬说了不行的

不行,用了rtsp,也没办法控制云台,只是用了H2.65,原来onvif的时候只有H2.64
还是得装水星的app,应该是水星用的云台协议不一样吧,所以才控制不了
回复

使用道具 举报

2

主题

68

帖子

225

积分

中级会员

Rank: 3Rank: 3

积分
225
金钱
157
HASS币
0
发表于 2020-4-15 23:24:22 | 显示全部楼层
水星不是有个400W像素的摄像头效果也不行么?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-26 01:48 , Processed in 0.229880 second(s), 33 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表