Automation for area

I have installed a Victron inverter, I monitor for mains failure currently and want to be able to switch off sonoff’s I’ve added to an area called “non critical”.

I have an automation currently that does this per device, i.e. when mains fails I switch of each device individually but it’s a lot easier for me to have this area and add the devices to the area and then be able to tell it to switch off all devices in that area.

I have played around with the automations and cant seem to find a way to do this so not sure if it is possible.

Actually while typing this I started looking at scenes and by the look of it I could create an on and off scene for these devices.

I’ll leave this here as would like to know if the area automation is possibly and also think this may be a useful thread for others.

If specifying an area_id instead of entities doesn’t work, you could just use groups for that, couldn’t you? https://www.home-assistant.io/integrations/group/

Thanks for the suggestion, I tried it and it does work as does the scenes i.e. I created an automation that switches either the group off or activates the scene that switches the devices off but its a bit of a work around in both of these scenarios.

I guess its not the end of the world, it would be handy if you could switch off devices in an area but its not a train smash to have to do it using either groups, scenes or adding each individual device to the automation.