Announcement

Collapse
No announcement yet.

Feature Request: Make Energy Cost setting a device for input?

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

    Feature Request: Make Energy Cost setting a device for input?

    Hi!

    Is it possible to make a device to make it an option to alter the energi cost pr. kWh using a event?

    Energy cost change every hour, so my plan is an event like this:

    IF "Energy-cost-in-my-home"-device changes,THEN set Energy Cost Pr KWH to device "Energy-cost-in-my-home"-device. (In my case 574øre (5,74NOK/kWh) this hour.)


    I was hoping for better use of the Energy feature. I was hoping to register all devices with their energy consumption, and make a more valid estimate of actual energy cost, by the hour. Prices change from 0,03NOK to 8NOK in our area, so a fixed value will not do.


    Is this value in HS settings something I can change automatically as of now?

    Thanks.

    #2
    The energy settings are stored in settings.ini (config folder) under:

    [Settings]
    gEnergySizeMB=50
    gEnergyRatekwh=0.25

    Unfortunately, these values are only read when HomeSeer starts so changing these (using a single scripting command) on the fly will not work.

    You could restart HomeSeer every hour after a change but I don't think that is really practical.
    Jon

    Comment


      #3
      Thanks for your insight.

      I will not pursue this any further and look elsewhere for a solution then.


      Thanks!

      Comment


        #4
        That doesn't look to be the case.
        All the instances I found that use the rate pull the rate from the config file each time.
        Wade

        "I know nothing... nothing!"

        Comment


          #5
          Originally posted by Sgt. Shultz View Post
          That doesn't look to be the case.
          All the instances I found that use the rate pull the rate from the config file each time.
          The only method I checked was to change the ini file settings, wait and then go to to setup.... the initial values did not change. If it's reading in the background then great!
          Jon

          Comment


            #6
            Originally posted by jon00 View Post

            The only method I checked was to change the ini file settings, wait and then go to to setup.... the initial values did not change. If it's reading in the background then great!
            I followed your method and found it to be correct. (ugh).
            After clarifying with Rich, the functions do still call for the variable value to come from the config file, however now the config file is cached at startup so the function gets it from there instead now.
            It is supposed to detect changes in the ini and reload the values but I don't know the details of that as to it's reliability.
            Also, according to Rich, making changes to the setting.ini outside of HomeSeer is frowned on as well so that route is out.
            Having said that, it is possible to update the ini values through the API with a script which will update the file and the cache.
            Putting it all on a timer would allow for values to updated on a schedule.

            hs.SaveINISetting("Settings", "gEnergyRatekwh", "0.25", "Settings.ini")

            http://docs.homeseer.com/products/so...ware/scripting
            Wade

            "I know nothing... nothing!"

            Comment


              #7
              Using hs.SaveIniSetting was the method I was referring to in my first post. You infer using that would update the settings cache?

              I just tried it here and the settings under setup do not change.

              Also for completeness, it should be hs.SaveINISetting("Settings", "gEnergyRatekwh", "0.25", "settings.ini")

              (lower case settings.ini) for Linux users. That parameter is still case sensitive I have found.
              Jon

              Comment


                #8
                Soooo, a little bit a both...
                The hs.SaveINISetting("Settings", "gEnergyRatekwh", "0.25", "settings.ini") saves to the file and the cache, but not the global variable .
                We've agreed this is a bug and a bug report should be created (I will let you file and explain it.)
                Having said that, for this particular question, since the calls in question get the value from the cache, using the saveinisetting will work for him, but the settings page won't reflect the updated config file value unless you reboot.

                Wade

                "I know nothing... nothing!"

                Comment


                  #9
                  Originally posted by Sgt. Shultz View Post
                  Soooo, a little bit a both...
                  The hs.SaveINISetting("Settings", "gEnergyRatekwh", "0.25", "settings.ini") saves to the file and the cache, but not the global variable .
                  We've agreed this is a bug and a bug report should be created (I will let you file and explain it.)
                  Having said that, for this particular question, since the calls in question get the value from the cache, using the saveinisetting will work for him, but the settings page won't reflect the updated config file value unless you reboot.
                  Could you elaborate what you mean by Global Variable in this instance? The settings value on the setup page?
                  Jon

                  Comment


                    #10
                    Originally posted by jon00 View Post

                    Could you elaborate what you mean by Global Variable in this instance? The settings value on the setup page?
                    Yes, the energy rate value on the settings page is supplied by a global variable that is set at the same time the cached ini file is loaded. (on startup) I'm pretty sure the globals are there to replace the config cache (eventually), but there is still code that uses that config file cache that hasn't been changed yet (like the energy rate). The function that sets a value in the ini updates the cache, but not the global variable equivalent, even though it should(hence, the bug).
                    Wade

                    "I know nothing... nothing!"

                    Comment

                    Working...
                    X