{ "version": 1, "minor_version": 1, "key": "lovelace.ender5_printer", "data": { "config": { "views": [ { "title": "Ender 5", "path": "printer", "icon": "mdi:printer-3d-nozzle", "type": "sections", "max_columns": 3, "subview": false, "sections": [ { "type": "grid", "cards": [ { "type": "heading", "icon": "mdi:printer", "heading_style": "title", "heading": "Ender 5", "badges": [ { "type": "entity", "show_state": true, "show_icon": false, "entity": "sensor.octoprint_print_status" }, { "type": "button", "icon": "mdi:pause", "text": "Pause", "color": "", "tap_action": { "action": "perform-action", "perform_action": "switch.turn_on", "target": { "entity_id": "switch.octoprint_pause_print" } }, "visibility": [ { "condition": "state", "entity": "binary_sensor.octoprint_paused", "state": "off" }, { "condition": "state", "entity": "binary_sensor.octoprint_printing", "state": "on" } ] }, { "type": "button", "icon": "mdi:play", "text": "Resume", "color": "", "tap_action": { "action": "perform-action", "perform_action": "switch.turn_off", "target": { "entity_id": "switch.octoprint_pause_print" } }, "visibility": [ { "condition": "state", "entity": "binary_sensor.octoprint_paused", "state": "on" } ] }, { "type": "button", "icon": "mdi:stop", "text": "Cancel", "color": "#F44336", "tap_action": { "action": "perform-action", "perform_action": "button.press", "target": { "entity_id": "button.octoprint_cancel_print" }, "confirmation": { "text": "Cancel the current print?" } }, "visibility": [ { "condition": "state", "entity": "binary_sensor.octoprint_printing", "state": "on" } ] }, { "type": "button", "icon": "mdi:alert-octagon", "text": "Emergency stop", "color": "#F44336", "tap_action": { "action": "perform-action", "perform_action": "button.press", "target": { "entity_id": "button.octoprint_emergency_stop" }, "confirmation": { "text": "Emergency stop the printer NOW?" } } } ] }, { "type": "horizontal-stack", "cards": [ { "type": "custom:button-card", "entity": "sensor.octoprint_tool_0_temperature", "show_name": false, "show_state": false, "show_icon": false, "tap_action": { "action": "more-info" }, "custom_fields": { "content": "[[[\n const sec = 'var(--secondary-text-color)';\n const pri = 'var(--primary-text-color)';\n return `\n
\n
\n \n Nozzle\n
\n ${Math.round(parseFloat(states['sensor.octoprint_tool_0_temperature']?.state) || 0) + '\\u00B0C / target ' + Math.round(parseFloat(states['sensor.octoprint_tool_0_target']?.state) || 0) + '\\u00B0C'}\n
\n `;\n]]]" }, "styles": { "card": [ { "background": "var(--ha-card-background, var(--card-background-color))" }, { "border-radius": "12px" }, { "padding": "0" }, { "height": "74px" }, { "position": "relative" }, { "box-shadow": "none" }, { "border": "1px solid rgba(var(--rgb-primary-text-color), 0.08)" } ], "custom_fields": { "content": [ { "position": "absolute" }, { "inset": "0" }, { "padding": "0" } ] } } }, { "type": "custom:button-card", "entity": "sensor.octoprint_bed_temperature", "show_name": false, "show_state": false, "show_icon": false, "tap_action": { "action": "more-info" }, "custom_fields": { "content": "[[[\n const sec = 'var(--secondary-text-color)';\n const pri = 'var(--primary-text-color)';\n return `\n
\n
\n \n Print bed\n
\n ${Math.round(parseFloat(states['sensor.octoprint_bed_temperature']?.state) || 0) + '\\u00B0C / target ' + Math.round(parseFloat(states['sensor.octoprint_bed_target']?.state) || 0) + '\\u00B0C'}\n
\n `;\n]]]" }, "styles": { "card": [ { "background": "var(--ha-card-background, var(--card-background-color))" }, { "border-radius": "12px" }, { "padding": "0" }, { "height": "74px" }, { "position": "relative" }, { "box-shadow": "none" }, { "border": "1px solid rgba(var(--rgb-primary-text-color), 0.08)" } ], "custom_fields": { "content": [ { "position": "absolute" }, { "inset": "0" }, { "padding": "0" } ] } } }, { "type": "custom:button-card", "entity": "sensor.octoprint_print_time_left", "show_name": false, "show_state": false, "show_icon": false, "tap_action": { "action": "more-info" }, "custom_fields": { "content": "[[[\n const sec = 'var(--secondary-text-color)';\n const pri = 'var(--primary-text-color)';\n const t = parseFloat(states['sensor.octoprint_print_time_left']?.state) || 0;\n const h = Math.floor(t / 3600);\n const m = Math.round((t % 3600) / 60);\n let primary = '--';\n if (t > 0) {\n primary = h > 0 ? `${h}h ${m}m` : `${m}m`;\n }\n let secondary = '';\n const et = states['sensor.octoprint_approximate_completion_time']?.state;\n if (et && !['unknown','unavailable',''].includes(et)) {\n const d = new Date(et);\n secondary = `Done: ~${d.getHours().toString().padStart(2,'0')}:${d.getMinutes().toString().padStart(2,'0')}`;\n }\n return `\n
\n
\n \n Time left\n
\n ${primary}\n ${secondary}\n
\n `;\n ]]]" }, "styles": { "card": [ { "background": "var(--ha-card-background, var(--card-background-color))" }, { "border-radius": "12px" }, { "padding": "0" }, { "height": "74px" }, { "position": "relative" }, { "box-shadow": "none" }, { "border": "1px solid rgba(var(--rgb-primary-text-color), 0.08)" } ], "custom_fields": { "content": [ { "position": "absolute" }, { "inset": "0" }, { "padding": "0" } ] } } }, { "type": "custom:button-card", "entity": "sensor.octoprint_current_z", "show_name": false, "show_state": false, "show_icon": false, "tap_action": { "action": "more-info" }, "custom_fields": { "content": "[[[\n const sec = 'var(--secondary-text-color)';\n const pri = 'var(--primary-text-color)';\n return `\n
\n
\n \n Height\n
\n ${states['sensor.octoprint_current_z']?.state + ' mm'}\n
\n `;\n]]]" }, "styles": { "card": [ { "background": "var(--ha-card-background, var(--card-background-color))" }, { "border-radius": "12px" }, { "padding": "0" }, { "height": "74px" }, { "position": "relative" }, { "box-shadow": "none" }, { "border": "1px solid rgba(var(--rgb-primary-text-color), 0.08)" } ], "custom_fields": { "content": [ { "position": "absolute" }, { "inset": "0" }, { "padding": "0" } ] } } } ] }, { "type": "custom:button-card", "entity": "sensor.octoprint_print_progress", "show_name": false, "show_state": false, "show_icon": false, "tap_action": { "action": "none" }, "custom_fields": { "content": "[[[\n const pct = Math.round(parseFloat(states['sensor.octoprint_print_progress']?.state) || 0);\n let file = states['sensor.octoprint_print_file']?.state || '--';\n if (['unknown','unavailable'].includes(file)) file = 'No file';\n file = file.replace(/\\.gcode$/i, '');\n return `\n
\n
\n \n Print progress\n
\n
\n ${pct}%\n ${file}\n
\n
\n
\n
\n
\n `;\n ]]]" }, "styles": { "card": [ { "background": "var(--ha-card-background, var(--card-background-color))" }, { "border-radius": "12px" }, { "padding": "0" }, { "height": "74px" }, { "position": "relative" }, { "box-shadow": "none" }, { "height": "100px" } ], "custom_fields": { "content": [ { "position": "absolute" }, { "inset": "0" }, { "padding": "0" } ] } } }, { "type": "vertical-stack", "cards": [ { "type": "custom:webrtc-camera", "url": "octoprint", "mode": "mse", "style": "border-radius: 12px 12px 0 0; overflow: hidden;" }, { "type": "custom:mushroom-light-card", "entity": "light.3d_printer_lights", "name": "Lamp", "icon": "mdi:lightbulb", "show_brightness_control": true, "layout": "horizontal" } ] }, { "type": "custom:apexcharts-card", "header": { "show": false }, "graph_span": "1h", "series": [ { "entity": "sensor.octoprint_tool_0_temperature", "name": "Nozzle", "color": "#E53935", "stroke_width": 2, "extend_to": "now" }, { "entity": "sensor.octoprint_bed_temperature", "name": "Bed", "color": "#FB8C00", "stroke_width": 2, "extend_to": "now" } ], "apex_config": { "chart": { "height": 130, "toolbar": { "show": false } }, "stroke": { "curve": "smooth" }, "grid": { "borderColor": "rgba(var(--rgb-primary-text-color), 0.05)" }, "yaxis": { "min": 0, "max": 280, "labels": { "style": { "fontSize": "9px" }, "maxWidth": 28 } }, "xaxis": { "labels": { "style": { "fontSize": "9px" } }, "datetimeFormatter": { "hour": "HH:mm", "minute": "HH:mm" } }, "tooltip": { "x": { "format": "HH:mm" } }, "legend": { "show": true, "fontSize": "10px", "horizontalAlign": "left", "offsetX": 28 } } }, { "type": "custom:button-card", "entity": "binary_sensor.octoprint_connected", "show_name": false, "show_icon": false, "tap_action": { "action": "none" }, "custom_fields": { "content": "[[[\n const connected = states['binary_sensor.octoprint_connected']?.state === 'on';\n const printing = states['binary_sensor.octoprint_printing']?.state === 'on';\n const paused = states['binary_sensor.octoprint_paused']?.state === 'on';\n const health = Math.round((parseFloat(states['sensor.octoprint_serial_health_ratio']?.state) || 0) * 100);\n const prints = states['sensor.octoprint_printer_prints_today']?.state || '0';\n const ptime = states['sensor.octoprint_printer_print_time_today']?.state || '--';\n const fil = ((parseFloat(states['sensor.octoprint_filament_daily']?.state) || 0) / 10).toFixed(1);\n\n const row = (label, value, vc) => `\n
\n ${label}\n ${value}\n
`;\n return `\n
\n
\n \n Diagnostics\n
\n ${row('Connected', connected ? 'Yes' : 'No', connected ? '#4CAF50' : '#F44336')}\n ${row('Status', printing ? (paused ? 'Paused' : 'Printing') : 'Idle', printing ? '#4CAF50' : null)}\n ${row('Serial health', health + '%', health > 95 ? '#4CAF50' : health > 80 ? '#FF9800' : '#F44336')}\n ${row('Prints today', prints, null)}\n ${row('Time today', ptime + ' h', null)}\n ${row('Filament today', fil + ' m', null)}\n
\n `;\n ]]]" }, "styles": { "card": [ { "background": "var(--ha-card-background, var(--card-background-color))" }, { "border-radius": "12px" }, { "padding": "0" }, { "height": "74px" }, { "position": "relative" }, { "box-shadow": "none" }, { "height": "190px" } ], "custom_fields": { "content": [ { "position": "absolute" }, { "inset": "0" }, { "padding": "0" } ] } } } ] } ] } ] } } }