Announcement

Collapse
No announcement yet.

Creating Graphs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Creating Graphs

    I have found a site which allows you to post sensor data from HS3 to the site and automatically create graphs.

    The site is www.initialstate.com

    Once you create an account, create a 'bucket' manually on the web site, get your Keys then, making use of it's REST API, publish the data using an Event to run an immediate script - for example:

    &hs.URLAction "https://groker.initialstate.com/api/events?accessKey=YourAccessKey&bucketKey=YourBucketKey","POS T","Lounge="&HS.DeviceValueEx(160),""

    This publishes my Lounge temperature in the graph attached. Publish another to the same bucket replacing Lounge with another room and the appropriate Device ID

    You can stack graphs - in my case, I have the main room temps & outside temp against the Light levels - this way I can see how quickly the rooms heat up or cool down as the OAT changes.

    I must thank Paul Ockenden for publishing details of this site in PCPro (UK)

    Hope someone find this useful

    Cheers
    Scott
    Attached Files

    #2
    Thanks for posting this... I have been trying to come up with a good way to do graphing. I have my data stored in a SQL database already, but was struggling with getting it to look right (my fault as I am not a coder), and I am currently using device history plugin, which works, but is limited in it's abilities to make the graph the way I want.

    Comment


      #3
      Originally posted by waynehead99 View Post
      Thanks for posting this... I have been trying to come up with a good way to do graphing. I have my data stored in a SQL database already, but was struggling with getting it to look right (my fault as I am not a coder), and I am currently using device history plugin, which works, but is limited in it's abilities to make the graph the way I want.
      It took me about 30 minutes in total to setup the account and bucket and play with the URLAction command until I got it working, so since I've given a working URL format, you should get something up & running in no time!

      Note that the free version keeps data for 24H but that might be long enough to get a feel for whats going on. I have signed up for the standard account so I can see how it changes of the months.

      Good luck
      Scott

      Comment


        #4
        Are these suitable for HSTouch? Meaning, can you take the graph and save it as an image to show on a HSTouch client?
        HS4Pro on a Raspberry Pi4
        54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
        Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

        HSTouch Clients: 1 Android

        Comment


          #5
          Originally posted by rmasonjr View Post
          Are these suitable for HSTouch? Meaning, can you take the graph and save it as an image to show on a HSTouch client?
          Not sure - It is just a web page but looks like you may need to navigate to the required display. Once you get there it should be fine....

          Comment


            #6
            Hello,

            i'm in France, so i use comma for separate my decimals data (temp_pool = 21,5)

            i create an event to send my temp pool to Initialstate, i see my data in save data, but nothing in lines .

            I think i must replace comma by dot.

            How i do this? Write an external script for each device?

            Can you help me

            Thanks

            Jean-Francois.

            Comment


              #7
              Originally posted by jfla View Post
              Hello,

              i'm in France, so i use comma for separate my decimals data (temp_pool = 21,5)

              i create an event to send my temp pool to Initialstate, i see my data in save data, but nothing in lines .

              I think i must replace comma by dot.

              How i do this? Write an external script for each device?

              Can you help me

              Thanks

              Jean-Francois.
              Hi jean-Francois

              I don't know, but I would think you might need a script with a replace() method

              Does it look right in the data screen?

              It might be an idea to send an email to InitialStates support

              Scott

              Comment


                #8
                hi,
                i opened a ticket to IntialState

                Thanks

                Comment


                  #9
                  Originally posted by jfla View Post
                  hi,
                  i opened a ticket to IntialState

                  Thanks
                  Good. Be sure to post the solution for others.

                  Scott

                  Comment


                    #10
                    I write a script to replace Comma by Dot and put data to InitialState

                    I want to paste the device name to script for updating my bucket with device name AND value of device

                    Sub Main(Parm As Object)
                    Dim DvName As String
                    Dim Dvvalue
                    DvName = Parm
                    Log("Name device " & DvName)
                    Dvvalue = hs.DeviceValueByNameEx(Parm)
                    Log("Valeur device " & Dvvalue)
                    Dvvalue = Replace(Dvvalue,",",".")
                    Log("Valeur device " & Dvvalue)
                    hs.URLAction ("https://groker.initialstate.com/api/events?accessKey=MyKey&bucketKey=MyKey","POST",&DvName=&Dvvalue,"")
                    End Sub

                    Sub Log(ByVal ParStr As String)
                    hs.WriteLog("test", ParStr)
                    End Sub
                    I get an error when i run the line with hs.URLAction (Variable DvName do this error)

                    If i put the device name in hs.URLAction ("https://groker.initialstate.com/api/events?accessKey=MyKey&bucketKey=MyKey","POST","Piscine_Temp="&Dvvalue,"")

                    It's OK

                    Can you help me

                    Thanks.
                    Jean-Francois.
                    Last edited by jfla; July 18, 2016, 10:59 AM.

                    Comment


                      #11
                      Hello,

                      i find the right command to send device name as parameter

                      Sub Main(ByVal Parm As Object)
                      Dim DvName As String
                      Dim Dvvalue
                      DvName = (Parm & "=")
                      Log("Name device " & DvName)

                      Dvvalue = hs.DeviceValueByNameEx(Parm)
                      Log("Valeur device " & Dvvalue)
                      Dvvalue = Replace(Dvvalue,",",".")
                      Log("Valeur device " & Dvvalue)
                      hs.URLAction ("https://groker.initialstate.com/api/events?accessKey=MyKey&bucketKey=MyKey","POST",DvName &Dvvalue,"")
                      End Sub

                      Sub Log(ByVal ParStr As String)
                      hs.WriteLog("test", ParStr)
                      End Sub
                      Now it's OK

                      Jean-Francois

                      Comment


                        #12
                        I haven't tested this out yet, but shouldn't you probably remove the image of your accessKey and bucketKey from this post?

                        Originally posted by jfla View Post
                        I write a script to replace Comma by Dot and put data to InitialState

                        I want to paste the device name to script for updating my bucket with device name AND value of device



                        I get an error when i run the line with hs.URLAction (Variable DvName do this error)



                        If i put the device name in hs.URLAction ("https://groker.initialstate.com/api/events?accessKey=MyKey&bucketKey=MyKey","POST","Piscine_Temp="&Dvvalue,"")

                        It's OK

                        Can you help me

                        Thanks.
                        Jean-Francois.

                        Comment


                          #13
                          No problem, it's an old bucket and removed from InitialState

                          Jean-francois.

                          Comment


                            #14
                            @ScottRennie

                            I run my script when a device value change

                            I have several events with same script and i paste into variable the device name and the value of device

                            Jean-Francois
                            Attached Files

                            Comment


                              #15
                              Jean-Francois,

                              I've been using this for a while now... Have you had any issues with HS3 getting "stuck" where it can't connect to the InitialState site to post the data? I'm running HS3 at two separate locations - one loses connectivity every few hours (sometimes needing a reboot to continue), the other tends to last a few days, and usually recovers by itself after the Post Timeouts start.

                              I'm thinking it has something to do with InitialState changing their IP address on a frequent basis, and something funky with DNS lookup on my end...

                              Comment

                              Working...
                              X