- alias: battery_alarm
initial_state: true
trigger:
- platform: numeric_state
entity_id: binary_sensor.door_window_sensor_158d00019e0f2d,binary_sensor.switch_158d0001a5d56c,binary_sensor.wall_switch_both_158d000163dc0a
value_template: '{{ state.attributes.battery_level }}'
below: 20
- platform: numeric_state
entity_id: binary_sensor.door_window_sensor_158d00019e0f2d,binary_sensor.switch_158d0001a5d56c,binary_sensor.wall_switch_both_158d000163dc0a
value_template: '{{ state.attributes.battery_level }}'
below: 15
- platform: numeric_state
entity_id: binary_sensor.door_window_sensor_158d00019e0f2d,binary_sensor.switch_158d0001a5d56c,binary_sensor.wall_switch_both_158d000163dc0a
value_template: '{{ state.attributes.battery_level }}'
below: 10
- platform: numeric_state
entity_id: binary_sensor.door_window_sensor_158d00019e0f2d,binary_sensor.switch_158d0001a5d56c,binary_sensor.wall_switch_both_158d000163dc0a
value_template: '{{ state.attributes.battery_level }}'
below: 5
action:
- service: notify.ios_iphone_se
data_template:
message: '{{ trigger.to_state.attributes.friendly_name}}电量不足{{ trigger.to_state.attributes.battery_level}}%,请及时更换电池!'
给你一个例子吧,主要利用 data_template: 和 trigger.to_state
|