No announcement yet.

Advice Please

  • Filter
  • Time
  • Show
Clear All
new posts

  • Advice Please

    I am having a small problem with a device in Ultra's WeatherBug. It seems that the Humidity string reports N/A % while the value is 55. So I want to move the value into the string. I created the variable (val) and used it in a script. I know very, very little about scripting.

    This does not work but I don't know why.
    hs.SetDeviceString ("#8", & val. TRUE)

    After a good laugh can someone give me an example of how you get a var into a string?

    Thank you.


  • #2
    hs.SetDeviceString("#8", hs.devicevalue("#8"), True)

    Should work, although sometimes depending on how the plugin is written might depend on how long that is going to last, if the plugin has a routine to update the device strings every minute then you would need to run that every minute. Finding out why it was caused would be better, you might have 55% as the value but could that be an old value?


    • #3
      Thank you.

      I received this error. Should I name it Humidity.vb?

      Running script, script run or compile error in file: Humidity1.txt1044:Cannot use parentheses when calling a Sub in line 19 More info: Exception from HRESULT: 0x800A0414



      • #4
        If you are going to use parens then it needs to be a .vb extension.


        • #5
          If you can then yes change it to a .vb file, if not try changing it to

          hs.SetDeviceString "#8", hs.devicevalue("#8"), True

          which should then work


          • #6
            Thank you both. I got it to work but the Humidity.gif icon is gone as well as the % symbol. Line now reads:

            hs.SetDeviceString"#8", hs.devicevalue("#8") &" %", True

            Now I would like to add the icon as I have the % issue resolved.

            Is it better to use the VB extension and if so why? Again thank you.

            It is HomeSeer that has kept me sane (More or less) through all the months of illness. I wish to thank the entire HomeSeer community for all the help and well wishes.



            • #7
              There is no real benefit in a script this small with using a .vb extension compared to a .txt extenstion, .vb files are and can use .net programming functions which can be very powerful.

              I was kind've expecting something similar with the icon going, your best idea is to bring up the icon on a normal device and right click, somewhere there will be an option to find the path of the file. Chances are it is going to be in a seperate director something like the "/images/icons/humidity.png". Once you find that file then set the device string like this;

              HTML Code:
              hs.SetDeviceString"#8", "<img src='/images/icons/humidity.png'>" & hs.devicevalue("#8") &" %", True


              • #8
                Thank you so much. Everything is great except the icon size is much bigger then the original. Also thank you for the lesson in scripting. Now I can do some small scripts using the info you provided. Great lesson.