I have a script which retrieves the setpoints from my TRV's. It works fine, but when I turn off the TRV's (Mode changes from heat to OFF, in another device), the TRV setpoint doesn't change. In my display it still displays the setpoint, but I would like that to display OFF, and if it is set to heat just display the setpoints as is now.
So to recap, if the thermostat mode is heat, display the setpoint as it is now, but if the mode is OFF, display OFF instead of the setpoint
This is the code I use currently
somehow I need to create a second array which reads "Kitchen TRV mode", etc... then says If mode = OFF... but not sure how I can do that in the for each devw as string in array_trvs if I can put another array below
the first screenshot is my setpoint display (which this script writes too, the second is how my TYRV devices are set up
.
So to recap, if the thermostat mode is heat, display the setpoint as it is now, but if the mode is OFF, display OFF instead of the setpoint
This is the code I use currently
Code:
dim array_trvs() as string = {"Heating","Guest Bed TRV","Study TRV","Lounge TRV","Kitchen TRV","Gym TRV"} dim trvsetpoint as integer = 0 dim trvs_name as string = "" dim trvstr as string = "" sub Main(ByVal Parms as Object) Try trvs_name = "" trvstr = "" for each devw as string in array_trvs trvs_name = devw trvsetpoint = hs.DeviceValueByName(devw) If trvsetpoint >20 trvstr = trvstr & trvs_name & " Setpoint " & " <span style='color:red'>" & trvsetpoint & " °C" & "</span>" & "<br>" Else trvstr = trvstr & trvs_name & " Setpoint " & " <span style='color:blue'>" & trvsetpoint & " °C" & "</span>" & "<br>" End If next hs.SetDeviceString(440, trvstr,true) 'hs.writelog("Array", "Window Count: " & windows_count) Catch ex As Exception hs.WriteLog ("Array", "Error: " & ex.Message) End Try End Sub
the first screenshot is my setpoint display (which this script writes too, the second is how my TYRV devices are set up
.