I’ve just added the following 4 automations, would it be possible to refactor these by merging the black + color automations in a single one ?
By monitoring not one but two entities? But I would need to know in the message if it’s the black or colour which is below the threshold…
- alias: Printer ink alert black 50
trigger:
platform: numeric_state
entity_id: sensor.hp_envy_5000_series_black_ink
below: 50
action:
- service: notify.ha_telegram
data_template:
message: "Black ink alert : {{ states.sensor.hp_envy_5000_series_black_ink.state }}%"
- alias: Printer ink alert colour 50
trigger:
platform: numeric_state
entity_id: sensor.hp_envy_5000_series_tri_color_ink
below: 50
action:
- service: notify.ha_telegram
data_template:
message: "Colour ink alert : {{ states.sensor.hp_envy_5000_series_tri_color_ink.state }}%"
- alias: Printer ink alert black 10
trigger:
platform: numeric_state
entity_id: sensor.hp_envy_5000_series_black_ink
below: 10
action:
- service: notify.ha_telegram
data_template:
message: "Black ink alert : {{ states.sensor.hp_envy_5000_series_black_ink.state }}%"
- alias: Printer ink alert colour 10
trigger:
platform: numeric_state
entity_id: sensor.hp_envy_5000_series_tri_color_ink
below: 10
action:
- service: notify.ha_telegram
data_template:
message: "Colour ink alert : {{ states.sensor.hp_envy_5000_series_tri_color_ink.state }}%"