# How to use logics with multiply and divide?

**URL:** <https://community.homey.app/t/how-to-use-logics-with-multiply-and-divide/74892>\
**Category:** Questions & Help\
**Created:** [January 10, 2023, 7:04pm UTC](https://community.homey.app/t/how-to-use-logics-with-multiply-and-divide/74892 "2023-01-10T19:04:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tirrazo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tirrazo/32/55444_2.png) [@Tirrazo](https://community.homey.app/u/Tirrazo)\
**Post date:** [January 10, 2023, 7:04pm UTC](https://community.homey.app/t/how-to-use-logics-with-multiply-and-divide/74892/1 "2023-01-10T19:04:35Z")

</div>

I tried to find a logic block for this, but not sure if there is one or this has to be set up like an expression?

I would like to show 200W in a tile instead of 0.2kW.  
I can’t see how to add prefixes or move the comma when I set up an AVD with a textfield, is this possible?

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [January 10, 2023, 8:44pm UTC](https://community.homey.app/t/how-to-use-logics-with-multiply-and-divide/74892/2 "2023-01-10T20:44:43Z")

</div>

You can add a AVD, add a numeric field. Set the unit “W” and the needed decimal settings (decimals, min, max) if needed.  
Then use a flow to set the value and use the tag from your source sensor (that das kW). Add a math expression like: {{ [tag] \* 1000 }}  
This will multiplicate the value with 1000 and you have a device sensor showing a value in W.

---

<div class="post-metadata">

**Author:** ![Tirrazo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tirrazo/32/55444_2.png) [@Tirrazo](https://community.homey.app/u/Tirrazo)\
**Post date:** [January 10, 2023, 9:41pm UTC](https://community.homey.app/t/how-to-use-logics-with-multiply-and-divide/74892/3 "2023-01-10T21:41:25Z")

</div>

Thank you for this!

Is the logic function with the ‘then’ card only option?  
Seems like I have to create a variable aswell 🤔

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

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [January 10, 2023, 9:52pm UTC](https://community.homey.app/t/how-to-use-logics-with-multiply-and-divide/74892/4 "2023-01-10T21:52:26Z")

</div>

I had to try but found the solution…

That’s an example power sensor:  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/e/5ed073960e54ac2224d02794353280ca06791fb3.png)

That’s the AVD with an energy capability:  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/5/052695b16d16ed3c6fd42e5f38657e0ab89bdefb.png)

That’s the flow:  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/5/a50ea222bdaf1f62b64dceed49b58ca3d6c12919.png)

Don’t use the “set numeric field” flow card because there you can only use a tag or value, but no expression. Use the “set field to description”:  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/3/33973c6f9e5f9cd1698a15f7a3de8cd138cc9e0d.png)  
You can select your capability and as desctiption you set the math expression including your global tag from your source energy sensor.
