用cover卡片,HA的command_line组件执行命令就行了,下面是例子
cover:
- platform: command_line
covers:
camera_left_right:
friendly_name: "左右旋转"
command_open: python mipcc.py admin password http://192.168.xx.xx:80 '{"method":"do","motor":{"move":{"x_coord":"-10","y_coord":"0"}}}'
command_close: python mipcc.py admin password http://192.168.xx.xx:80 '{"method":"do","motor":{"move":{"x_coord":"10","y_coord":"0"}}}'
camera_up_down:
friendly_name: "上下旋转"
command_open: python mipcc.py admin password http://192.168.xx.xx:80 '{"method":"do","motor":{"move":{"x_coord":"0","y_coord":"10"}}}'
command_close: python mipcc.py admin password http://192.168.xx.xx:80 '{"method":"do","motor":{"move":{"x_coord":"0","y_coord":"-10"}}}'
然后在lovelace里面添加
- entities:
- entity: cover.zuo_you_xuan_zhuan
- entity: cover.shang_xia_xuan_zhuan
效果如图:
现在只是初步实现在HA里面转动这款摄像头的云台,下一步再优化下按钮吧,而且HA上显示的监控画面还不是实时的,10秒刷新一次画面,用live的话又好像传输很卡,有待解决
|