本帖最后由 leoyanger 于 2017-11-16 22:52 编辑
刷ESPEASY 参考https://bbs.hassbian.com/forum.p ... =%E9%97%A8%E7%A3%81参考了https://community.home-assistant ... peasy-mqtt/29448/23
编码器按钮
旋转编码器配置
在configuration里添加传感器:
sensor:
- platform: mqtt
state_topic: "/esp01/dimmer/state"
name: "Office Dimmer Brightness"
retain: true
- platform: template
sensors:
normalised_office_dimmer_brightness_256:
value_template: '{{ states.sensor.office_dimmer_brightness.state | multiply (4) | round (0) }}'
friendly_name: 'Normalised Office Dimmer Brightness'
input_boolean:
philips_sf_dim:
name: ShuFang Dim
initial: off
automatiom:- alias: Switch shufang light
trigger:
platform: mqtt
topic: /esp01/dimmer/state
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.philips_sf_dim
state: 'off'
- condition: state
entity_id: light.xiaomi_philips_smart_led_ball_sf
state: 'on'
action:
service: light.turn_on
entity_id: light.xiaomi_philips_smart_led_ball_sf
data_template:
brightness: '{{states.sensor.normalised_office_dimmer_brightness_256.state}}'
- alias: Switch shufang light on
trigger:
platform: state
entity_id: light.xiaomi_philips_smart_led_ball_sf
rom: 'on'
to: 'off'
action:
service: input_boolean.turn_on
entity_id: input_boolean.philips_sf_dim
- alias: Switch shufang light off
trigger:
platform: state
entity_id: light.xiaomi_philips_smart_led_ball_sf
from: 'on'
to: 'off'
action:
service: input_boolean.turn_off
entity_id: input_boolean.philips_sf_dim
- alias: Switch sf light
trigger:
platform: state
entity_id: switch.esp_dimmer_switch
action:
service_template: >
{%- if states('switch.esp_dimmer_switch') == 'off' -%}
light.turn_off
{%- else -%}
light.turn_on
{%- endif -%}
entity_id: light.xiaomi_philips_smart_led_ball_sf
|