Plotting graphs with plot.ly service with luup scene using REST API
-
@Hoffan no you should not need to change anything at plot.ly your graph should just appear among "YOUR RECENT FILES" on the right when you go to "https://plot.ly/".
-
-
It seems that plot.ly has new limitations to the free API in their price plan:
- Only one free private graph
- API rate limits: 50 per day or 30 per hour
Then you have to pay 20 USD/month to get unlimited access.
Damn. There goes the cheap solution. -
I converted my code to use ThingSpeak.
It is even simpler to call since the formatting is done on the website. Here is how I use it:local url = "https://api.thingspeak.com/update?api_key=_YOUR_KEY_HERE_" result, status = http.request(url,'field1='..HotWaterTemp..'&field2='..HotWaterPump..'&field3='..HotWaterLimit..'&field4='..PumpTime)On the https://thingspeak.com website you just define the "channel" that receives all the data and copy the example "plugin" and modify it to render your graph.
Quite easy. And free at least so far.. -
I converted some to ThingSpeak now also but I could not get it to work using your example @samppa ,don't know why but this works for me:
local http = require("socket.http") result, status = http.request("http://api.thingspeak.com/update?key=<API_KEY>&field1="..TankTopp.."&field2="..TankMitten.."&field3="..TankBotten.."&field4="..StatTemp.."&field5="..StatMode.."&field6="..Solpanel.."&field7="..Solpump.."&field8="..CirkPump.."", "run=run")``` -
Like others, I've (regrettably) given up on plot.ly, and gone over to ThingSpeak.
I'm using the following Python code to send values from Domoticz:
thingURL = 'https://api.thingspeak.com/update?api_key=_YOUR_KEY_HERE' url = thingURL + "&field1=%s&field2=%s&field3=%s&field4=%s&field5=%s" \ % (inside, target, outside, lounge, heating) f = urllib2.urlopen(url) f.close() -
I converted some to ThingSpeak now also but I could not get it to work using your example @samppa ,don't know why but this works for me:
local http = require("socket.http") result, status = http.request("http://api.thingspeak.com/update?key=<API_KEY>&field1="..TankTopp.."&field2="..TankMitten.."&field3="..TankBotten.."&field4="..StatTemp.."&field5="..StatMode.."&field6="..Solpanel.."&field7="..Solpump.."&field8="..CirkPump.."", "run=run")```@korttoma The only difference I see is that you put the entire url with parameters in the first argument of the http.request call and "run=run" as the second (don't know why you have that?). I use the base url as the first argument and the field list as the second
r, s = http.request(baseUrl, "field1=XX&field2=XX")Hope that fixes the issue.
Also You have to setup the "Channel" and "Plugin" in the website accordingly and name the fields there.