WordPress integration

Hello everyone.

Are there any of you, who have succesfully transmitted data from TTN, to a wordpress database?
I would like to display my sensor values on my own website, but is not quite sure how to integrate TTN to wordpress.

I’m looking forward to hear from you, and thanks in advance :smiley:

Looking at the feasibility of that now - probably retrieve data from the Data Storage integration and then provide both tabular format & charts

Note that the Data Storage integration only stores 7 days of data. And it needs server side code to be queried; see Integrations - Data Storage / API generates a CORS error when accessed from script running in my browser.

Yup, I am aware, I’ll be downloading data to the resident database, building summaries and then providing widgets to display the data as required.

Rather than querying and filtering the data from the Data Storage integration, you might want to be use the MQTT API or HTTP Integration instead, if only as that would also give you all metadata.

Yup, I am aware, however I’m not looking to create a full data experience that having the meta data brings - more offload the random requests for dashboards back to the user. My primary target is proof-of-concept projects.

It can get a bit complicated part initialising WordPress so you can use it’s facilities from a URL that is being called externally, so I’ll leave that out the picture for now.

Emphasis on downloading - I’ll like TTN too much to burden them with more than one retrieve of data, that’s just not fair use.

Hi Nick,
One approach could be to use http integration to push the data to a Zapier webhook. Then, you can send it to a Google Sheet, and transorm it into a dashboard with Google Data Studio. After that, you can integrate it to your WP site without having to deal with the DB. Should be fair for a POC

1 Like

The HTTP Integration can also push to Google Sheets directly, using some Apps Script in the sheet to provide a webhook URL and to parse the JSON payload. I guess that also allows for that Google Data Studio dashboard, but I’ve never used that.

(In the example you might want to look for the comment about “Or, to add at the top (which … nicely extends any existing ranges, like when used in charts)”.)

1 Like

Data Studio will work with both solutions, it only needs a sheet as datasource. Zapier is just a facilitator here, but direct push is always better, for sure. Of course, at the end, it can not be used for any production, as there are limitations with Google sheet (nb of rows and script calls per day for instance).

1 Like

Actually, I’ve used similar things in production, for sales data that was quite high traffic at peak hours. (Think: every 10 seconds.)

For LoRaWAN, I’d guess that the Google limits are far below TTN’s Fair Access Policy? (Even if one would push that Fair Access to its limits. Aside: I happen to create sheets for each month, which might help.)

1 Like

It really depends of the number of devices and data you have. It can quickly become a nightmare if you have thousands of rows, especially in terms of performances. Today, you can build a db server for 1,49 eur/month (ovh), install MySQL on it and add a basic api made with php. It will always be better.

1 Like

Hmmm, this has potential. Although, as you note, we do rack up a fair number of rows so the data source has to be right-sized.

The WP plugin isn’t for a single project POC, it’s to simplify future POC & starter projects and by providing a simple set of selections for sensor & date range, leave the client to finesse the presentation.

I already have a desktop version built in FileMaker which also helps with device management, more complex alarming groups and allows for adhoc queries without the user having to get in to SQL. But web enablement is costly and the UI for the charts display is a bit clunky.

Google Data Studio is only an interface. It can use almost any type of datasource (sheet, sql, bigquery. Etc.). Same as PowerBI, but free… Adding a table to the WP DB and using it as DS should not be that complicated…
On server side, you have to implement a script that will create an endpoint for the http integration and write to the DB.

Well ‘free’, If it’s free this means that you are the product. :wink:

1 Like

Not really in this case. Datastudio integrates better with Google Cloud, so the strategy is probably to encourage users to migrate their data to Google Cloud. But if you really want to pay, there are plenty of solutions. Power BI in integrated mode is very powerfull.

Apart from the incredible vulnerability that comes with opening up your mySQL database to the outside world??

Billions of webservices connect to distant mysql databases each day. Each time that you are using a cloud database, you have to do that. There are many ways to secure a DB access, but of course, it requires some skills.

The main vulnerability is very often between the screen and the chair, with people who don’t really know what they are doing. The best solution to protect a website is to keep it on an internal network. Ok. But if you need to make it available to the world, you will secure it. There is absolutely no difference with a DB.

Last but not least: Wordpress itself is a security nightmare, because plugins are coded by people who have mostly very basic knowledge related to security. The funny thing is that you can make DB injection thru them :slight_smile:

A good start here: https://support.google.com/datastudio/answer/7088031?hl=en
With TLS, correct user/role policy, and IP restrictions, this is a good start.

1 Like