Staged activation: turning on/off devices based on the value of an input_number

Hello,
I’ve setup my HA to increase/decrease an input_number, based on the electric power injected into the grid (from my solar panels).
Now, I have an “injection stage” (from 0 to 4), that is increased/decreased based on the mean power injected to the grid within the last 5 minutes.

What I’m trying to do is to turn on/off devices in a sequence based on the “injection stage”:

  • Turn on device x when injection stage increases from 0 to 1
  • Turn on device y when injection stage increases from 1 to 2
    and so on, and the same when decreasing
  • Turn off device y when injection stage increases from 2 to 1
  • Turn off device x when injection stage increases from 1 to 0

Is there a smart way to do that than hardcoding each single step ?

Thanks in advance for your help
Pat

These psuedo/generic questions will just result in either no response or a equally generic answer.
Just post your current configuration instead so that we can help you not some generic person.

Post this automation that sets your input number and post your x, y and power sensor.

1 Like