Create a Datadashboard for your events with Freeboard.

Do you have questions about writing plugins or scripts in Python? Meet the coders here.

Create a Datadashboard for your events with Freeboard.

Postby conrad » Sun Sep 25, 2016 1:04 pm

Here is an example of how to create a Datadashboard for your events in Eventghost, for free.
It will show you how to make a temperature gauge, and diplay it on the Dashboard, from then it is up to you how far you will take it.
You can have an unlimited number of dashboards.
Everyting is free, except Historical Chart, where you have to pay and pay.
Your free Dashboard can not be private.
I am showing event for Outdoortemperature, since most have that in one way or another in Eventghost.

In Eventghost:

1. Copy this code into a script and place it in your makro where your Outdoortemperature is.

Code: Select all
import json
import requests

# Split event to get only numbers. eg.outdoortemperature is the incoming payload in this example.

b = str(eg.outdoortemperature.split('C')[0])

# Replace, if neccesarry  ","  with  "."  since Freeboard dont accept  ","  in decimals, in this pane. (Gauge)

f = b.replace(',', '.', 1)

# Print the value to see if it is ok.

print f

# Send the value to Freeboard via Dweet, note that the f variable is not enclosed in quotes, else it would not be an variable.

url = "https://dweet.io/dweet/for/Outdoortemperature"
data = {'Value':f}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(data), headers=headers)






In Freeboard:

1. Make an account on Freeboard.io
2. Go to Datasources and ADD
3. Choose TYPE:Dweet.io
4. Make a unike NAME:Temperature, and THING NAME:Outdoortemperature
5. Nothing in KEY
6. NO to show full Payload
7. Save

8. Go to + ADD PANE
9. Choose the + sign in the pane that arrives.
10. Select Gauge under TYPE in WIDGET.
11. Give it Title: Outdoortemp
12. Choose +Datasources and add the values that arrives, until it looks like:
datasources["Temperature"]["Value"]
13. Type your Unit, C or F
14. Type -20 in minimum
15. Type 50 in maximum


In Dweet.io

Here you can test different thing names and contents, it wil reply with ok, not ok, and give you an url.
It is this url you see in the script :url = "https://dweet.io/dweet/for/Outdoortemperature"
After some time, when you are more familiar with the creation process, you will be able to change the
url directly in the script and in Freeboard.

1. Go to PLAY
2. Go to dweets
3. Go to POST
In here you can experiment with your thing, the uniqe name, you dont have to use any key. (You have to pay for keys)
4. Under content an example of what to place there: {"Value":"f"}
5. Try it out, and it should reply with an ok, if not check your content.

Thanks to Freeboard for this free Dashboard, and Dweet for passing data for free.

Freeboard example.jpg
Example Freeboard Datadashboard
conrad
 
Posts: 2
Joined: Thu Jul 23, 2015 3:23 pm

Return to Coding Corner

Who is online

Users browsing this forum: No registered users and 1 guest