Created
February 21, 2026 21:43
-
-
Save mawmawmawm/5a6c65d413cdf822b0d75b26b5e92754 to your computer and use it in GitHub Desktop.
3D Print Duration in hours
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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