I’d still be interested to know why I couldn’t get the restful command to work if anyone knows.
Edit: I just realised HA was returning error 401 (unauthorized) not 404 (not found) for the restful command. Which explains why curl with -k option (insecure) works. Why the restful command is trying to make a secure connection to an http address on the other hand is a mystery.
It’s all academic now as I have realised I can do this a lot simpler with shell_command.
@tom_l
I had a similar problem, but fixed it by replacing the name of my restful device by its IP in the url to be hit by HA. I still don’t understand why/when my ddns fails…
Can you tell me how do you observe the error codes in HA (401 and 404)?
I’ve try this solution (thank you) and it is working manually. I can see the switch as entity and can click on or off but when i wanna use this in automation or scene it simply do not appear.
But i can use it to make a helper. But this helper also do not show up when i wanna use as automation or scene. When i make it in yaml it simply do not save with wrong order message.
Do you have any idea?
You need to explain what you mean by “I can see the switch as entity and can click on or off but when i wanna use this in automation or scene it simply do not appear.”
If you can see it as an entity you should be able to operate it in an automation action via Call Service / switch.turn_on for example.
Thank you for your answare Troon.
The souliton was more restart. I do not know why, but it is looks like for my setup it is not enough a simle restart, 2 or 3 necessary. It is runnung under VM.