本帖最后由 archenemy 于 2017-7-6 20:44 编辑
特别感谢论坛ABC大神的分享,我只是教程的搬运工
首先:得有一台RGB灯接入HA,Yeelight,小米网关灯都可以...
然后:在configuration.yaml中添加一下代码:
input_slider中添加:brightness:
name: '网关亮度调节'
icon: mdi:lightbulb-on
initial: 0
min: 0
max: 255
step: 1
b:
name: '网关蓝色调节'
icon: mdi:lightbulb-on
initial: 0
min: 0
max: 255
step: 1
r:
name: '网关红色调节'
icon: mdi:lightbulb-on
initial: 0
min: 0
max: 255
step: 1
g:
name: '网关绿色调节'
icon: mdi:lightbulb-on
initial: 0
min: 0
max: 255
step: 1
automation中添加:
alias: tiaojie
initial_state: true
hide_entity: true
trigger:
- platform: state
entity_id: input_slider.g
- platform: state
entity_id: input_slider.r
- platform: state
entity_id: input_slider.brightness
- platform: state
entity_id: input_slider.b
action:
- service: light.turn_on
data_template:
entity_id: light.gateway_light_286c0788b403
rgb_color: ['{{ states.input_slider.r.state | int }}','{{ states.input_slider.g.state | int }}','{{ states.input_slider.b.state | int }}']
brightness: '{{ states.input_slider.brightness.state | int }}'
- service: light.turn_off
data_template:
brightness: '{{ states.input_slider.brightness.state == 0 }}'
如果是Yeelight的白光灯,去掉以上代码中的蓝色、红色、绿色调节部分,可以单独实现亮度的调节,大家按需调整
最后在group中添加:
- input_slider.r
- input_slider.g
- input_slider.b
- input_slider.brightness
- automation.tiaojie
即可实现以下手动调节:
|