MQTT cant automate entity

MQTT discovers switches i populate into it, from a raspberry pi via node-red.

From Lovelace i can turn the switch on and off ok.

When i create an automation though i cant select the switch as a device and don’t know how to turn it on and off, i tried setting the entity state to on, but that didn’t work.

Ideas?

Use a service action (switch.turn_on / _off) in your automation instead of a device action.

Post your automation’s YAML code so we can review it. Be sure to format the code so the indentation is displayed correctly.