minor tweaks
This commit is contained in:
parent
e01e5af10c
commit
c05ee5aefb
|
@ -128,11 +128,11 @@ automation:
|
||||||
platform: state
|
platform: state
|
||||||
entity_id: sensor.octoprint_job_percentage
|
entity_id: sensor.octoprint_job_percentage
|
||||||
action:
|
action:
|
||||||
- service_template: "input_boolean.turn_{{- 'on' if states('sensor.octoprint_job_percentage') | int > 25 else 'off' }}"
|
- service_template: "input_boolean.turn_{{- 'on' if states('sensor.octoprint_job_percentage') | int >= 25 else 'off' }}"
|
||||||
entity_id: input_boolean.twenty_five_percent
|
entity_id: input_boolean.twenty_five_percent
|
||||||
- service_template: "input_boolean.turn_{{- 'on' if states('sensor.octoprint_job_percentage') | int > 50 else 'off' }}"
|
- service_template: "input_boolean.turn_{{- 'on' if states('sensor.octoprint_job_percentage') | int >= 50 else 'off' }}"
|
||||||
entity_id: input_boolean.fifty_percent
|
entity_id: input_boolean.fifty_percent
|
||||||
- service_template: "input_boolean.turn_{{- 'on' if states('sensor.octoprint_job_percentage') | int > 75 else 'off' }}"
|
- service_template: "input_boolean.turn_{{- 'on' if states('sensor.octoprint_job_percentage') | int >= 75 else 'off' }}"
|
||||||
entity_id: input_boolean.seventy_five_percent
|
entity_id: input_boolean.seventy_five_percent
|
||||||
- service_template: "input_boolean.turn_{{- 'on' if states('sensor.octoprint_job_percentage') | int == 100 else 'off' }}"
|
- service_template: "input_boolean.turn_{{- 'on' if states('sensor.octoprint_job_percentage') | int == 100 else 'off' }}"
|
||||||
entity_id: input_boolean.hundred_percent
|
entity_id: input_boolean.hundred_percent
|
||||||
|
@ -150,19 +150,16 @@ automation:
|
||||||
data_template:
|
data_template:
|
||||||
message: >-
|
message: >-
|
||||||
{%- macro secondsToReadableString(seconds) %}
|
{%- macro secondsToReadableString(seconds) %}
|
||||||
{%- set map = {'Week': (seconds / 604800) % 604800,
|
{%- set map = {'week': (seconds / 604800) % 604800,
|
||||||
'Day': (seconds / 86400) % 7, 'Hour': (seconds / 3600) % 24,
|
'day': (seconds / 86400) % 7, 'hour': (seconds / 3600) % 24,
|
||||||
'Minute': (seconds / 60) % 60, 'Second': (seconds % 60) } -%}
|
'minute': (seconds / 60) % 60 } -%}
|
||||||
{%- for item in map if map[item] | int > 0 -%}
|
{%- for item in map if map[item] | int > 0 -%}
|
||||||
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
||||||
{{- map[item]|int }} {{ item -}} {{- 's' if map[item]|int > 1 -}}
|
{{- map[item]|int }} {{ item -}} {{- 's' if map[item]|int > 1 -}}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
3D Printer job is now {{ trigger.to_state.attributes.friendly_name }} complete.
|
3D Printer job is now {{ trigger.to_state.attributes.friendly_name }} complete. {% if trigger.entity_id != 'input_boolean.hundred_percent' %} Will be done in {{ secondsToReadableString(states('sensor.octoprint_time_remaining') |int) }}.
|
||||||
{% if trigger.entity_id != 'input_boolean.hundred_percent' %}
|
{%- endif -%}
|
||||||
Time Spent: {{ secondsToReadableString(states('sensor.octoprint_time_elapsed') |int) }}.
|
|
||||||
Time Left: {{ secondsToReadableString(states('sensor.octoprint_time_remaining') |int) }}.
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# When the printing is complete (100%), it waits for 2 minutes and turns off the printer.
|
# When the printing is complete (100%), it waits for 2 minutes and turns off the printer.
|
||||||
|
|
Loading…
Reference in New Issue