# State change

**URL:** <https://community.gladysassistant.com/t/changement-detat/7596>\
**Category:** Configuration\
**Created:** [October 17, 2022, 7:25pm UTC](https://community.gladysassistant.com/t/changement-detat/7596 "2022-10-17T19:25:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [October 17, 2022, 7:25pm UTC](https://community.gladysassistant.com/t/changement-detat/7596/1 "2022-10-17T19:25:50Z")

</div>

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 ^^’

 ![Screenshot_20221017_211443](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/e/ecbab0da50a8fa8c398ec82493c9e1bb4e439218.jpeg)

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

 ![Screenshot_20221017_213420](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/6/684b2f1d777b372e0774d74eb0ceef7ce8a67450.jpeg)

How do you do it?

---

<div class="post-metadata">

**Author:** ![lmilcent](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/lmilcent/32/7023_2.png) [@lmilcent](https://community.gladysassistant.com/u/lmilcent)\
**Post date:** [October 17, 2022, 7:47pm UTC](https://community.gladysassistant.com/t/changement-detat/7596/2 "2022-10-17T19:47:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lmilcent](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/lmilcent/32/7023_2.png) [@lmilcent](https://community.gladysassistant.com/u/lmilcent)\
**Post date:** [October 17, 2022, 7:49pm UTC](https://community.gladysassistant.com/t/changement-detat/7596/3 "2022-10-17T19:49:26Z")

</div>

> [@spenceur](#):
>
> So indeed, I can do \>= 0 but I don’t find it clear.

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

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [October 17, 2022, 8:10pm UTC](https://community.gladysassistant.com/t/changement-detat/7596/4 "2022-10-17T20:10:17Z")

</div>

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

 ![Screenshot_20221017_220920](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/9/97e2bfa9bd59b2fb85d187cc64c17c4509b7556a.jpeg)

```auto
  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 «&nbsp;continue only if&nbsp;» I can’t make comparisons other than int. Even true or false isn’t converted to 0 or 1 ☹

---

<div class="post-metadata">

**Author:** ![lmilcent](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/lmilcent/32/7023_2.png) [@lmilcent](https://community.gladysassistant.com/u/lmilcent)\
**Post date:** [October 17, 2022, 9:43pm UTC](https://community.gladysassistant.com/t/changement-detat/7596/5 "2022-10-17T21:43:35Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [October 18, 2022, 4:54am UTC](https://community.gladysassistant.com/t/changement-detat/7596/6 "2022-10-18T04:54:49Z")

</div>

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