Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. Plotting graphs with plot.ly service with luup scene using REST API

Plotting graphs with plot.ly service with luup scene using REST API

Scheduled Pinned Locked Moved My Project
plot.lygraphluupplot
56 Posts 10 Posters 27.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • korttomaK Offline
    korttomaK Offline
    korttoma
    Hero Member
    wrote on last edited by
    #46

    @Hoffan if you have an APIKey and username from plot.ly all you need to do is to change the following from the first post in this thread:

    ("urn:micasaverde-com:serviceId:HumiditySensor1", "CurrentLevel", 83) If you don't know what this should be let me know so I can explain further.

    <username>
    <APIKey>
    <nameForGraph>
    <graphTitle>

    You should make sure you remove all the < >

    Also I noticed that you can only have one private graph so if you already have one the second one will not get created.
    Try changing "world_readable":false to "world_readable":true

    Now test your lua code from apps -> develop apps -> test loop code (lua). Do you get any errors?

    • Tomas
    1 Reply Last reply
    0
    • HoffanH Offline
      HoffanH Offline
      Hoffan
      wrote on last edited by
      #47

      @korttoma

      So if i understand this right, If i have a User and a APIKey, i dont need to do
      anything on plot.ly page

      I will test to change false to True when i get back home tonight :)

      1 Reply Last reply
      0
      • korttomaK Offline
        korttomaK Offline
        korttoma
        Hero Member
        wrote on last edited by
        #48

        @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/".

        • Tomas
        1 Reply Last reply
        0
        • HoffanH Offline
          HoffanH Offline
          Hoffan
          wrote on last edited by
          #49

          @korttoma
          Big thanks. Now its working :)

          1 Reply Last reply
          1
          • S Offline
            S Offline
            samppa
            wrote on last edited by
            #50

            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.

            NuubiN 1 Reply Last reply
            0
            • S samppa

              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.

              NuubiN Offline
              NuubiN Offline
              Nuubi
              wrote on last edited by
              #51

              @samppa Yeah, one another, again. Personally, started with Pachube a few years ago. Gone, a long time ago.

              1 Reply Last reply
              0
              • korttomaK Offline
                korttomaK Offline
                korttoma
                Hero Member
                wrote on last edited by
                #52

                Thanks @samppa I was wondering why my plots were not working properly, this explains it.

                • Tomas
                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  samppa
                  wrote on last edited by
                  #53

                  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..

                  1 Reply Last reply
                  0
                  • korttomaK Offline
                    korttomaK Offline
                    korttoma
                    Hero Member
                    wrote on last edited by
                    #54

                    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")```
                    • Tomas
                    S 1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      MikeF
                      wrote on last edited by
                      #55

                      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()
                      
                      1 Reply Last reply
                      0
                      • korttomaK korttoma

                        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")```
                        S Offline
                        S Offline
                        samppa
                        wrote on last edited by
                        #56

                        @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.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        17

                        Online

                        11.7k

                        Users

                        11.2k

                        Topics

                        113.1k

                        Posts


                        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • MySensors
                        • OpenHardware.io
                        • Categories
                        • Recent
                        • Tags
                        • Popular