# Calcul on Extended Flow

**URL:** <https://community.homey.app/t/calcul-on-extended-flow/143298>\
**Category:** Questions & Help\
**Created:** [September 22, 2025, 1:48pm UTC](https://community.homey.app/t/calcul-on-extended-flow/143298 "2025-09-22T13:48:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pascal\_Chignon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pascal_chignon/32/122516_2.png) [@Pascal\_Chignon](https://community.homey.app/u/Pascal_Chignon)\
**Post date:** [September 22, 2025, 1:48pm UTC](https://community.homey.app/t/calcul-on-extended-flow/143298/1 "2025-09-22T13:48:09Z")

</div>

I have a request to retrieve data, but this data is in W, and I want o display it on Kwh (also /1000)

I create this flow

 ![Capture d’écran 2025-09-22 à 15.40.50](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/f/cf86e25ad59eb1fbf042c361a6632008e8f2898f.png)

With this code inside the Execute code :

// My Code  
value = parseInt(args[0])  
console.log(value);  
result = value /1000  
console.log(result);  
return result;

The result before the execute code is 7809680, when I tried the execution code is ok : 7809 but the result at the end is 7809680.

How I can integrate an operation ?

---

<div class="post-metadata">

**Author:** ![Dijker](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@Dijker](https://community.homey.app/u/Dijker)\
**Post date:** [September 22, 2025, 2:29pm UTC](https://community.homey.app/t/calcul-on-extended-flow/143298/2 "2025-09-22T14:29:11Z")

</div>

> [@Pascal\_Chignon](#):
>
> but this data is in W, and I want o display it on Kwh

Watt isnt convertable to kWh without calculating also the timespan.

So 1 Watt / 1000 is 0.001 kilo Watt

But using that 1 W over the period of 10 hour is only only 0.01 kWh

Wher did you put your timespan in your formula?

Beside that your code is not correct,  
your flown is also using the [Result] from the Logic card. The Homey script isn’t passing the calcuated value backt to the flow.

---

<div class="post-metadata">

**Author:** ![Pascal\_Chignon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pascal_chignon/32/122516_2.png) [@Pascal\_Chignon](https://community.homey.app/u/Pascal_Chignon)\
**Post date:** [September 22, 2025, 3:41pm UTC](https://community.homey.app/t/calcul-on-extended-flow/143298/3 "2025-09-22T15:41:58Z")

</div>

Sorry, it’s Wh to kWh (no need time stamp), it’s the direct data from French electriclty counter

---

<div class="post-metadata">

**Author:** ![Pascal\_Chignon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pascal_chignon/32/122516_2.png) [@Pascal\_Chignon](https://community.homey.app/u/Pascal_Chignon)\
**Post date:** [September 22, 2025, 5:48pm UTC](https://community.homey.app/t/calcul-on-extended-flow/143298/4 "2025-09-22T17:48:22Z")

</div>

How I can use the result from the homey script ?

---

<div class="post-metadata">

**Author:** ![ReneO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/reneo/32/3522_2.png) [@ReneO](https://community.homey.app/u/ReneO)\
**Post date:** [September 22, 2025, 9:09pm UTC](https://community.homey.app/t/calcul-on-extended-flow/143298/5 "2025-09-22T21:09:40Z")

</div>

You can use another card that returns the calculated value as a tag you can use in you’re flow.

 ![1000018013](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/2/325bf92285ebaee855e6b975ac2271e348b2bcb2.jpeg)

Or you can use the logic And card to make the calculation:

 ![1000018015](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/f/3f1b27959a2450570b21aca9f90708e13184d5a5.jpeg)

(I don’t have access to a PC at the moment so I can’t create an example flow, but hopefully this helps.)

---

<div class="post-metadata">

**Author:** ![Pascal\_Chignon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pascal_chignon/32/122516_2.png) [@Pascal\_Chignon](https://community.homey.app/u/Pascal_Chignon)\
**Post date:** [September 23, 2025, 7:30am UTC](https://community.homey.app/t/calcul-on-extended-flow/143298/6 "2025-09-23T07:30:10Z")

</div>

Thanks a lot; it’s ok
