Announcement

Collapse
No announcement yet.

help on simple script

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

    help on simple script

    I participate in a program called ohmhour. About 1/week (exact timing is unpredictable and always changes) I am incented to reduce the energy usage in my house. The more I reduce relative to my forecast (which is based on past usage at the same time of day), the more money I earn.

    I have set up a series of events in homeseer that lower the energy usage when one of these ohmhours occur (e.g., turn off thermostat, power down computer etc...) I am now looking to automate the execution of those events in a more seamless fashion.

    OhmConnect provides a unique url/website that you can go to to see when there will be an ohmhour.

    https://forum.ohmconnect.com/discussion/318/ohmhour-api

    https://login.ohmconnect.com/verify-ohm-hour/ERZ0lowy

    It looks to be some sort of xml feed or api (I'm not a programmer so have probably called this the wrong thing).

    This is what is on the website when I go to it.
    <ohmhour>
    <address>my address</address>
    <active>None</active>
    </ohmhour>

    The Active row has three states:
    None: No Ohmhour scheduled
    False: OhmHour is scheduled to happen soon
    True: OhmHour is happening now

    I want to create a virtual device in homeseer that mirrors these three states so that I can run my other events as these states change.

    Is there some type of script that will monitor this url and make changes to my homeseer virtual device as the 'active' line changes?

    #2
    You can use my DataScraper script for this.

    Download it from my site (click on my banner below) and install as per the instructions.

    Open up Jon00DataScraper.ini in a text editor and replace the entire [Grab1] section with the following:

    Code:
    [Grab1]
    Path=https://login.ohmconnect.com/verify-ohm-hour/ERZ0lowy
    TextFile=0
    Encoding=
    Username=
    Password=
    Options=
    UserAgent=
    Devicemode=2
    StripHTML=1
    Pattern1=<active>(.*?)</active>
    DeviceName1=OhmConnect
    DeviceText1=[0]
    DeviceValue1=[0] [Replace "True", "2"] [Replace "False", "1"] [Replace "None", "0"]
    Run the script as per the docs and a new virtual device will be created showing True, False or None

    The Device Value will be set to 2, 1 or 0 for triggering if necessary

    Run the script on a recurring basis to ensure that the site is checked to update the device.
    Jon

    Comment


      #3
      I've followed your instructions.

      I've run the script a number of times. A virtual device was created in homeseer. The status says "None". Shouldn't the status be "0" based on the script or am I misunderstanding what the [Replace "None", "0"] in last line does.
      Attached Files

      Comment


        #4
        The last line adjusts the device value not the device text. If you want the device text to follow suit then change:

        DeviceText1=[0]

        To:

        DeviceText1=[0] [Replace "True", "2"] [Replace "False", "1"] [Replace "None", "0"]
        Jon

        Comment


          #5
          Thanks for your help. Looks to be working as I'd like it to.

          Comment

          Working...
          X