Web API / JSON

Hello Mitja / LightAct Team.

We are still in the process of developing a realtime application for this real estate company specializing in smart buildings and the next hoop that is coming up is working with API’s to parse the sensors data streams.

For now we do not have certain information which protocol they use for the building so the plan was to work with public API’s like OpenWeather for a prototype.

Basically doing what Kirell Benzi is explaining in this tutorial with cables.gl.

So I have found the JSON Parsing Node Reference but I could not really make it work or better said I am also unsure if it even has those capabilities.

Also I came across the “Scheduled Reader” Node which looks like it would be laid out to read out those Web APIs. But supposedly this only works with the WebUI in the Pro Server Version.

Could you explain a bit how such an implementation would work?

Best regards,
Philipp

Hello,

We actually had a project with OpenWeather some time ago :slight_smile:

There are 2 ways of doing this that I can think of:

WebUI & Server way

You can use a File Reader widget in WebUIs
image

File Reader reads the contents of a file on a disk or a resource on the web (such as an RSS feed). It writes the data into a database from where LightAct can read it.
image
Then you can use Read Scheduled Reader node which outputs the entire content of the file/resource and either run it through a JSON parser or just check if it contains a specific substring.

If you choose to go this way, we can also add some additional nodes or features for you.

Software license way

If you don’t want to use a server then you’d need to get the string into LightAct using a different way. For example a UDP or a TCP message. So instead of a Read Scheduled Reader node, you’d use UDP or TCP Listener node. From there on, the pipeline would be similar to the above.

I hope this helps.
Mitja