Announcement

Collapse
No announcement yet.

Peculiar Problem With "Do not update device last change time if .." Device Setting

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

    Peculiar Problem With "Do not update device last change time if .." Device Setting

    I have a device( GIG thermostat) where the Temperature Child Device is used in an Event Condition ("has been 70 degrees for at least 30 minutes").

    If the Temperature Child Devices Configuration Page "Do not update device last change time if device value does not change:" is UNCHECKED the condition is never met, even when the Temperature Devices value does not change for hours. If the "Do not update device last change time if device value does not change:" is CHECKED the Event Condition works as expected.

    What appears to be happening is the physical thermostat is "setting" the value in HS every 5 minutes even when it DOES NOT CHANGE! And the Event Condition depends on the "Do not update device last change time if device value does not change:" being CHECKED.

    I did not expect this dependence. Is it normal?

    If this is normal I need to be able to CHECK "Do not update device last change time if device value does not change:" programmatically and periodically and I don't see a scripting instruction that will do that. Help.​

    #2
    Originally posted by BobSpen View Post
    I have a device( GIG thermostat) where the Temperature Child Device is used in an Event Condition ("has been 70 degrees for at least 30 minutes").

    If the Temperature Child Devices Configuration Page "Do not update device last change time if device value does not change:" is UNCHECKED the condition is never met, even when the Temperature Devices value does not change for hours. If the "Do not update device last change time if device value does not change:" is CHECKED the Event Condition works as expected.

    What appears to be happening is the physical thermostat is "setting" the value in HS every 5 minutes even when it DOES NOT CHANGE! And the Event Condition depends on the "Do not update device last change time if device value does not change:" being CHECKED.

    I did not expect this dependence. Is it normal?

    If this is normal I need to be able to CHECK "Do not update device last change time if device value does not change:" programmatically and periodically and I don't see a scripting instruction that will do that. Help.​
    Yes, that is normal and exactly why that tick box was added. Generally devices should default to that checked when created. The " for at least" Trigger or Condition looks to the device timestamp to know how long it has been at a value.

    It is on the Bulk Action menu

    Click image for larger version  Name:	capture.png Views:	0 Size:	217.6 KB ID:	1576419
    HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

    Comment


      #3
      Randy,
      Thanks for the confirmation. I'm still on HS3. Also looking for a programmatic method to "check" the box.
      I don't seem to be able to remember this issue over many years and get caught by it(event does not run) and spend a few days tracking down the issue(after inadvertently unchecking the box). If it can be done I would like to set up an event that runs periodically and forces things like this into a proper state!

      Comment


        #4
        Here is a script that turns it off for everything:

        Code:
        sub Main(ByVal Parm As Object)
        
            Try
                'run through the enumerator, remove the location two strings
        
                Dim dv As Scheduler.Classes.DeviceClass
                Dim EN As Scheduler.Classes.clsDeviceEnumeration
        
                EN = hs.GetDeviceEnumerator
        
                Do
                    dv = EN.GetNext
                    'If dv Is Nothing Then Continue Do
        
                    'If dv.Interface(Nothing).ToLower = "arduino plugin" Then
                        hs.writelog("Update Stop", "Device: " & dv.Name(Nothing))
                        dv.MISC_Set(hs, Enums.dvMISC.SET_DOES_NOT_CHANGE_LAST_CHANGE)
                        System.Threading.Thread.Sleep(50)
                    'End If
        
                Loop Until EN.Finished
        
            Catch ex As Exception : hs.writelog("Device Clear", "Exception: " & ex.message)
            End Try
        
        End Sub​​
        And one for just Z-Wave:

        Code:
        sub Main(ByVal Parm As Object)
        
        Try
        'run through the enumerator, remove the location two strings
        
        Dim dv As Scheduler.Classes.DeviceClass
        Dim EN As Scheduler.Classes.clsDeviceEnumeration
        
        EN = hs.GetDeviceEnumerator
        
        Do
        dv = EN.GetNext
        If dv Is Nothing Then Continue Do
        
        If dv.Interface(Nothing).ToLower = "z-wave" Then
        hs.writelog("Update ZDev Stop", "Device: " & dv.Name(Nothing))
        dv.MISC_Set(hs, Enums.dvMISC.SET_DOES_NOT_CHANGE_LAST_CHANGE)
        System.Threading.Thread.Sleep(50)
        End If
        
        Loop Until EN.Finished
        
        Catch ex As Exception : hs.writelog("Device Clear", "Exception: " & ex.message)
        End Try
        
        End Sub​
        If you want to uncheck the box this command changes from "dv.MISC_Set" to "dv.MISC_Clear".

        Code:
        dv.MISC_Clear(hs, Enums.dvMISC.SET_DOES_NOT_CHANGE_LAST_CHANGE)
        to
        HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

        Comment


          #5
          Randy,
          Thank you for that. Question from a scripting novice: If I only want to change one device, what does the code look like?

          Comment


            #6
            Originally posted by BobSpen View Post
            Randy,
            Thank you for that. Question from a scripting novice: If I only want to change one device, what does the code look like?
            I'm not proficient at all.

            The command is "dv.MISC_Set(hs, Enums.dvMISC.SET_DOES_NOT_CHANGE_LAST_CHANGE)". You would want to call up that device and issue this command. Perhaps one of the folks who can actually write a script can weigh in.
            HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

            Comment


              #7
              This should get you started
              Code:
                  Sub Main(p As String)
              
                      Dim dvRef As Integer = CInt(p)
              
                      Dim dv As Scheduler.Classes.DeviceClass = hs.GetDeviceByRef(dvRef)
              
                      If dv IsNot Nothing Then dv.MISC_Set(hs, Enums.dvMISC.SET_DOES_NOT_CHANGE_LAST_CHANGE)
              
                  End Sub
              Paste the above into an event script action. Enter the device reference number into the script action 'Parameters' field and run the event.

              Comment


                #8
                Thanks zwolfpack, I will give it a shot in the next few days.

                Comment


                  #9
                  Originally posted by BobSpen View Post
                  Thanks zwolfpack, I will give it a shot in the next few days.
                  It works, thanks again.

                  Comment

                  Working...
                  X