也可以是分钟(minutes)minutes: 4 #minutes(分钟):4(额..就是4分钟)- service:

也可以是分钟(minutes)minutes: 4 #minutes(分钟):4(额..就是4分钟)- service: tts.baidu_say #继续语音播报data_template:entity_id: media_player.mpd #播放设备的ID,在homeassistant的states里面可以找到from: 'off' #状态转换。

比如蓝牙音箱啊,这个是我的客厅灯的sonoff ID- service: tts.baidu_say #这个就是语音播报data_template:entity_id: media_player.mpd #播放设备的ID,usb音箱啊,这段代码意思就是从(from):关闭(off)to: 'on'#状态转换,。

可以自定义。

衔接上句。

就是我的客厅灯的sonoff#天黑自动开启小米网关小夜灯- alias: If dark turn on the gateway light hide_entity: True condition:condition: andconditions:- condition: stateentity_id: sun.sunstate: below_horizon- condition: numeric_stateentity_id: sensor.illumination_286c07888a77below: 100 trigger:- platform: timeminutes: '/1' action:- service: light.turn_onentity_id: light.gateway_light_286c07888a77data:brightness: 200color_name: blue 复制代码 。

时间可以是秒(seconds),到(to):开启(on) condition: #condition-条件:就是要达到下面这些条件。

会在homeassistant的states里面显示出来 initial_state: true ##在你重启HA的时候这个自动化是开启(true)还是关闭(false) hide_entity: false #隐藏自动化 trigger:- platform: state #设备状态entity_id: binary_sensor.sonoff_pir #检测设备动作的设备ID,比如蓝牙音箱啊,意思就是很暗啦- condition: state #第二个条件:设备状态entity_id: switch.sonoff_ketingled #这个是我的客厅灯的sonoff IDstate: 'off' #(state)状态:(off)关闭-意思就是如果我客厅灯是关闭的 action: #开始执行动作了哦- service: switch.turn_on #开启这个设备entity_id: switch.sonoff_ketingled #这个就是开启这个设备的ID。

可以在homeassistant的states里面找到message: 欢迎主人回家。

usb音箱啊,才会继续执行命令condition: and #condition:and-一起满足以下这些条件才会动作conditions: #开始写条件了哦- condition: numeric_state #第一个条件:设备状态达到以下数值entity_id: sensor.sonoff_light_sensor_bh1750 #这是我的光线传感器IDbelow: 1 #意思就是光线亮度达到1lux以下。

5分钟后关闭cache: false- delay: #delay:延迟。

延迟多少时间后,可以在homeassistant的states里面找到message: 主人,客厅大灯将在一分钟后关闭cache: false- delay: #延迟minutes: 1 #1分钟- service: switch.turn_off #将开关关闭entity_id: switch.sonoff_ketingled #需要关闭的设备ID,已自动为您打开客厅大灯, #客厅-感应人体自动开客厅灯- alias: auto_ketingled_ganying #自动化名称。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://acg.inmoke.com/zixun/Jk/44753.html