Question about HTTP Request options for fallback

I have a a bunch of sonoff devices around my house that turn off/on via MQTT at certain hours of the day.

The problem is that we had a power outtage and my UPS couldn’t keep server online so the Hassio VM went down, along with my MQTT service.

My raspberry was online so i’m wondering if I can implement a quick lovelace page with a button to execute 4 different http requests to each sonoff device to turn them off/on when I push the button.
A type of backup if the server isn’t online.

Is it best to configure an entity button and use a local script that does wget’s or is there a better way to trigger all 4 at the same time without MQTT (The do have Http:/x.x.x.x/cmnd/power=off or power=on type command options

Haven’t been able to figure this one out.

Anyone think it’ll be better with a script execution on button press OR
possible to do http commands right from a button?

I’m new to HASS so please excuse the newb quesiton

If the power is off, your sonoff isn’t going to work either.

Right… Let me try again.

If there is a power surge/outtage and upon restoration, the sonoff’s come back and are on but the server is not (or has crashed, or any other of a myriad of issues) – is there a way to use a script to execute HTTP commands to the wifi switches?

I’m a little confused about your setup.

Do you have two instances of HA running (one on pi one on VM)?

It is certainly possible to execute shell commands (curl) that can be run from a button or script.

What does the http command look like?

Yes Tom, that is right…

Actually, I have 3 instances of HA running, the two raspberry Pi’s are on different floors of my house and each has a z-wave stick. The reason is concrete/rebar walls and a poorly meshed network so i’ve just split it up. The server runs the MQTT broker and other centralized things such as Sonoff (my wifi network is on Meraki equipment and is rock solid) — I have z-wave events on each PI sent via MQTT to the central broker too. But in this case, the VM just turns the sonoff on at night and off during the day.

The problem is if the VM craps out, I’d like a raspberry to watch for this and have a backup. Thinking a button to press on a dashboard is easy for the wife too.

There are 4 sonoff’s but all are the same.

http://192.0.65.152/cm?cmnd=Power%20off

If you search in the integrations page, you’ll find the rest integration. Or a commandline switch with curl/wget

One way:

shell_command:
  sonoff_65_152_off: 'curl -k "http://192.0.65.152/cm?cmnd=Power%20off"'

Then call the service shell_command.sonoff_65_152_off from any automation, script or Lovelace control.

There is no feedback to tell if the switch is off with this method, unlike nick’s suggestion, where you can incorporate state feedback from the sonoff:

Thanks a bunch guys. I’ll give it a test this evening.