-
-
Notifications
You must be signed in to change notification settings - Fork 503
Expand file tree
/
Copy pathprinter.yaml
More file actions
executable file
·134 lines (128 loc) · 4.85 KB
/
Copy pathprinter.yaml
File metadata and controls
executable file
·134 lines (128 loc) · 4.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
######################################################################
# @CCOSTAN - Follow Me on X
# For more info visit https://www.vcloudinfo.com/click-here
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# -------------------------------------------------------------------
# Printer Watchdog - Monitor Epson ink and status - Printer status sensors and health alerts.
# Centralizes the Printer Watchdog - Monitor Epson ink and status package configuration and helpers.
# -------------------------------------------------------------------
# Notes: Inspired by https://community.home-assistant.io/t/epson-wf-3540-ink-level-monitoring/21813
# Notes: Automations - Detect when things are not right. Like any Good Watchdog
# Notes: Ink alerts include 1-day and 1-week snooze actions.
# Video: https://youtu.be/y47KSflS1aw
# Blog: https://www.vcloudinfo.com/2026/06/home-assistant-notification-snooze-buttons.html
######################################################################
input_datetime:
printer_ink_snooze_until:
name: Printer Ink Snooze Until
has_date: true
has_time: true
automation:
- alias: 'Printer Ink Alert'
id: 6ef2a695-0b76-4eb5-b67c-2ff6f74f40b8
initial_state: 'on'
trigger:
- platform: numeric_state
entity_id:
- sensor.canon_ts300_series_black
- sensor.canon_ts300_series_color
below: 15
- platform: time
at: "10:00:00"
variables:
low_cartridges: >-
{% set ns = namespace(items=[]) %}
{% for entity_id in ['sensor.canon_ts300_series_black', 'sensor.canon_ts300_series_color'] %}
{% set ink_level = states(entity_id) %}
{% set cartridge_name = state_attr(entity_id, 'friendly_name') | default(entity_id, true) %}
{% if ink_level not in ['unknown', 'unavailable', 'none', ''] and (ink_level | float(100)) < 15 %}
{% set ns.items = ns.items + [cartridge_name ~ ' is at ' ~ ink_level ~ '%'] %}
{% endif %}
{% endfor %}
{{ ns.items | join('; ') }}
condition:
- condition: time
weekday:
- wed
- condition: template
value_template: "{{ low_cartridges | trim != '' }}"
- condition: template
value_template: >-
{% set snooze_until = as_timestamp(states('input_datetime.printer_ink_snooze_until'), 0) %}
{{ snooze_until <= as_timestamp(now()) }}
action:
- service: script.notify_engine_two_button
data:
title: "Printer Ink Alert"
value1: "{{ low_cartridges }}"
who: 'carlo'
group: 'Printer'
title1: "Snooze 1d"
action1: "SNOOZE_PRINTER_INK_1D"
icon1: "sfsymbols:clock"
title2: "Snooze 1w"
action2: "SNOOZE_PRINTER_INK_1W"
icon2: "sfsymbols:calendar"
- alias: 'Printer Ink Snooze'
id: 77a5cb04-64e6-465e-a3d4-1f75882bbbd4
mode: queued
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: SNOOZE_PRINTER_INK_1D
id: one_day
- platform: event
event_type: mobile_app_notification_action
event_data:
action: SNOOZE_PRINTER_INK_1W
id: one_week
variables:
snooze_until: >-
{% if trigger.id == 'one_day' %}
{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d %H:%M:%S') }}
{% else %}
{{ (now() + timedelta(days=7)).strftime('%Y-%m-%d %H:%M:%S') }}
{% endif %}
snooze_label: "{{ '1 day' if trigger.id == 'one_day' else '1 week' }}"
action:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.printer_ink_snooze_until
data:
datetime: "{{ snooze_until }}"
- service: script.send_to_logbook
data:
topic: "PRINTER"
message: "Printer ink alert snoozed for {{ snooze_label }} (until {{ snooze_until }})."
- alias: 'Printer Status Notifications'
id: 6ef2a695-0b76-4eb5-b67c-2ff6f74f40b9
trigger:
- platform: state
entity_id: sensor.canon_ts300_series
from: 'unavailable'
to: 'idle'
- platform: state
entity_id: sensor.canon_ts300_series
to: 'printing'
action:
- service: notify.alexa_media_front_room_flex
data:
message: >
{% if trigger.to_state.state == 'idle' %}
Printer has powered on and is ready
{% else %}
Printer is now printing
{% endif %}
data:
type: announce
- service: script.send_to_logbook
data:
topic: "PRINTER"
message: >
{% if trigger.to_state.state == 'idle' %}
Printer has powered on and is ready
{% else %}
Printer is now printing
{% endif %}
#-------------------------------------------