Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95462

Piecing it together Rest Switch - Entity

$
0
0

@ob2s wrote:

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.

switch:
  - platform: rest
    resource: http://relay/?S=
    body_on: '{"POWER": "ON"}'
    body_off: '{"POWER": "OFF"}'
    is_on_template: '{{ value_json.POWER }}'
    headers:
      Content-Type: application/json

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

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95462

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>