Skip to content

Instantly share code, notes, and snippets.

@mawmawmawm
Created February 21, 2026 21:43
Show Gist options
  • Select an option

  • Save mawmawmawm/5a6c65d413cdf822b0d75b26b5e92754 to your computer and use it in GitHub Desktop.

Select an option

Save mawmawmawm/5a6c65d413cdf822b0d75b26b5e92754 to your computer and use it in GitHub Desktop.
3D Print Duration in hours
template:
- sensor:
- name: "Prusa Print Graph Span"
state: >
{% set val = states('sensor.prusamini_print_start') %}
{% if val in ['unknown', 'unavailable', ''] %}
1h
{% else %}
{%- set hours = (now() - as_datetime(val)).total_seconds() / 3600 -%}
{%- set base = hours | int -%}
{%- if hours > base -%}
{{ base + 1 }}h
{%- else -%}
{{ base }}h
{%- endif -%}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment