Equal or less rule

Hi!

I’m having a hard time with a equal or less rule.

My sensor is a Ultrasonic range meter connected to a ESP8266 it’s checking the water level in a sump pump hole in my basement, I want to get an alarm when there is 10cm remaining before ouching the sensor.

My ESP8266 is using MQTT to send his value to Openhab and since I’m using PubSubClient it is sending a string.

My rule looks like this:
rule "Water level sump"
when
Item SumpPump changed
then
if (SumpPump <= 10){
pushover(“Le niveau d’eau de la SumpPump est dangeureusement haut.”)
}
end

Everything works but not the pushover alarm (it’s working with others sensors) so it must be the comparison that doesn’t work.

Any clue about that?

Pascal.

What if you tried

if (SumpPump.state <=10) { ....

Ho great!!! It’s working now!!!

Learn one more thing about OpenHab.

Thank you very much for your help.

Pascal

Your welcome… Helping each other is the great thing about this community

1 Like

Sir,

I am trying to do basically the same thing, but with the graphical rule included in oh3. I tried the symbols, but it expects just numerical. I cant choose to do a conditional statement on the same item.

Basically, when the temperature reaches a certain point (which could be read as less than…) then do x.

I tried to set the rule without any particular state, then do a conditional to allow for the less than or equal to, but it won’t allow it.

Sorry to not create a new thread, seemed like this was too close to the same thing…

Well, four years have passed, you’re working with a different version of openHAB and using a different rules system. We don’t mind new threads.

Here’s a more recent thread on related topics -

Nevermind…I had my groups messed up, a parent group as a child, couldn’t access it.