Hi All,
ok, I had an idea for a shutdown script for my 3d printer and came on here to find out where to start making it happen please see post here.
this is where I am now though… if I press the button (in lovelace) and the printer is printing, I want it to wait untill the conditions are true then turn off.
here is what I have done so far…
I created a sensor with a template
template:
- sensor:
- name: Ender Safe Shutdown
state: >
{% if is_state('switch.3d_printer', 'off') %}
Off
{% elif is_state('sensor.octoprint_current_state', 'Printing') %}
Not Safe
{% elif states('sensor.octoprint_actual_tool0_temp')|int <= 29 %}
Safe
{% else %}
Not Safe
{% endif %}
and a script
alias: Ender 5 Safe Switch
mode: single
icon: mdi:printer-3d-nozzle
sequence:
- choose:
- conditions:
- condition: state
entity_id: sensor.ender_safe_shutdown
state: 'Off'
sequence:
- service: switch.turn_on
target:
entity_id: switch.3d_printer
- delay: 5
- service: switch.turn_on
target:
entity_id: switch.octoprint_connect_to_printer
- conditions:
- condition: state
entity_id: sensor.ender_safe_shutdown
state: Safe
sequence:
- service: switch.turn_off
target:
entity_id: switch.3d_printer
- conditions:
- condition: state
entity_id: sensor.ender_safe_shutdown
state: Not safe
sequence:
- wait_for_trigger:
- platform: state
entity_id: sensor.ender_safe_shutdown
to: "Safe"
for: 10
- service: switch.turn_off
target:
entity_id: switch.3d_printer
everything works except the “wait_for_trigger” part…
can anyone help me in where I am going wrong?
thanks for your help
Robin