|
本帖最后由 ABC 于 2017-5-18 15:56 编辑
用一个我的博联控制的射频吊扇作为例子
- platform: broadlink
host: 192.168.1.168
mac: '34:EA:3x:xx:xx:xx'
switches:
close:
friendly_name: "close"
command_on: 'sg8yAA4aHAsO7g4aHQscCxwLDhkcCw4ZHAwcCw4aHAsOGRwLDhkOGhwMHAscCw4ZDhoAAAAAAAA'
command_off: 'sg8yAA4aHAsO7g4aHQscCxwLDhkcCw4ZHAwcCw4aHAsOGRwLDhkOGhwMHAscCw4ZDhoLAAAAAAAA'
low:
friendly_name: "low"
command_on: 'sg8yAA0aDe8NGhsMGwwbDA0aDRobDA0bHAwNGhsMDRobDBsMHAwbDBsMHAwNGg0aDRoNGgAAAAAAAA'
command_off: 'sg8yAA0aDe8NGhsMGwwbDA0aDRobDA0bHAwNGhsMDRobDBsMHAwbDBsMHAwNGg0aDRoNGgAAAAAAAA'
middle:
friendly_name: "middle"
command_on: 'smcyABwMHAwcCw4aDRoNGhwMGwwNGg3vDRocCxwMHAwNGhwLHAwcDBwLDhocCw0aHAwNGhAAAAAAAA'
command_off: 'smcyABwMHAwcCw4aDRoNGhwMGwwNGg3vDRocCxwMHAwNGhwLHAwcDBwLDhocCw0aHAwNGhAAAAAAAA'
high:
friendly_name: "high"
command_on: 'slEyAA0aGwwNGg0aDRoNGhwMHAwbDA0aDRoOGg0aDRoOGhwMHAwcCxwMHAwNGg0aDRoc3vAAAAAAAA'
command_off: 'slEyAA0aGwwNGg0aDRoNGhwMHAwbDA0aDRoOGg0aDRoOGhwMHAwcCxwMHAwNGg0aDRoc3vAAAAAAAA'
one_hour:
friendly_name: "one_hour"
command_on: 'skwyAA0bDRoNGxsMDRobDA0aDRoNGg0aDRocDBsMDRoNGhwMHAwOGg0aDu8NGhwMHAwcwMAAAAAAAA'
command_off: 'skwyAA0bDRoNGxsMDRobDA0aDRoNGg0aDRocDBsMDRoNGhwMHAwOGg0aDu8NGhwMHAwcwMAAAAAAAA'
two_hours:
friendly_name: "two_hours"
command_on: 'sqUyAA8ZHQwdCw4ZHQsOGQ8ZDxkOGR0MHQsdCw4ZDhkdCx0LDhkcCw7vDhodCxwLHQsd4ZAAAAAAAA'
command_off: 'sqUyAA8ZHQwdCw4ZHQsOGQ8ZDxkOGR0MHQsdCw4ZDhkdCx0LDhkcCw7vDhodCxwLHQsd4ZAAAAAAAA'
four_hours:
friendly_name: "four_hours"
command_on: 'sm4yAA0aHAsNGhwLDhocCw4aDhocDA4aDhocCxwLDhoNGg0aHAscCxwLDRoNGhwLDhoN7vAAAAAAAA'
command_off: 'sm4yAA0aHAsNGhwLDhocCw4aDhocDA4aDhocCxwLDhoNGg0aHAscCxwLDRoNGhwLDhoN7vAAAAAAAA'
eight_hours:
friendly_name: "eight_hours"
command_on: 'snYyAA0aHAwNGhwMHAwNGg0aDRocDA0aDRocDA0aDRoNGg4aHAwcCxwMDRocDBwLDRoN7vAAAAAAAA'
command_off: 'snYyAA0aHAwNGhwMHAwNGg0aDRocDA0aDRocDA0aDRoNGg4aHAwcCxwMDRocDBwLDRoN7vAAAAAAAA'
在input_select:写入
diaoshan:
name: "吊扇"
icon: mdi:fan
initial: "关"
options:
- "关"
- "低"
- "中"
- "高"
- "一小时"
- "两小时"
- "四小时"
- "八小时"
在自动化automation:写入
alias: 1
initial_state: true
hide_entity: true
trigger:
- platform: state
entity_id: input_select.diaoshan
action:
- service: switch.toggle
data_template:
entity_id: >
{% if is_state("input_select.diaoshan", "关") %} switch.close
{% elif is_state("input_select.diaoshan", "低") %} switch.low
{% elif is_state("input_select.diaoshan", "中") %} switch.middle
{% elif is_state("input_select.diaoshan", "高") %} switch.high
{% elif is_state("input_select.diaoshan", "一小时") %} switch.one_hour
{% elif is_state("input_select.diaoshan", "两小时") %} switch.two_hours
{% elif is_state("input_select.diaoshan", "四小时") %} switch.four_hours
{% elif is_state("input_select.diaoshan", "八小时") %} switch.eight_hours
{% endif %}
|
-
|