Plotting graphs with plot.ly service with luup scene using REST API
-
Had a chat with @BulldogLowell and he taught me that you can hover the mouse on a variable to check the complete variable name so it turned out I had to use the following:
luup.variable_get("urn:micasaverde-com:serviceId:SwitchPower1", "Status", 356) -
@Nuubi said:
Uh...oh...still.. do you need to initialize the graph or what? Still not getting this to work, sorry for being such a dummie :-E
You just send the data and the graph named with "filename":"xxxx" gets created if not yet existing.
-
@samppa Yep, works now, thanks!
The problem turned out to be the actual value I wanted to send. Need to figure out how to read MySensors based values in LUA...have you tried luup.inet.wget( )
local brightness = luup.variable_get("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", 118) luup.inet.wget("192.168.1.50//?brightLevel="..brightness.."&", 1) -
Anyone figured out a way to add another variable to an old graph without deleting the file from plot.ly? Seems like it does not include the new variable unless you delete and create a new file.
@korttoma said:
Anyone figured out a way to add another variable to an old graph without deleting the file from plot.ly? Seems like it does not include the new variable unless you delete and create a new file.
I have noticed the same thing; If you want to add a trace you need to delete the file..
So perhaps it is wise to be prepared and add a few extra traces for some future use. -
@korttoma said:
Anyone figured out a way to add another variable to an old graph without deleting the file from plot.ly? Seems like it does not include the new variable unless you delete and create a new file.
I have noticed the same thing; If you want to add a trace you need to delete the file..
So perhaps it is wise to be prepared and add a few extra traces for some future use.@samppa said:
perhaps it is wise to be prepared and add a few extra traces for some future use.
Good suggestion for a workaround but it does not seem to pick up name changes for the trace either. Tried also to edit one of the plots on the website but when I wanted to save I could not save the changes to the file used by "Vera". I had to save the file with a different name so no editing seems to be possible.
-
Since the nightly heal at 2 in the morning no data is transferred to plot.ly any more :( anyone else see this and know how to solv it?
-
I sent them some feedback to but have not heard anything yet. Maybe we should try the "Streaming API" instead?
-
I sent them some feedback to but have not heard anything yet. Maybe we should try the "Streaming API" instead?
I tried to set up a new graph using the REST API and could not get it to register with Plot.ly. Without any explanation from Plot.ly, I tried sending the same data streams to ThingSpeak.com and it set up with out any trouble. The API is slightly different but just as easy to use. I set up a scene to run every 15 minutes with the following code:
-- Get Light Levels local LR_LIGHT_LEVEL = luup.variable_get("urn:micasaverde-com:serviceId:LightSensor1", "CurrentLevel", 47) local BR_LIGHT_LEVEL = luup.variable_get("urn:micasaverde-com:serviceId:LightSensor1", "CurrentLevel", 55) - - Get Temps local LR_TEMP = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", 46) local BR_TEMP = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", 54) local OUT_TEMP = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", 23) -- Send data to ThingSpeak.com local http = require("socket.http") http.TIMEOUT = 5 result, status = http.request("http://api.thingspeak.com/update?key=Insert Your API Key here&field1="..LR_TEMP.."&field2="..BR_TEMP.."&field3="..OUT_TEMP.."&field4="..LR_LIGHT_LEVEL.."&field5="..BR_LIGHT_LEVEL.."", "run=run") ```` The service has a limited functionality to manipulate your data but the base configuration is easy to tweak and can be made public or private. See [here for my sample data](https://thingspeak.com/channels/25629). ...plus it is free to use. -
I sent them some feedback to but have not heard anything yet. Maybe we should try the "Streaming API" instead?
-
@korttoma
I noticed it back online right after I posted my Thingspeak scene. I had not deleted my Plot.ly scenes and they continued to send http requests during the outage and when Plot.ly came back online, my data resumed plotting.I have both services running right now plotting similar data and I will leave them both running to test reliability and quirks. It seems the time reporting drifts a little in Plot.ly. I am also going to test Beebotte.
-
There was an outage again last night. No data uploaded for 3h. Was it just me or plot.ly?
-
Did plot.ly change something or did I brake my own ploting somehow? Anyone else having problems?