State change

Hello everyone!

I wanted to know if there was a way to check a state change without a condition?
I want that on each change of value of a temperature sensor, I run x scene.
Only I have the impression that I don’t have the choice of having an extra condition.

So indeed, I can do >= 0 but I don’t find that clear.
I just want that on each change of value I execute all my other scenes without saying that Paul is taller than Jack or whatever ^^’

Otherwise, is it possible to compare two numbers in Gladys (I get setpoint and temperature)
I would like to compare them with each other like

How do you do it?

The comparison, I think that’s a feature request!

In the meantime you can use the MathJS web API to calculate the difference.
Tsetpoint - Tsensor >= 0 then the setpoint is reached.

1 Like

I think that’s right: if the sensor value is different from zero, then we trigger the scene.

Do you have a link to an example because when I do this I get an error :

  Error: Syntax error in part \u0026quot; \u0026lt;20 \u0026quot; (char 6)  400

Edit: it seems that on mobile when you add a variable, it adds a space each time afterwards.

You just have to remove them in the end for it to be ok ^^

Edit 2: however it returns a boolean and when I try to use « continue only if » I can’t make comparisons other than int. Even true or false isn’t converted to 0 or 1 :frowning:

Just do the calculation. The test is in Gladys using the variable that holds the calculation result.

  1. Calculation with mathjs (20-21 for example)
  2. Test in Gladys of the result (if result > 0, then)

That’s what I ended up doing, indeed :slight_smile:
Thanks to you

1 Like