LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MQTT subscribe client on Labview

Dear jephin27,

 

I tried your VI and I can establish a connection. However, I encounter this error:

"Flattened String To Variant in OpenSerializer.lvlib:Serializer.FlattenedString.lvclass:unmarshalling.vi:3430001->OpenSerializer.lvlib:Serializer.lvclass:UnMarshall.vi:4390003->OpenSerializer.lvlib:Serializer.lvclass:UnMarshall (binary).vi:6550002->MQTT Base.lvlib:MQTT_Base.lvclass:Decode Publish Package.vi:2830001->MQTT Client.lvlib:Client.lvclass:Decode Application Message (Type).vi->DropVi_SimpleClientSubscriber.vi.vi".

Can you help me with this?

Thank you!

0 Kudos
Message 11 of 13
(762 Views)

What type is your received data? Decode Application Message (Type).vi works on LabVIEW data types. Use Decode Application Message (Raw).vi to get a byte array that you can decode according to the received data type.

 

See here for a detailed explanation: https://github.com/LabVIEW-Open-Source/LV-MQTT-Broker/issues/169#issuecomment-950385388

Message 12 of 13
(745 Views)

Thank you for the answer!

 

I think that the link solved the question.

The data is float but I had to substitute the "Decode Application Message (Type)" with "Decode Application Message (Raw)".

I also added a conversion from byte array to double passing by a string type (maybe it's dumb and there is a better way to do it).

 

I attach a screen of this part of the VI.

0 Kudos
Message 13 of 13
(711 Views)