Ultrasonic hc sr04

Hello
My project is measuring the water level in water container using ultrasonic sensor and node mcu.
And to turn on relay at low level and turn it off at high level.
The program is work correctly, and i used level widget , led and lcd to show the distance in cm.
But the problem is in turning on the relay. I used an eventor, the relay respond to the turn off condition but not respond to turn on condition.
Could you please give me your opinion.

Maybe confusion over active LOW relays and PUSH v SWITCH mode buttons?

Is there an idea to solve the confusion.
I am using a button to turn the relay on, but i need to depend on the level only

Screenshots of your Eventor setup.

It’s work with V5(led), but with D5(relay) not completly, just turning off.

The Set Vx to is expecting a range, typically of 0-255, like PWM… change to Turn ON or Turn OFF for any relay commands.

EDIT - oops, looks like you are already doing that… sorry, the differences in number characters was throwing me off a bit.

The relay is on D5 , it’s on, off.
The virtual is a led wedgit and it’s working correctly

So, if the relay never turns on, how do you know it turns (responds to) off?

I turn it on by button wedgit
And it turn off responding to condittion

What are the high and low levels used in Eventor and does V2 show the correct values when you fill and empty the tank?

Yes,
At 200cm the level is 200cm long far from the sensor.
It’s the low level
And when it 40cm , it’s the high level

Can you please translate me the Arabic numbers for ON D5 and OFF D5 as I’m not convinced you have the higher than and lower than the right way round.

OK I have done the translation.

So higher than 200 turn D5 on and lower than 40 turn D5 off. Looks OK.

@bhaa does it work with code? I know Eventor is used to eliminate code but sometimes you need to be sure all is fine with code before using the widget.

If sensor value is an int and say defined as sensorDistance could you try this in loop()

if(sensorDistance > 200){
   digitalWrite(14, 1);  // NodeMCU D5 is GPIO 14
}

Edit: this is only for test purposes and shouldn’t be used in a real project.

Also try with 14, 0 if relay is active LOW.

Thank you, i will try it.
And i will tell you the result

See my last edit about 14, 0.

I made it and it works ok, thank you.
But still there a small issue with going offline.
I think maybe if i tried a simple timer the issue will
Solved.
Thank you very much for your attention.
I will give you feedback with offline issue.

SimpleTimer (BlynkTimer) is essential for all but the most basic of projects.