Script conditions not working

Hey all,

I do most stuff in NR, but I have some scripts for Alexa scenes. Im trying to make this one a little more complicated and add a condition so it wont turn off the printer if its printing.

But the condition doesnt work (which is surprising that this new fancy gui can create scripts that dont work :frowning:

Can anyone show me what Ive done wrong?

Thanks

alias: 'Printer: Turn Off Printer'
sequence:
  - condition: not
    conditions:
      - condition: state
        entity_id: sensor.octoprint_current_state
        state: printing
  - service: rest_command.shutdown_octoprint
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    target:
      entity_id: switch.printer
mode: single

I mean, the GUI doesn’t know what you want, so it’s ultimately your fault if something doesn’t work as expected. You also didn’t explain what you’re hoping that script will do and what it is doing instead, so it is hard to help you.

Have you confirmed in the states tab of the developer tools that `printing’ is the state that sensor shows?

Yes, of course. If “printing” is not a state value. What I meant about the GUI was, that you shouldn’t be able to go wrong with script syntax. Which is where I must have made a mistake I thought.

BUT!

I remembered the new script debug mode (I stopped using scripts about a year ago for the most part)

After checking that, for some reason printing needs capitalization. I don’t think I’ve ever seen capitalization on a state value before :frowning:

Executed: November 21, 2021, 7:56:13 PM
Result:

result: false state: Printing wanted_state: printing

So apologies for wasting your time with this and thanks :slight_smile: