Groov View ready status check - Example flow

Had a customer ask a question…

They have a groov EPIC PR1 in an enclosure with a HDMI touch screen on the front for their local control.
At another remote location (but on the same network) they have another computer (Raspberry Pi in this case) that is running a full screen Chrome browser looking at the groov View project running on the PR1.

What they were looking for is a way for that remote station to know the status of the groov View webserver.
The PR1 boots different services at different speeds, the MMP server, the PAC Control engine, Node-RED, groov Manage and groov View all become ‘ready’ at different times during the boot up just like a normal Linux PC.

Here is one way I roughed out this morning that seems to detect the groov View web server readiness pretty well.
As usual, there are a few different ways to get the same information, so do post if you tweak things.

groov View has a nice API to it… The cool thing about it is that groov View has to be fully up and running in order for the API to be responsive.

You can find it from build mode, under Help.

When you open that link, you will see the Swagger doc.
I really liked the sound of the very first end point that listed.

No parameters are required, and no authorization required.
Just hit the end point and you get a response (or not).

Node-RED is really easy to install on either a Pi or Windows PC.
Go ahead and do that.
Then you just need to double check what the PR1 certificate is setup for
Every connection to the PR1 has to be secure (ie https), so the Pi needs to have the right self signed (or CA) certificate from the PR1 installed.
Start off by checking that the CN (common name) on the PR1 matches either its host name or IP address. Note, if you are on a network with no DNS, you probably want to use a static IP for the PR1 so that the certificate will always match its IP.

From groov Manage home menu, click on Security, then Server SSL, then View Decoded Certificate.

Notice that my CN matches the IP address of the PR1.

If it does not match, make a new cert and make sure you set the Server Name correctly.

Hit create, then download the new cert.

Ok, now we can import the following flow.

Every 5 seconds we hit that groov View /info API endpoint and expect to get good information back.
The function block looks for two specific strings, if it sees them, it sets the payload as required.

if (msg.payload.includes("GRV-EPIC-PR1")){
    msg.payload = "Up";
    return msg;
}

if (msg.payload.includes("Error")){
    msg.payload = "Down";
    return msg; 
}

Here is the flow to import.

[{"id":"49c4acb0.7f2694","type":"inject","z":"1e6e177.5b94369","name":"5 Seconds","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1150,"y":240,"wires":[["5bc0a924.abd268"]]},{"id":"30482b98.374a2c","type":"debug","z":"1e6e177.5b94369","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1690,"y":240,"wires":[]},{"id":"5bc0a924.abd268","type":"http request","z":"1e6e177.5b94369","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://10.192.0.159/view/api/info","tls":"","persist":false,"proxy":"","authType":"","x":1330,"y":240,"wires":[["496734c7.fa1124"]]},{"id":"496734c7.fa1124","type":"function","z":"1e6e177.5b94369","name":"Up or Down?","func":"if (msg.payload.includes(\"GRV-EPIC-PR1\")){\n msg.payload = \"Up\";\n return msg;\n}\n\nif (msg.payload.includes(\"Error\")){\n msg.payload = \"Down\";\n return msg; \n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1510,"y":240,"wires":[["30482b98.374a2c"]]}]

You will need change the IP address in the HTTP Request node to match your PR1.
You will also need to path out the location of your certificate you copied over, or you can just upload it through the http request node which might be easier… to do that…

Then after click 2… Click upload

Click the upload button and add your PR1 certificate via the file you saved a moment ago.

You can change the 5 second timer, but keep in mind that the http request node has a built in 3 second timeout, so anything less than that will be pointless… 5 seconds seems a sensible balance.

Of course what you do with the payload of ‘up’ or ‘down’ is up to you. That’s a bit too application specific to include in this flow.
One thing I might add right off the bat is an RBE node/code so that you only get the notification when it changes, not every 5 seconds.

Hope that helps a few people think about ways to check the availability of any web server (not just groov View).

2 Likes