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.6k 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 korttoma

    @Dwalt would you mind charing your lua? Remember to remove your username and api key ;)

    Here is a nexample of what I'm using and it stoped working on 9th of this month.

    local OutTemp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 229)
    local TankTopp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 174)
    local TankMitten = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 179)
    local TankBotten = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 175)
    local Solpanel = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 28)
    local Solpump = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", 212) * 50
    local CirkPump = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "Watts", 98)
    
    
    local ts = os.date("%Y-%m-%d %X")
    
    local http = require("socket.http")
    http.TIMEOUT = 8
    result, status = http.request("https://plot.ly/clientresp", 'un=useruser&key=keykeyszx&origin=plot&platform=lisp&args=[{"x":["'..ts..'"],"y":['..OutTemp..'],"name":"Ute Temp"},{"x":["'..ts..'"],"y":['..TankTopp..'],"name":"Tank Topp"},{"x":["'..ts..'"],"y":['..TankMitten..'],"name":"Tank Mitten"},{"x":["'..ts..'"],"y":['..TankBotten..'],"name":"Tank Botten"},{"x":["'..ts..'"],"y":['..Solpanel..'],"name":"Solpanel Temp"},{"x":["'..ts..'"],"y":['..Solpump..'],"name":"Sol Pump"},{"x":["'..ts..'"],"y":['..CirkPump..'],"name":"Cirkulationspump"}]&kwargs={"filename":"Varme","fileopt":"extend","style":{"type":"scatter"},"traces":[0,1,2,3,4,5,6],"layout":{"title":"Värme Systemet"},"world_readable":false}')```
    
    I get 2 values correct to the graph but after this it somehow screws up the time axis of the graph.
    DwaltD Offline
    DwaltD Offline
    Dwalt
    wrote on last edited by Dwalt
    #33

    @korttoma

    Here is my code.

    This only tracks light level from one sensor. I did have a data outage that lasted 3 days last month (5/24 - 5/27) and I did not notice it at the time so I am unable to determine exact cause. It resumed plotting after 3 days and I assume the error was on plotly's side. Plotly had some 'offline' issues last year as well.

    local Light_level = luup.variable_get("urn:micasaverde-com:serviceId:LightSensor1", "CurrentLevel", 47)
    local http = require("socket.http")
    http.TIMEOUT = 5
    local ts = os.date("%Y-%m-%d %X")
    result, status = http.request("https://plot.ly/clientresp",'un=XXXXX&key=XXXXX&origin=plot&platform=lisp&args=[{"x":["'..ts..'"],"y":['..Light_level..']}]&kwargs={"filename":"MHLux","fileopt":"extend","style":{"type":"scatter"},"traces":[0],"layout":{"title":"MHLux_Test"},"world_readable":false}')```

    Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

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

      Bingo. You only have one data source. That I can get to work also. I had over 10 different data in one graph and it was working fine but it is not anymore.

      • Tomas
      1 Reply Last reply
      0
      • 5546dug5 Offline
        5546dug5 Offline
        5546dug
        wrote on last edited by
        #35

        @samppa just wondering what the numbers at the end of the luup code refers to is 83. 347 etc?
        I am reading and what to try to graph my temp/hum.

        DwaltD 1 Reply Last reply
        0
        • 5546dug5 5546dug

          @samppa just wondering what the numbers at the end of the luup code refers to is 83. 347 etc?
          I am reading and what to try to graph my temp/hum.

          DwaltD Offline
          DwaltD Offline
          Dwalt
          wrote on last edited by
          #36

          @5546dug

          The numbers are the device id numbers within Vera. They tell the 'Get' command exactly which sensors/devices to pull the data from. They can be found under the 'Advanced' tab under each devices' 'settings'.

          Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

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

            I gave up on plot.ly. I can no longer send many data to one graph using their API so I started looking in to ThingSpeak.com that @Dwalt mentioned. I seems like you can use plugins to create graphs with multiple series, seems to work nicely.

            • Tomas
            BulldogLowellB NeverDieN 2 Replies Last reply
            0
            • korttomaK korttoma

              I gave up on plot.ly. I can no longer send many data to one graph using their API so I started looking in to ThingSpeak.com that @Dwalt mentioned. I seems like you can use plugins to create graphs with multiple series, seems to work nicely.

              BulldogLowellB Offline
              BulldogLowellB Offline
              BulldogLowell
              Contest Winner
              wrote on last edited by
              #38

              @korttoma

              maybe try the new Maker channel on IFTTT and send data to google spreadsheet.

              then just feed your plotting software (or excel) from the data on your google drive.

              1 Reply Last reply
              0
              • korttomaK korttoma

                I gave up on plot.ly. I can no longer send many data to one graph using their API so I started looking in to ThingSpeak.com that @Dwalt mentioned. I seems like you can use plugins to create graphs with multiple series, seems to work nicely.

                NeverDieN Offline
                NeverDieN Offline
                NeverDie
                Hero Member
                wrote on last edited by
                #39

                @korttoma said:

                I gave up on plot.ly. I can no longer send many data to one graph using their API so I started looking in to ThingSpeak.com that @Dwalt mentioned. I seems like you can use plugins to create graphs with multiple series, seems to work nicely.

                Did you get it to work?

                korttomaK 1 Reply Last reply
                0
                • NeverDieN NeverDie

                  @korttoma said:

                  I gave up on plot.ly. I can no longer send many data to one graph using their API so I started looking in to ThingSpeak.com that @Dwalt mentioned. I seems like you can use plugins to create graphs with multiple series, seems to work nicely.

                  Did you get it to work?

                  korttomaK Offline
                  korttomaK Offline
                  korttoma
                  Hero Member
                  wrote on last edited by
                  #40

                  @NeverDie ThingSpeak is workin but not plot.ly

                  • Tomas
                  1 Reply Last reply
                  0
                  • NeverDieN Offline
                    NeverDieN Offline
                    NeverDie
                    Hero Member
                    wrote on last edited by
                    #41

                    Here Plot.Ly has been working:
                    https://plot.ly/~WhiteRabbit/997

                    About 6 months or so ago it seemed to stop plotting, and it wouldn't resume even if I rebooted the Arduino. So, I requested all new stream tokens, plugged those into the Arduino program, rebooted, and it has been working since. What I like about Plot.ly is that I can both pan and zoom the data.

                    I'm presently driving Plot.ly using just the Arduino API. I get the impression I'd have finer grained control if I were to drive it using Python instead.

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

                      @NeverDie Thanks for posting, I created a new API key and deleted my old plot and so far so good, it is working again.
                      Like you I also prefer the UI and plots produced by plot.ly but I'm not convinced by the reliability so far.

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

                        Hi Guys

                        How much work is it in Plot.ly to get in to work

                        Becuase i test to Copy the examples upper here and put my INFO in the text
                        But nothing happens, Must i change a lot of thing on the Plot.ly page

                        1 Reply Last reply
                        0
                        • korttomaK korttoma

                          @NeverDie Thanks for posting, I created a new API key and deleted my old plot and so far so good, it is working again.
                          Like you I also prefer the UI and plots produced by plot.ly but I'm not convinced by the reliability so far.

                          NeverDieN Offline
                          NeverDieN Offline
                          NeverDie
                          Hero Member
                          wrote on last edited by
                          #44

                          @korttoma said:

                          @NeverDie Thanks for posting, I created a new API key and deleted my old plot and so far so good, it is working again.
                          Like you I also prefer the UI and plots produced by plot.ly but I'm not convinced by the reliability so far.

                          I share your concern. It has been a bumpy ride. If it weren't for the pan and zoom UI, I would have tried switching to another free service.

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

                            Any one that can explain for me how to get plot.ly to work, I really don't get it :(

                            1 Reply Last reply
                            0
                            • 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
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          16

                                          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