Extract value from switch-bot reading

Hi there.

I have recently grown fond of the switch-bot IoT devices - they are well made and seem to be open for node-red.

I am using the node: test-switchbot-devices which reads my connected devices nicely. A call returns this:

and the device I am interested in is at "object 3" in the screenshot.

{"deviceId":"DE1B6383BD87","deviceType":"Meter","hubDeviceId":"DC5EC64D9A13","humidity":36,"temperature":19.1}

and I am specifically interested in collecting the temperature value.

I suppose I run this through a function node? How should it look like?

Thanks for the help.

Mathias

In a change mode
set msg. payload
to JSONata J:
$$.payload[deviceId = "DE1B6383BD87"]

That should return the object.
To get indiviual readings add .temperature etc, or later in flow use msg.payload.temperature

1 Like

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