First of all, please read this..
Second,
Yes
“Why does it not work?”
I would assume wrong config. But you did not post your mqtt config for the switch item, so I can only assume.
First of all, please read this..
Second,
Yes
“Why does it not work?”
I would assume wrong config. But you did not post your mqtt config for the switch item, so I can only assume.