It works but it is ugly

It looks like you are using Home Assistant.

I think that few here use HA, so anyone who downloads your flow will get this:
Untitled 1
Not much to go on, sadly.

I suspect that the Home Assistant forum is the place to ask for help.
Same advice as you were given last February!

Edit - There are some discussions in this forum about switching things on and off combining the readings from two different sensors.
I found one discussion because I posted in it, but I have seen others too.