1
13
321
论坛积极会员
使用道具 举报
9
778
3893
论坛元老
##早晚开关窗帘 - alias: win_toggle initial_state: true trigger: platform: state entity_id: sensor.sun_state #日出日落 condition: #窗户关闭状态,可以不加 condition: state entity_id: binary_sensor.door_window_sensor_158d0000d6b39d state: 'off' action: - service_template: > {% if trigger.to_state.state == '日出' %} cover.open_cover {% else %} cover.close_cover {% endif %} entity_id: cover.window
2
126
2484
金牌会员
令狐鸣 发表于 2018-11-13 11:09 可以参考一下 [md] ```yaml
4
527
4112
- alias: 'turn_on_livingroom_cover' initial_state: true trigger: platform: sun event: sunset offset: '-00:05:00' action: service: cover.open_cover entity_id: cover.hassmart_192_168_123_133
123
4549
1万
管理员
囧死
noahzh89 发表于 2018-11-13 11:22 这么写自动化有个问题吧,相当于,你不停向窗帘发送开关的指令.应该先判断窗帘的状态吧. ...
sensor: - platform: template sensors: sun_state: value_template: '{% if is_state("sun.sun", "above_horizon") %}日出{% else %}日落{% endif %}' friendly_name: '日出日落'
令狐鸣 发表于 2018-11-13 17:21 是有点问题,忘了sensor.sun_state是虚拟出来状态 只有两种,日出和日落 [md]
noahzh89 发表于 2018-11-13 22:16 但是你的这个写法会导致一直发关闭或开启把,因为state 一直日落或者日出呀。 ...
本版积分规则 发表回复 回帖后跳转到最后一页
Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )
GMT+8, 2025-6-25 04:43 , Processed in 0.226277 second(s), 22 queries .
Powered by Discuz! X3.5
© 2001-2025 Discuz! Team.