How can I get the current state of my device?

Hello everyone!
I'm kinda new to Node Red and I'm facing some issues, so I hope somebody more experienced than me can help me.
The thing is I'm trying to get the current state of my LoRa device using a GET HTTP in node and HTTP out node, plus a web socket out node to display the template I created (I followed a tutorial I saw on YT). By doing this I get to see the device's state only if I go to my URL before the device sends an uplink, but the goal is to check the device's state anytime, included after it sends the uplink, so how can I do it?
I saw there's a dashboard option where I do actually see the device's status anytime but in my case this info should be availabe via URL, so I don't think the is the right solution...

This is what my flow looks like (disclaimer: I'm showing a different device but it's the same machanism).


When I go to the URL the page doesn't show the infos, and I have to wait for the device to send an uplink which requires a lot of time. This is how the page looks like after I manually activate the device.
image

To sum up, I'd like to see the last pic everytime I go to the URL, instead of waiting an uplink from the device.

Thanks in advance to anyone who will help me and I'm sorry for my bad English.

Welcome to the forum.

Could you post the Youtube link?

It is hard to know what it is saying without watching it.

I find the use of HTTP requests to obtain device status confusing (I mostly use MQTT) but I think this might be a solution:

Request the device status fairly frequently, perhaps after a 5 seconds delay from the last response.
Store the value in a flow context variable.
Change your template to output the value of the context variable.

So this LoRa device..... Does it have an IP?

If it does, you could ping it. :person_shrugging:

Hi, thanks for the reply!
Here's the video and page I used as a reference:

Hi, thanks for the advice!
I'll do some research about context variable and see if it works out.

I don't know the device's IP. It's connected to a Milesight gateway and I'm using its Node Red extension to get the Lora inputs.

Sorry, I am not too familiar with LoRa stuff myself.

But.... If I am not wrong, it connects to a WiFi network - or what ever.
It gets an IP address when it connects.

So: as long as it is connected to a network, it will have an IP address.

But I am way out of my depth with LoRa stuff.

Maybe someone else could clarify this point.

I've figured it out! I've done lot of changes but mostly important I used global variables and deleted the web socket out node.

Thank you for your time :raised_hands:

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