Help me parse this payload please

Hey Guys,

Using Tasmota on an ESP32 - to monitor BLE temperature sensors - just migrated this from the OpenMQTTGateway platform.

I am having trouble getting the MQTT input parsed within NR.

In this instance i have 3 of the sensors that are monitored by this ESP32 - apparently the ESP32 chunks the results up into a single stream when reporting them in and this is where i have run into issues

Here is the output of the MQTT node in

image

You can see this messages contains info from two of the sensors they are identified as MJ_HT_V1 and then part of the Mac address - each one then has the info for temperature etc.

Struggling to work out the combination of JSON/Split/Switch nodes to rip this apart and enable identification/parsing of each field for each sensor

Anyone give me a hand on this ??

thanks

Craig

1st, change your MQTT node to output "a Parsed JSON Object"

2nd, using 2 change nodes in parallel

  • set 1st one up to set msg.payload to msg.payload.MJ_HT_V13abd86
  • set 2st one up to set msg.payload to msg.payload.MJ_HT_V13aaff4

WIll give it a try now - thanks Steve

Craig

You guys make it look so easy !!

That worked straight off thanks Steve.

Only one issue - it is giving me two object for each incoming message - one of which does not have the temperature property and hence errors when i feed it to the smooth node - will attempt to filter that now

Craig

Before the smooth node add a Switch which only passes messages containing the property.

Yep - exactly what i have done thanks - checked in the switch node for the Mac address which was only coming through in the valid packets - looks good so far - thanks

Craig

It might be better to switch on whatever property you are smoothing.

Yes i can see that might simplify the flows a little - will play around with that and see - thanks

Craig

It wasn't so much to simplify the flow as to make sure it works. If you want to check that something is present it is usually best to check for it being present, rather than checking for something else and predicting from that the the required item is present.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.