When I add the above code in the configuration.yaml, I have a service available called “RESTful Command: dali_light_1_off” which I can call to turn off the light.
I now want to create a RESTful switch that turns on/off the light.
I added the following code to the configuration.yaml:
I would guess the problem is that the RESTful switch periodically makes a GET request to the specified resource URL to check the state of the switch. It would seem making a GET request to that same URL results in an error response.
Does the light have a different URL you can use (with a GET request) to retrieve its current state? If so, you should specify that in the state_resource option. And then you should also fill in the is_on_template option to extract the state of the switch from the response.
Great! Is it also showing the correct state after you turn the switch on and off via the HA entity, and also when you turn it on and off manually (at the actual switch, assuming that’s possible)?