Announcement

Collapse
No announcement yet.

Averaging Temperature Devices

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

    #16
    Originally posted by ewkearns View Post
    Though not the OP, thanks a million, Sooty... this worked great, with one very minor issue....


    I don't seem to have the icon that you used. Should I?
    That's one of my own icons. You can select any icons you like. Some folks prefer to have different icons for different value ranges which you can configure in the status / graphics as required.

    Paul..

    Comment


      #17
      Thanks!
      HomeSeer Version: HS4 Pro Edition 4.2.19.0 (Windows - Running as a Service)
      Home Assistant 2024.3
      Operating System: Microsoft Windows 11 Pro - Desktop
      Z-Wave Devices via two Z-Net G3s
      Zigbee Devices via RaspBee on RPi 3b+
      WiFi Devices via Internal Router.

      Enabled Plug-Ins
      AK GoogleCalendar 4.0.4.16,AK HomeAssistant 4.0.1.23,AK SmartDevice 4.0.5.1,AK Weather 4.0.5.181,AmbientWeather 3.0.1.9,Big6 3.44.0.0,BLBackup 2.0.64.0,BLGData 3.0.55.0,BLLock 3.0.39.0,BLUPS 2.0.26.0,Device History 4.5.1.1,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,HSBuddy 4.51.303.0,JowiHue 4.1.4.0,LG ThinQ 4.0.26.0,ONVIF Events 1.0.0.5,SDJ-Health 3.1.1.9,TPLinkSmartHome4 2022.12.30.0,UltraCID3 3.0.6681.34300,Z-Wave 4.1.3.0

      Comment


        #18
        This does not seem to work. I have the VD setup like Sooty's. I guess i'll try sooty's code.
        Code:
        SetDeviceValue&hs.SetDeviceValueByRef(1146,(hs.DeviceValue(1016)+hs.Device Value(1037)+hs.DeviceValue(1096))/3,true)
        Wait, I don't know how to run scripts. I paste the code in a text file and file it in the scripts directory?

        Comment


          #19
          Success!

          Comment


            #20
            Thanks everyone for the help! It would be nice to figure out why that one line code wouldn't work. I'm kind of a minimalist. ;-)
            And now I know how to load scripts, so i'm more dangerous than I was yesterday.

            Comment


              #21
              Originally posted by tome10 View Post
              Thanks everyone for the help! It would be nice to figure out why that one line code wouldn't work. I'm kind of a minimalist. ;-)
              And now I know how to load scripts, so i'm more dangerous than I was yesterday.
              Sticking the code on one line might look interesting, but it's a bugger to find bugs and typos - better to make it longer and clearer with some remarks. You will come back to the code on a single line with multiple brackets to update, improve or fix, and you won't have a scooby what the code is doing until to split it up again - trust me, I have been that soldier!

              Scott

              Comment


                #22
                Originally posted by tome10 View Post
                This does not seem to work. I have the VD setup like Sooty's. I guess i'll try sooty's code.
                Code:
                SetDeviceValue&hs.SetDeviceValueByRef(1146,(hs.DeviceValue(1016)+hs.Device Value(1037)+hs.DeviceValue(1096))/3,true)
                If that is the exact code you were trying to run then there are some errors in it. Assuming the device refs are right for your system, if you go to Tools>Control Panel and drop the below code into the Immediate Script Command box does it work?

                Code:
                hs.SetDeviceValueByRef(1146, (hs.DeviceValueEx(1016) + hs.DeviceValueEx(1037) + hs.DeviceValueEx(1096)) / 3, True)
                As Scott says, it can be more difficult to debug 1-liners and it's more difficult to add error checking.
                If one of the device refs in the above 1-liner were to be deleted from HS3, then it would simply fail where as the code I posted will write a "missing device" error message to the log and simply ignore the missing device in the calculation.

                Paul..

                Comment

                Working...
                X