不使用mqtt帮我生成一段yaml用于控制电动窗帘以接入homeassistant,采用esp8266控制板,电机驱动采用uln2003,一共有三个按钮,开启、关闭和停止,使用stepprt和cover
时间: 2024-06-06 18:08:40 浏览: 181
- platform: mqtt
name: "电动窗帘"
state_topic: "home/电动窗帘/state"
command_topic: "home/电动窗帘/set"
availability_topic: "home/电动窗帘/availability"
qos: 0
retain: true
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
position_topic: "home/电动窗帘/position"
set_position_topic: "home/电动窗帘/set_position"
position_open: 0
position_closed: 100
payload_available: "online"
payload_not_available: "offline"
optimistic: false
retain: true
- platform: template
covers:
window_cover:
friendly_name: "电动窗帘"
value_template: "{{ states('cover.电动窗帘') }}"
position_template: "{{ state_attr('cover.电动窗帘', 'current_position') }}"
open_cover:
service: mqtt.publish
data:
topic: "home/电动窗帘/set"
payload: "open"
close_cover:
service: mqtt.publish
data:
topic: "home/电动窗帘/set"
payload: "close"
stop_cover:
service: mqtt.publish
data:
topic: "home/电动窗帘/set"
payload: "stop"
set_cover_position:
service: mqtt.publish
data:
topic: "home/电动窗帘/set_position"
payload_template: "{{ position }}"
position_open: 0
position_closed: 100
optimistic: false
retain: true
- platform: mqtt
name: "电动窗帘状态"
state_topic: "home/电动窗帘/state"
qos: 0
payload_on: "开启"
payload_off: "关闭"
payload_stop: "停止"
retain: true
- platform: mqtt
name: "电动窗帘位置"
state_topic: "home/电动窗帘/position"
command_topic: "home/电动窗帘/set_position"
qos: 0
retain: true
阅读全文