Website monitoring with WIO terminal And Freshping

WIO terminal is an all-in-one IoT development platform from SeedStudio. In this post we will see how monitor a website or a web service using WIO terminal. Actually we will be using WIO terminal to show the status, the monitoring is done by Freshping.

What will we learn

  • how to make a get request
  • how to parse a JSON response

What do we need

  • WIO terminal board
  • Arduino IDE – check out this post if you haven’t update the firmware of WIO
  • Arduino libraries – ArduinoJson 6.x, you need install WIO related libraries from this post
  • Freshping account – follow this post to setup monitoring for a website

we also need freshping check id for the website under monitoring. To get the check id goto freshping dashboard and click on “View Report”.

freshping view report

now you can see the check id in url, please take a note of it, we need to put it in Arduino script

freshping check id

Getting website status from Freshping

We can get the current status of the website using following link, replace check id with the one you got from above.

https://api.freshping.io/v1/public-check-statuses/<check_id>/
https://api.freshping.io/v1/public-check-statuses/524828/

If we put this link in browser we will get following JSON response.

{
    "check_id":524828,
    "application_id":140614,
    "state":"AV",
    "changed_time":"2021-01-02T10:00:20.889175Z"
 }

We are interested in “state” field. We will be using the value of “state” field to decide what to show on the WIO LCD. I thought of putting a PartyParrot when the site is up and SadParrot when site is down but decided against it as it requires putting image data in the code and the code bloats. For now we will just show simple text message.

Showing status on WIO terminal

We will parse the JSON response from GET request and extract the state field value. We can do different things based on the value of the state variable like flashing a LED or buzzing the buzzer. following code will print the state value on the LCD.

put in WiFi network details and replace the check id present in the URL with your site check id and load the code. you should see the following screen on LCD.

status on WIO LCD

Add a Comment

Your email address will not be published. Required fields are marked *