ESPhome without HASS

Hi, today I had a crash on my HASS server, and wished to use a Sonoff switch urgently, and of course I could not.

So as a backup I wish to be able to control the switch also without HASS for those cases. I tried but did not succed.

My switch art of the Sonoff POW R1 flashed is this below (it works perfectly in HASS)

switch:
  - platform: template
    name: "guest_room_tv_power_plug"
    optimistic: true
    id: guest_room_tv_fakebutton
    turn_on_action:
    - switch.turn_on: relay
    - light.turn_on: led
    turn_off_action:
    - switch.turn_off: relay
    - light.turn_off: led
  - platform: gpio
    id: relay
    pin: GPIO12

and I gave this POST command, but the switch did not turn on. Where is my mistake?

http://192.168.1.7/switch/guest_room_tv_power_plug/turn_on
1 Like

Perhaps some help here? Not sure though.

To use the rest API you need to configure the http component. https://esphome.io/components/web_server.html

1 Like

I have mine setup so that the button on the sonoff triggers the relay. This only works if your sonoff is in an accessible place of course…

add the web_server: component to your device, and then simply browse to the device’s ip address.
All switches and sensors will be in the web frontend.

I had that.

After a restart its working, don’t know what happened.

@OttoWinter Love this ESPHome, absolutely love it. Very cool. I am not buying any WiFi device if cannot be flashed with ESPHome.

BTW any chance that Yeelight lightbulbs can be flashed with ESPhome, maybe in the future, or is technically impossible?

1 Like