forked from SirGoodenough/DEV-Moonraker-HA
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmoonraker.yaml
370 lines (363 loc) · 17.5 KB
/
moonraker.yaml
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
rest:
scan_interval: 5
resource_template: "http://<moonraker-ip-address>:7125/server/files/metadata?filename={{ states(('sensor.3d_printer_current_print')) | urlencode }}"
sensor:
- name: printer_3d_file_metadata
unique_id: "<moonraker-ip-address>5ec44d90-419c-419c-802d-d34071639c08"
json_attributes_path: "$.result"
json_attributes:
- layer_height
- object_height
- thumbnails
value_template: "OK"
#camera:
# Loading generic IP camera via configuration.yaml is deprecated, it will be automatically imported. Once you have confirmed correct operation, please remove 'generic' (IP camera) section(s) from configuration.yaml
# Directions in the README.md for how to add the Thumbnail now.
# - platform: generic
# name: "3D Printer Thumbnail"
# still_image_url: http://<moonraker-ip-address>:7125/server/files/gcodes/{{ states("sensor.3d_printer_object_thumbnails") }}
# verify_ssl: false
# This no longer works broken in current builds https://www.home-assistant.io/blog/2022/05/04/release-20225/#breaking-changes -> MJPEG IP Camera
# Directions in the README.md for how to add the MJPEG IP Camera now.
# - platform: mjpeg
# name: "3D Printer Camera"
# still_image_url: http://<moonraker-ip-address>/webcam/?action=snapshot
# mjpeg_url: http://<moonraker-ip-address>/webcam/?action=stream
# verify_ssl: false
rest_command:
3d_printer_emergency_stop:
url: "http://<moonraker-ip-address>:7125/printer/emergency_stop"
method: post
3d_printer_firmware_restart:
url: "http://<moonraker-ip-address>:7125/printer/firmware_restart"
method: post
3d_printer_cancel:
url: "http://<moonraker-ip-address>:7125/printer/print/cancel"
method: post
3d_printer_pause:
url: "http://<moonraker-ip-address>:7125/printer/print/pause"
method: post
3d_printer_resume:
url: "http://<moonraker-ip-address>:7125/printer/print/resume"
method: post
sensor:
- platform: rest
name: printer_3d_sensor
unique_id: "<moonraker-ip-address>3a0c25fa-297d-4c19-b03c-ddf04840682b"
resource: "http://<moonraker-ip-address>:7125/printer/objects/query?heater_bed&extruder&print_stats&toolhead&display_status&virtual_sdcard&gcode_move&filament_motion_sensor%20btt_smart_filament&temperature_sensor%20Chamber_Temp"
json_attributes_path: "$.result.status"
json_attributes:
- heater_bed
- extruder
- print_stats
- toolhead
- display_status
- virtual_sdcard
- gcode_move
- "filament_motion_sensor btt_smart_filament_sensor"
- "temperature_sensor Chamber_Temp"
value_template: "OK"
force_update: true
scan_interval: 1
- platform: rest
name: printer_3d_info
unique_id: "<moonraker-ip-address>1cba6677-02bd-4273-9083-b8301bf6943b"
scan_interval: 1
resource_template: "http://<moonraker-ip-address>:7125/printer/info"
json_attributes_path: "$.result"
json_attributes:
- state_message
- state
value_template: "OK"
- platform: rest
name: printer_3d_server
unique_id: "<moonraker-ip-address>1cba6677-02bd-4273-9083-b8301bf6949"
scan_interval: 1
resource_template: "http://<moonraker-ip-address>:7125/server/database/item?namespace=mainsail&key=general"
json_attributes_path: "$.result.value"
json_attributes:
- printername
value_template: "OK"
template:
- binary_sensor:
- name: 3d_printer_filament
unique_id: "<moonraker-ip-address>5ce32fc9-5e95-49e7-80e7-bfdd2cf1d1fd"
device_class: motion
state: '{{ states.sensor.printer_3d_sensor.attributes["filament_switch_sensor Filament"]["filament_detected"] }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:printer-3d-nozzle-alert
attributes:
friendly_name: "Filament Detected"
- sensor:
- name: 3d_printer_printername
unique_id: "<moonraker-ip-address>3a0f3144-a801-422f-adb6-e2ed35796074"
state: '{{ states.sensor.printer_3d_server.attributes["printername"]}}'
availability: >
{% set items = ['sensor.printer_3d_server'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:printer-3d
attributes:
friendly_name: "Printer Name"
- name: 3d_printer_chamber_temp
unique_id: "<moonraker-ip-address>167e5dec-719c-42d3-9560-4f177573f741"
state: '{{ states.sensor.printer_3d_sensor.attributes["temperature_sensor Chamber_Temp"]["temperature"] | float(0) | round(1) }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "°C"
icon: mdi:thermometer
attributes:
friendly_name: "Chamber Actual"
- name: 3d_printer_hotend_target
unique_id: "<moonraker-ip-address>167e5dec-719c-42d3-9560-4f177573f740"
state: '{{ states.sensor.printer_3d_sensor.attributes["extruder"]["target"] | float(0) | round(1) }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "°C"
icon: mdi:thermometer
attributes:
friendly_name: "Hotend Target"
- name: 3d_printer_hotend_actual
unique_id: "<moonraker-ip-address>7c2593fb-a7dd-4ed7-a865-2e4dddddbb40"
state: '{{ states.sensor.printer_3d_sensor.attributes["extruder"]["temperature"] | float(0) | round(1) }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "°C"
icon: mdi:thermometer
attributes:
friendly_name: "Hotend Actual"
- name: 3d_printer_hotend_power
unique_id: "<moonraker-ip-address>c57a1e35-92fa-403e-b3cf-ec1e97ef94cf"
state: '{{ states.sensor.printer_3d_sensor.attributes["extruder"]["power"] | float(0) | round(3) * 100}}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "%"
icon: mdi:flash
attributes:
friendly_name: "Hotend Power"
- name: 3d_printer_bed_target
unique_id: "<moonraker-ip-address>eadec415-c281-4814-8fba-17c6c42670ec"
state: '{{ states.sensor.printer_3d_sensor.attributes["heater_bed"]["target"] | float(0) | round(1) }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "°C"
icon: mdi:thermometer
attributes:
friendly_name: "Bed Target"
- name: 3d_printer_bed_actual
unique_id: "<moonraker-ip-address>cb33503c-c5d4-4e06-b79b-c1cd64ca2d7a"
state: '{{ states.sensor.printer_3d_sensor.attributes["heater_bed"]["temperature"] | float(0) | round(1) }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "°C"
icon: mdi:thermometer
attributes:
friendly_name: "Bed Actual"
- name: 3d_printer_bed_power
unique_id: "<moonraker-ip-address>abb2fc5b-8173-4131-a942-fb11e30f4efa"
state: '{{ states.sensor.printer_3d_sensor.attributes["heater_bed"]["power"] | float(0) | round(3) * 100 }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "%"
icon: mdi:flash
attributes:
friendly_name: "Bed Power"
- name: 3d_printer_state
unique_id: "<moonraker-ip-address>758ce84c-3210-4f29-b6b3-38139180de96"
state: '{{ states.sensor.printer_3d_sensor.attributes["print_stats"]["state"] }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: >
{% set val = states.sensor.printer_3d_sensor.attributes["print_stats"]["state"] %}
{% if val == 'standby' %}
mdi:sleep
{% elif val == 'error' %}
mdi:alert-circle
{% elif val == 'printing' %}
mdi:printer-3d-nozzle
{% elif val == 'paused' %}
mdi:pause-circle
{% elif val == 'complete' %}
mdi:printer-3d
{% else %}
mdi:help-circle
{% endif %}
attributes:
friendly_name: "Printer State"
- name: 3d_printer_current_print
unique_id: "<moonraker-ip-address>3a0f3144-a801-422f-adb6-e2ed35796072"
state: '{{ states.sensor.printer_3d_sensor.attributes["print_stats"]["filename"]}}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:file
attributes:
friendly_name: "Current Print"
- name: 3d_printer_current_progress
unique_id: "<moonraker-ip-address>8ec7163b-be00-4a10-8051-48cf9a260a29"
state: '{{ ((states.sensor.printer_3d_sensor.attributes["display_status"]["progress"])*100) | round(0, "floor") }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "%"
icon: mdi:progress-clock
attributes:
friendly_name: "Progress"
- name: 3d_printer_print_time
unique_id: "<moonraker-ip-address>e1ac0fac-e8ba-4e05-8fa0-c8d8076f9f63"
state: '{{ states.sensor.printer_3d_sensor.attributes["print_stats"]["print_duration"] |timestamp_custom("%H:%M:%S", 0)}}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:camera-timer
attributes:
friendly_name: "Time Elapsed"
- name: 3d_printer_time_remaining
unique_id: "<moonraker-ip-address>e12c8def-5ebe-43a4-9f75-605a0c46fc0f"
state: '{{ (((states.sensor.printer_3d_sensor.attributes["print_stats"]["print_duration"]/states.sensor.printer_3d_sensor.attributes["display_status"]["progress"]- states.sensor.printer_3d_sensor.attributes["print_stats"]["print_duration"]) if states.sensor.printer_3d_sensor.attributes["display_status"]["progress"]>0 else 0)) | timestamp_custom("%H:%M:%S", 0)}}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:timer-sand
attributes:
friendly_name: "Time Remaining"
- name: 3d_printer_eta
unique_id: "<moonraker-ip-address>a2b57068-9a32-4d2c-8cc9-57d2389a9082"
state: '{{ (as_timestamp(now())+((states.sensor.printer_3d_sensor.attributes["print_stats"]["print_duration"]/states.sensor.printer_3d_sensor.attributes["display_status"]["progress"]- states.sensor.printer_3d_sensor.attributes["print_stats"]["print_duration"]) if states.sensor.printer_3d_sensor.attributes["display_status"]["progress"]>0 else 0)) | timestamp_custom("%H:%M:%S", 1)}}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:av-timer
attributes:
friendly_name: "ETA"
- name: 3d_printer_message
unique_id: "<moonraker-ip-address>0c418c0d-e59e-4d4e-aa11-8fae53df58f8"
state: '{{ states.sensor.printer_3d_sensor.attributes["display_status"]["message"]}}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:message-cog
attributes:
friendly_name: "Message"
- name: 3d_printer_layer_height
unique_id: "<moonraker-ip-address>6cca455d-c327-4567-b886-4d7f99714265"
state: '{{ states.sensor.printer_3d_file_metadata.attributes["layer_height"] | float(0) }}'
availability: >
{% set items = ['sensor.printer_3d_file_metadata'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "mm"
icon: mdi:arrow-collapse-down
attributes:
friendly_name: "Layer Height"
- name: 3d_printer_object_height
unique_id: "<moonraker-ip-address>6d6d9dc0-9a02-4ce4-a797-c84b42e011a6"
state: '{{ (states.sensor.printer_3d_file_metadata.attributes["object_height"] | float(0)) - (states.sensor.printer_3d_file_metadata.attributes["layer_height"] | float(0)) }}'
availability: >
{% set items = ['sensor.printer_3d_file_metadata'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "mm"
icon: mdi:arrow-expand-vertical
attributes:
friendly_name: "Object Height"
- name: 3d_printer_current_height
unique_id: "<moonraker-ip-address>d440e568-d4d1-4b3f-85c4-fdacd68c0e1a"
state: '{{ states.sensor.printer_3d_sensor.attributes["gcode_move"]["gcode_position"][2] | float(0) | round(2) }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "mm"
icon: mdi:arrow-collapse-down
attributes:
friendly_name: "Current Height"
- name: 3d_printer_current_layer
unique_id: "<moonraker-ip-address>6a77acc1-8134-4354-b2f6-390adab81993"
state: '{{ (states("sensor.3d_printer_current_height")|float(0) / states("sensor.3d_printer_layer_height")|float(0))|round(0) }}'
availability: >
{% set items = ['sensor.3d_printer_current_height','sensor.3d_printer_layer_height'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:counter
attributes:
friendly_name: "Current Layer"
- name: 3d_printer_total_layers
unique_id: "<moonraker-ip-address>53cfe906-28ec-44cd-926a-b08ffb8766e5"
state: '{{ (states("sensor.3d_printer_object_height")|float(0) / states("sensor.3d_printer_layer_height")|float(0))|round(0) }}'
availability: >
{% set items = ['sensor.3d_printer_object_height','sensor.3d_printer_layer_height'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:counter
attributes:
friendly_name: "Total Layer"
- name: 3d_printer_actual_layer
unique_id: "<moonraker-ip-address>167e5dec-719c-42d3-9560-4f177573f742"
state: '{{ states.sensor.printer_3d_sensor.attributes.print_stats["info"]["current_layer"] }} / {{ states.sensor.printer_3d_sensor.attributes.print_stats["info"]["total_layer"] }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:layers-triple
attributes:
friendly_name: "Actual Layer"
- name: 3d_printer_object_thumbnails
unique_id: "<moonraker-ip-address>59b37837-b751-4d31-98c2-516a52edf833"
state: >
{% set dir = states('sensor.3d_printer_current_print') %}
{% set thumb = state_attr('sensor.printer_3d_file_metadata','thumbnails') %}
{% set img = (thumb | last).relative_path if thumb else 'not available' %}
{{ (dir.split('/')[:-1] + [img]) | join('/') }}
availability: >
{% set items = ['sensor.printer_3d_file_metadata'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:image
attributes:
friendly_name: "Object Thumbnails"
- name: 3d_printer_state_message
unique_id: "<moonraker-ip-address>9a5184c9-ac5b-44a9-a691-2b67c243d197"
state: '{{ states.sensor.printer_3d_info.attributes["state_message"] }}'
availability: >
{% set items = ['sensor.printer_3d_info'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:message-cog
attributes:
friendly_name: "State Message"
- name: 3d_printer_heaters_power
unique_id: "<moonraker-ip-address>3988e9be-c910-4634-8205-38d53170d5a5"
state: '{{ states("sensor.3d_printer_bed_power")|float(0) | round(1) }}% / {{ states("sensor.3d_printer_hotend_power")|float(0) | round(1) }}%'
availability: >
{% set items = ['sensor.3d_printer_bed_power','sensor.3d_printer_hotend_power'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:meter-electric-outline
attributes:
friendly_name: "Bed and Nozzle Power"