# How to use a number from an MQTT to a Device

**URL:** <https://community.homey.app/t/how-to-use-a-number-from-an-mqtt-to-a-device/76362>\
**Category:** Flows\
**Tags:** advancedflow\
**Created:** [February 11, 2023, 5:39pm UTC](https://community.homey.app/t/how-to-use-a-number-from-an-mqtt-to-a-device/76362 "2023-02-11T17:39:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Busta999](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/busta999/32/10053_2.png) [@Busta999](https://community.homey.app/u/Busta999)\
**Post date:** [February 11, 2023, 5:39pm UTC](https://community.homey.app/t/how-to-use-a-number-from-an-mqtt-to-a-device/76362/1 "2023-02-11T17:39:23Z")

</div>

Hi

Trying to use an Advanced Flow to receive a target numeric value ie 50 from MQTT Client then use that 50 and insert it into a Device.

I can access the content of the MQTT piece in a Push Notification I get a green ‘a Message received from topic’ but this Tag is not accessible form the Aqara Blind Device.

Anyone any ideas on how to extract the number from the Tag and insert into the Device?

 ![Screenshot 2023-02-11 at 17.35.07](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/9/19354e62e2f3b9a6cce56c9b56ad8d05a83dc707.png)  
 ![Screenshot 2023-02-11 at 17.32.49](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/d/5d1391d9444b8ddbe2e6b13801eedf6e6bf7222f.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [February 11, 2023, 6:03pm UTC](https://community.homey.app/t/how-to-use-a-number-from-an-mqtt-to-a-device/76362/2 "2023-02-11T18:03:03Z")

</div>

Convert the string variable to a numeric variable.

- Create numeric variable [numvarX]
- Right before the Office blinds card, add the logics card ‘calculate a numeric value “numvarX” as [variable]’  
and insert the green mqtt tag [Message received from topic]
- Insert [numvarX] in the Office blinds card.

 ![Screenshot_20230211-190553_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/b/bb394fb76062508bf209bef561dbb746cb55eec7.jpeg)  
(for standard flows, the blinds card should be delayed by 1s)

---

<div class="post-metadata">

**Author:** ![Busta999](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/busta999/32/10053_2.png) [@Busta999](https://community.homey.app/u/Busta999)\
**Post date:** [February 12, 2023, 5:25pm UTC](https://community.homey.app/t/how-to-use-a-number-from-an-mqtt-to-a-device/76362/3 "2023-02-12T17:25:26Z")

</div>

You are a STAR!!!

Many many many thanks!!!

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [February 12, 2023, 6:34pm UTC](https://community.homey.app/t/how-to-use-a-number-from-an-mqtt-to-a-device/76362/4 "2023-02-12T18:34:50Z")

</div>

You’re welcome!

I thought of another (much quicker) way, without the need for an additional logics variable:

 ![Screenshot from 2023-02-12 19-31-06](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/e/ce40acb9a4ac747cb479b5d06f7e9d25f803f0a9.png)

Use Homeyscript card ‘Run code with argument and return number-tag’ and enter this code:

```auto
// Float Calc
return parseFloat(args[0])

```

(The Float Calc code was posted by @DaneedeKruyff in the Advanced flow topic)
