之前学习@neroxps的帖子https://bbs.hassbian.com/thread-3852-1-1.html
大佬的配置里有大方所有传感器的mqtt配置,除了负责云台的两个cover
一直想怎么手动配置,自动发现倒是好用,但是一旦HA重启,就需要重新自动发现,大方那边要不重启,要不重启mqtt相关的服务
https://bbs.hassbian.com/thread-6061-1-1.html
https://bbs.hassbian.com/thread-5866-1-1.html
↑↑↑↑↑↑同样遇到这种问题的朋友↑↑↑↑↑↑↑
hack的作者在github上也只说了mqtt自动发现的方法
我小白一个,在爬了N多帖之后,终于尝试成功手动配置cover的两个选项,配合@chiunownow的https://bbs.hassbian.com/thread-6325-1-1.html,完美实现云台控制
(其实也不算完美,我这里使用lovelace-slider-entity-row,滑动并不能很准确定位,大家试试就知道了)
其他传感器参考N大帖子下面的配置,这里只放出cover的两个选项
之后大方的mqtt自动发现可以关了
cover:
- platform: mqtt
name: "dafang move up/down"
set_position_topic: "myhome/dafang/motors/vertical/set"
position_topic: "myhome/dafang/motors/vertical"
command_topic: "myhome/dafang/motors/vertical/set"
qos: 1
payload_close: "down"
payload_open: "up"
optimistic: false
value_template: "{{ ((value|int)/7)|round }}"
set_position_template: "{{ ((position|int)*7)|round }}"
- platform: mqtt
name: "dafang move left/right"
set_position_topic: "myhome/dafang/motors/horizontal/set"
position_topic: "myhome/dafang/motors/horizontal"
command_topic: "myhome/dafang/motors/horizontal/set"
qos: 1
payload_close: "right"
payload_open: "left"
optimistic: false
value_template: "{{ ((value|int)/26)|round }}"
set_position_template: "{{ ((position|int)*26)|round }}"
注:大方有限位传感器版本,最新破解版本,测试通过,水平2600,垂直700,步长100
另:n大的控制指令好像集成进去了,大方ssh下执行/system/sdcard/scripts/PTZpresets.sh 400 400可以直接控制电机到指定位置
但HA宿主机ssh下输入 wget --output-document=/dev/null --no-check-certificate "https://大方用户名:大方的密码@大方的IP地址/cgi-bin/action.cgi?cmd=motor_PTZ&x_axis=400&y_axis=400则无返回,无法实现HA自动化,在此求教怎么实现
|