众所周知,海康的摄像头接入HASS,已经完美实现,但是,有云台功能的摄像头不能用HASS控制,也太可惜了!昨晚研究了一下,原来海康有完善的云台控制API,只是实现起来,需要一些trick。
废话不多说,教程开始:
1、先决条件,先把海康摄像头接入wifi(最好分配固定ip),然后使用浏览器打开摄像头ip,用户名为admin,密码默认是admin或12345,如果不对,看这个贴子重置密码;
2、之后,在homeassistant配置目录中,新建camera文件夹,把附件中几个xml拷入;
3、然后,在configuration.yaml里,加入以下代码,注意将其中的admin后面的12345换为你自己的密码,192.168.6.100换为你摄像头的ip:
cover:
platform: command_line
covers:
camera_left_right:
command_open: "curl -X PUT -T /home/homeassistant/.homeassistant/camera/left.xml http://admin:[email protected]/PTZCtrl/channels/1/continuous"
command_close: "curl -X PUT -T /home/homeassistant/.homeassistant/camera/right.xml http://admin:[email protected]/PTZCtrl/channels/1/continuous"
command_stop: "curl -X PUT -T /home/homeassistant/.homeassistant/camera/stop.xml http://admin:[email protected]/PTZCtrl/channels/1/continuous"
camera_up_down:
command_open: "curl -X PUT -T /home/homeassistant/.homeassistant/camera/up.xml http://admin:[email protected]/PTZCtrl/channels/1/continuous"
command_close: "curl -X PUT -T /home/homeassistant/.homeassistant/camera/down.xml http://admin:[email protected]/PTZCtrl/channels/1/continuous"
command_stop: "curl -X PUT -T /home/homeassistant/.homeassistant/camera/stop.xml http://admin:[email protected]/PTZCtrl/channels/1/continuous"
4、然后将以下两个entity放入你想放的group里,,重启hass:
- cover.camera_left_right
- cover.camera_up_down
最终效果如下:
附件下载(解压密码 bbs.hassbian.com):
camera.rar
(664 Bytes, 下载次数: 222)
|