Trigger on state change

See automation below, it will turn off sonoff 4 switch when the the printer state changes from “Printing” to “Operational”, this seems to work great. However, I would like to turn off sonoff 4 switch when the state changes from “Printing” to ANYTHING (Operational, error, fail, etc…) Is there a way todo this? I dont know all the possible states, but if it was printing and then stops, I want to cut the power. thx

  • alias: Turn off 3D printer
    trigger:
    platform: state
    entity_id: sensor.octoprint_current_state
    from: ‘Printing’
    to: ‘Operational’
    action:
    service: switch.turn_off
    entity_id: switch.sonoff_4

just remove the line:

to: ‘Operational’

wow, that simple, thx