How to use a number from an MQTT to a Device


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?

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.

(for standard flows, the blinds card should be delayed by 1s)

1 Like

You are a STAR!!!

Many many many thanks!!!

1 Like

You’re welcome!

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

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

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

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

1 Like