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.
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.
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.