本帖最后由 jyz_0501 于 2018-12-7 10:51 编辑
以前一直用homebridge因为手头有个S1C 监控着我的车库,一直在用S1C的homebridge插件,所以很久没有停掉,懒癌晚期不想折腾导致一直没处理这个问题,
但是其他插件都被原生HK代替了,只剩下这一个 感觉有点鸡肋,
最终强迫症战胜了懒癌,开始动手解决它。
因为S1C的HA插件貌似作者有地方定义写错了,门磁传感器在HK中并不显示,简单研究了下,重新定义了一个binary_sensor 屏蔽掉原来的,就可以了。
简单配置:
cover:
#窗帘射频模块@zorankeinfo修改版
- platform: rm_cover
#窗帘射频模块@roiff
# - platform: broadlink
host: !secret blrm_host
mac: !secret blrm_mac
covers:
garage_east:
travel_time: 8
# position_sensor: sensor.broadlink_s1c_东车库门磁
name: "东车库门"
command_open: 'sgCcAAolCyUlCyQLJQolCwolCiYlCgomJQoKJgolJQslCgomCiUlCiULJQsKJQolCiYlCgwAAVAKJQslJQolCyULJAsKJgkmJQoK'
command_close: 'sgCGAAskCyQkCyMMIwwjCwskCyQkCwolIwwKJQokJAskCwskCiUjDCMMIwskCwskCyQKJAwAAVAKJQokJAskCyQLJAsKJQolIws'
command_stop: 'sgCiACULCyUkCwskCyQMAAFQCiUKJSULJAslCyQLCyUKJSQLCyUkCwslCiUkCyULCyQLJSQLJQolCwskJQsKJQskDAABUAolCiUkDCQLJAslCwolCyUk'
- platform: template
covers:
gd_east_temp:
friendly_name: '东车库门'
value_template: "{% if not is_state('sensor.broadlink_s1c_东车库门磁', 'closed') %}open{% else %}closed{% endif %}"
open_cover:
service: script.turn_on
entity_id: script.garage_east_open
close_cover:
service: script.turn_on
entity_id: script.garage_east_close
stop_cover:
service: cover.stop_cover
entity_id: cover.garage_east
icon_template: "{% if not is_state('sensor.broadlink_s1c_东车库门磁', 'closed') %}mdi:garage-open{% else %}mdi:garage{% endif %}"
binary_sensor:
- platform: template
sensors:
movement_1:
device_class: motion
value_template: "{{ is_state('sensor.broadlink_s1c_东车库红外', 'motion_detected') }}"
door_1:
device_class: opening
value_template: "{{ is_state('sensor.broadlink_s1c_东车库门磁', 'open') }}"
automation:
- alias: Garage_Open_East
initial_state: false
trigger:
- platform: state
entity_id: cover.gd_east_temp
from: 'closed'
to: 'open'
action:
- service: hello_miai.force_send
# - service: tts.baidu_say
# entity_id: media_player.mopidy,media_player.kodi5
data_template:
message: "东边车库门被打开。"
# cache: false
- alias: Garage_Closed_East
initial_state: false
trigger:
- platform: state
entity_id: cover.gd_east_temp
from: 'open'
to: 'closed'
action:
- service: hello_miai.force_send
# - service: tts.baidu_say
# entity_id: media_player.mopidy,media_player.kodi5
data_template:
message: "东边车库门已关上。"
# cache: false
group:
EastGD:
name: 东车库
view: no
entities:
- cover.garage_east
- cover.gd_east_temp
- binary_sensor.movement_1
- binary_sensor.door_1
- sensor.broadlink_s1c_遥控器
- script.garage_east_open
- script.garage_east_close
homeassistant:
customize:
cover.garage_east:
friendly_name: 东车库门
homebridge_name: 车库东门
hidden: true
homebridge_cover_type: garage_door
device_class: garage
initial_state: 'off'
cover.gd_east_temp:
homebridge_name: 车库东门
device_class: garage
sensor.broadlink_s1c_东车库红外:
hidden: true
sensor.broadlink_s1c_东车库门磁:
hidden: true
binary_sensor.movement_1:
friendly_name: 东车库移动检测
binary_sensor.door_1:
friendly_name: 东车库门状态
|