I am just trying to create a card with an entity(?) that has an on off button for a simple esp8266 relay. The URLs are http://relay/?S=On and http://relay/?S=Off Both return
{ “POWER” : “ON”} or { “POWER” : “OFF”}. I was able to hack my way through to create a circular widget on the dashboard that shows status via the Rest Sensor (http://relay/status) which has the same json returned as above.
I am struggling with translating this rest switch example into on-off control of my esp8266. I don’t want to use the esp8266 integration, it is over my head, though I can write code for esp8266, etc.
I know I am missing something, also will I see the ‘switch’ as an entity that I can add to a card once I have it correct ? I have looked at many videos and web pages and it just eludes me.
Thanks
Yes you will be able to use and control the switch in the front end. It will also display changes of state if the switch is controlled from outside home assistant.
Thanks, I tried it and had to rearrange the " and the ’ to prevent safe mode. The card was created, but the button/switch just goes back to off when you slide it on.
Edit: tcpdump shows the ON is not being appended to the resource URL
16:14:28.712996 IP pi.33202 > 1.2.3.4.http: Flags [P.], seq 1:189, ack 1, win 64240, length 188: HTTP: GET /cm?cmnd=Power+ HTTP/1.1 Ideas ? Thanks
Sending ON vs On has the has same effect, the return is all caps. The resource changed because I was writing a generic URL first. I would just like to know how to have the ON and OFF appended to this URL, that is what will make it work. Edit: Post makes no difference. This just seems too basic, to not be able to figure out. It processes status properly.
08:36:11.966036 IP pi.35536 > 1.2.3.4.http: Flags [P.], seq 1:209, ack 1, win 64240, length 208: HTTP: POST /cm?cmnd=Power+ HTTP/1.1