No announcement yet.

Scripting Issue

  • Filter
  • Time
  • Show
Clear All
new posts

    Scripting Issue

    Hi, I'm using a script to record temperature values from both hai sensors & Weather XML into a database. It worked just fine for over a year. I was just reviewing the data and noticed that my temperatures are way off starting some months back.
    While my script line

    objRS("temperature") = hs.DeviceValue("w1") - does return a good value from the weather xml devices.

    objRS("haitemp") = hs.DeviceValue("'20") - returns values > 1000 i.e. "1078"
    All my HAI sensors are returning these values.

    The '20 device address is correct and the Homeseer - HAI zones status page is showing correct temp values.

    Like I say, it's been so long I can't remember if I changed something or not.

    Note to self, Save the old working script before changing.

    Last edited by Pnord; November 6, 2009, 09:07 AM.

    Since no one has posted a response, I am going to take a shot at helping you. I have done some database interfacing with Homeseer, and in general I run into trouble all the time until I get it just right. So here are some of my troubleshooting ideas.

    First, it is good that you check to see that the temp sensors are returning the right values. But I would go further to see if hs.DeviceValue(" '20 ") does return the right value, then set it to another variable and then write it to the database. I will bet the problem lies somewhere in the fact that you are using a '20 enstead of a K20 or something like that. Most databases use both the " and the ' for absolute data when making a query. So the database might be interpreting the ' as a delimiter for the erroneous data. I have seen some of my scripts stop working when they worked fine for a long time, but it just wasnt good programming technique, but worked anyway. Then they stop working because I use them in a different way. So, I say all this to say, if you still want to use the ' then do something in the script like:

    iTemp = hs.DeviceValue("'20")
    objRS("haitemp") = iTemp

    something like that. And use the hs.writelog function to help debug your script.

    Other than that, maybe someone can see exactly what is wrong for sure, but that is where I would start. Of course, I may be off base, but that is my 2 cents worth.
    A computer's attention span is as long
    as it's powercord.