# Basic Maths on iHost

**URL:** <https://forum.ewelink.cc/t/basic-maths-on-ihost/21517>\
**Category:** eWeLink CUBE\
**Created:** [September 7, 2023, 6:12pm UTC](https://forum.ewelink.cc/t/basic-maths-on-ihost/21517 "2023-09-07T18:12:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![eerke](https://avatars.discourse-cdn.com/v4/letter/e/eb9ed0/32.png) [@eerke](https://forum.ewelink.cc/u/eerke)\
**Post date:** [September 7, 2023, 6:12pm UTC](https://forum.ewelink.cc/t/basic-maths-on-ihost/21517/1 "2023-09-07T18:12:32Z")

</div>

Is it possible to do basic maths on an iHost that I haven’t thought of?

For example the use case is that I have two temperatures (inside and outside) is it possible to say when the temperature outside gets colder than inside and effect some way of letting me know to open the windows.

I’m thinking this as it’s really hot here but still 4°C colder than outside and I keep having to check the temperatures.

I know I could go out into the internet and do it. Did something similar when Apilio was free.

---

<div class="post-metadata">

**Author:** ![csongor.varga](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@csongor.varga](https://forum.ewelink.cc/u/csongor.varga)\
**Post date:** [September 7, 2023, 6:55pm UTC](https://forum.ewelink.cc/t/basic-maths-on-ihost/21517/2 "2023-09-07T18:55:12Z")

</div>

I think for now the Node-Red docker would be the easiest way of doing that. You can read the two temperatures in Node-Red, calculate a difference and and it if over a threshold you can flip a state. And you can easily resend this state as a virtual switch that Node-Red will turn on/off. With that you can build a scene in iHost to perform the required task.

---

<div class="post-metadata">

**Author:** ![eerke](https://avatars.discourse-cdn.com/v4/letter/e/eb9ed0/32.png) [@eerke](https://forum.ewelink.cc/u/eerke)\
**Post date:** [September 8, 2023, 12:05am UTC](https://forum.ewelink.cc/t/basic-maths-on-ihost/21517/3 "2023-09-08T00:05:22Z")

</div>

Thanks. I hadn’t thought of node red. I did install it and have a quick play but have never used it properly.

---

<div class="post-metadata">

**Author:** ![csongor.varga](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@csongor.varga](https://forum.ewelink.cc/u/csongor.varga)\
**Post date:** [September 8, 2023, 9:45am UTC](https://forum.ewelink.cc/t/basic-maths-on-ihost/21517/4 "2023-09-08T09:45:18Z")

</div>

Let me know if you get stuck, I did similar with Node-Red iHost before.

---

<div class="post-metadata">

**Author:** ![wanvos](https://avatars.discourse-cdn.com/v4/letter/w/65b543/32.png) [@wanvos](https://forum.ewelink.cc/u/wanvos)\
**Post date:** [September 21, 2023, 3:12pm UTC](https://forum.ewelink.cc/t/basic-maths-on-ihost/21517/5 "2023-09-21T15:12:51Z")

</div>

Hi Csongor I got stuck trying to read form the temperature / humidity sensors (SNZB-02D) in node-red, could you point me in the right direction ? Thanks.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/ewelinkforum/original/2X/5/58bea9bf423842b2928939eb9fc33f3140ccb356.png)

---

<div class="post-metadata">

**Author:** ![csongor.varga](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@csongor.varga](https://forum.ewelink.cc/u/csongor.varga)\
**Post date:** [October 3, 2023, 9:56pm UTC](https://forum.ewelink.cc/t/basic-maths-on-ihost/21517/6 "2023-10-03T21:56:04Z")

</div>

I was just playing around with this and I think I got it started. Let me put together a quick video on that.

---

<div class="post-metadata">

**Author:** ![csongor.varga](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@csongor.varga](https://forum.ewelink.cc/u/csongor.varga)\
**Post date:** [October 4, 2023, 3:06pm UTC](https://forum.ewelink.cc/t/basic-maths-on-ihost/21517/7 "2023-10-04T15:06:25Z")

</div>

Check out my video on this: [https://youtu.be/TXFxgS0h3wk](https://youtu.be/TXFxgS0h3wk)

Let me know if this help understanding my approach to this.

---

<div class="post-metadata">

**Author:** ![wanvos](https://avatars.discourse-cdn.com/v4/letter/w/65b543/32.png) [@wanvos](https://forum.ewelink.cc/u/wanvos)\
**Post date:** [October 7, 2023, 8:38am UTC](https://forum.ewelink.cc/t/basic-maths-on-ihost/21517/8 "2023-10-07T08:38:23Z")

</div>

Thank you its working now, the latest node-red-contrib-ewelink-cube update (1.1.0) enables the SNZB-02D sensor.

As you mentioned in your video the structure returned by the event-state item is unexpected : payload.payload.temperature.temperature and payload.payload.humidity.humidity that requires a fix (I used a function).
