Switch off a rele if energy consumption if over a value

Hi,
i would like to switch off a rele if total house consumtion is more a value.

I use a Shelly EM to measure my main energy counter and if i more of 6000W i want to switch off a shelly 1PM to turn-off some device.

This is easy, but i want to switch-off only if this device is turn-on.
Example:

I use my device and have a 1500W of consumption.
On my main energy counter i have 6200W and i switch-off my device to free 1500W, but only if this turn on…

how i can put in this second check in my flow?

example

if my main energy counter change
and if energy is more then 6000W
and bathroom energy is more 1500W

then switc off bathroom

The second “and” relative to bathroom energy is not possible,
how i can resolve?

thanks
Marco

OK i found a workaround but how is good i don’t know…
My workaround is:

  1. create a flow that check energy in main power meter and set a variable to yes if value is more that my limit ot false if value is less that my limit.
  2. i create a single flow to check energy of my device and if variable is yes i can check also energy value for my device and decide to switch-off device

Question is… are this workaround a problem for performance of homey?
how works flow?
are flows run in background and can slow down homey?

thanks
Marco

Probably you think to difficult, when a device is OFF and you send an OFF command, this doesn’t harm.
Otherwise you can check in the AND column If the device is ON:

Be aware that some devices don’t update their status to Homey, when they are switched on Manualy (not via Homey).