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 32.8k 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.
  • S samppa

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

    K Offline
    K Offline
    korttoma
    Hero Member
    wrote on last edited by
    #17

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

    • Tomas
    1 Reply Last reply
    0
    • K Offline
      K Offline
      korttoma
      Hero Member
      wrote on last edited by
      #18

      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?

      • Tomas
      D 1 Reply Last reply
      0
      • K korttoma

        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?

        D Offline
        D Offline
        Dwalt
        wrote on last edited by
        #19

        @korttoma

        My plots stopped last night as well, last data point transmitted was at 12:03am GMT, but not after a nightly heal.

        -Dwalt

        Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

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

          12 GMT is 2 in my timezone so I guess it was just a coincidence that it happened at the time of the heel. Maybe plot.ly blocked us for some reason.

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

            My graphs stopped as well. I have asked what is going on.. Let's see when it gets back up again..

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

              I sent them some feedback to but have not heard anything yet. Maybe we should try the "Streaming API" instead?

              • Tomas
              D S 2 Replies Last reply
              0
              • K korttoma

                I sent them some feedback to but have not heard anything yet. Maybe we should try the "Streaming API" instead?

                D Offline
                D Offline
                Dwalt
                wrote on last edited by Dwalt
                #23

                @korttoma

                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.

                Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

                1 Reply Last reply
                0
                • K korttoma

                  I sent them some feedback to but have not heard anything yet. Maybe we should try the "Streaming API" instead?

                  S Offline
                  S Offline
                  samppa
                  wrote on last edited by samppa
                  #24

                  @korttoma

                  Now plot.ly is back up again.
                  Apparently they upgraded the infrastructure and broke something. Hopefully that does not happen too often..

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

                    Yes, now it is working again. Maybe you should try again @Dwalt ?

                    • Tomas
                    D 1 Reply Last reply
                    0
                    • K korttoma

                      Yes, now it is working again. Maybe you should try again @Dwalt ?

                      D Offline
                      D Offline
                      Dwalt
                      wrote on last edited by
                      #26

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

                      Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

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

                        There was an outage again last night. No data uploaded for 3h. Was it just me or plot.ly?

                        • Tomas
                        D 1 Reply Last reply
                        0
                        • K korttoma

                          There was an outage again last night. No data uploaded for 3h. Was it just me or plot.ly?

                          D Offline
                          D Offline
                          Dwalt
                          wrote on last edited by
                          #28

                          @korttoma I got it too.

                          Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            derrij
                            wrote on last edited by
                            #29
                            This post is deleted!
                            1 Reply Last reply
                            0
                            • K Offline
                              K Offline
                              korttoma
                              Hero Member
                              wrote on last edited by
                              #30

                              Did plot.ly change something or did I brake my own ploting somehow? Anyone else having problems?

                              • Tomas
                              D 1 Reply Last reply
                              0
                              • K korttoma

                                Did plot.ly change something or did I brake my own ploting somehow? Anyone else having problems?

                                D Offline
                                D Offline
                                Dwalt
                                wrote on last edited by
                                #31

                                @korttoma

                                My plots are still working.

                                Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

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

                                  @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.
                                  • Tomas
                                  D 1 Reply Last reply
                                  0
                                  • K 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.
                                    D Offline
                                    D 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
                                    • K Offline
                                      K 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.

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

                                          D Offline
                                          D 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

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          15

                                          Online

                                          12.0k

                                          Users

                                          11.2k

                                          Topics

                                          113.4k

                                          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