Announcement

Collapse
No announcement yet.

Virtual thermostat?

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

  • Virtual thermostat?

    Does anybody know of a virtual thermostat plugin for HS3.

    I am missing a plugin to use a temperature and a output for heating control with settings like:
    Standard setpoint
    Night setpoint
    Away setpoint
    Window/doors sensors to stop heating then a window or doors opens.

  • #2
    I do achieve that with BLStat. I have different schedules for all sorts of situations, for the whole heating, as well as for different radiators. Works well. So depending on the situation, I just load for example the away schedule. On return, I load the schedule I had before away was loaded.

    Comment


    • #3
      Will BLSTAT also work with a random temperature sensor in a motion sensor for an example? And virtual device as output device?

      - Claus

      Comment


      • #4
        I appreciate that they can be difficult to get into but these sorts of things are relatively easy to do with a couple of virtual devices and a very simple couple of lines on a script. You can have a virtual device for each set point, then have another one for which set point is at which time. Then have a recurring event that checks what the set point should be, evaluates it and then if less than/more than it turns on a device.

        You can have a condition to the event that it would not run (or turns off heating) if a window changes to open.

        All of my heating is controlled in a similar fashion, 10 odd devices and a couple of events/scripts.
        My Plugins:

        Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
        Yeelight 3P | Nanoleaf 3P

        Comment


        • #5
          MrHappy: I have considered the same approach. I have not yet planned it in details. I have 14 heating zones, each having its own setpoint. Probably more, as away and night set points would be individual per zone.

          I am surprised that there isn't any plugin for a task like this.

          Comment


          • #6
            mrHappy, could you share you script for heating?

            Do you use a virtual device as to set the setpoint? If you do, is it 1 degree increment or 0,1 or 0,5 degrees?

            Comment


            • #7
              Originally posted by clisse View Post
              mrHappy, could you share you script for heating?

              Do you use a virtual device as to set the setpoint? If you do, is it 1 degree increment or 0,1 or 0,5 degrees?
              Here is my script but be mindful that it is a bit of a work in progress, the essentials are there however.

              Code:
              Dim LT As String = "ThermScript"
              
              Sub Main(ByVal Parm As String)
              
                  Try
              
                      Dim Parm2 As String = Parm
                      
                      hs.writelog(LT, "> Thermostat Name: " & Parm2)
              
                      If hs.DeviceExistsAddress(Parm2 & "-Root", False) = -1 Then 'check if the route device is there
                          CreateDevices(Parm2)
                      Else
                          
                          Dim InputTemp As Decimal = 0
              
                          If Parm2.toLower.Contains("upstairs") Then
                              InputTemp = Math.Round((hs.devicevalueEx(159) + hs.devicevalueEx(151) + hs.devicevalueEx(534)) / 3, 1)
                          Else
                              InputTemp = Math.Round((hs.devicevalueEx(141) + hs.devicevalueEx(38)) / 2, 1)
                          End If
              
                          hs.writelog(LT, "--> Input Temperature: " & InputTemp)
              
                          hs.setdevicevaluebyref(hs.getdeviceref(Parm2 & "-InTemp"), InputTemp, True)
                                     
                          If hs.devicevalueex(hs.DeviceExistsAddress(Parm2 & "-OvRide", False)) = 0 then
              
                              'delete any rogue overide events in case
              
                              hs.deleteevent(Parm2 & " Heating Override Event")
              
                              Dim SetTemp As Double = hs.devicevalueex(hs.DeviceExistsAddress(Parm2 & "-HeatSet", False))
              
                              hs.writelog(LT, "--> Heating Not In Override")
                              hs.writelog(LT, "---> Set Point Device: " & SetTemp)
              
                              If InputTemp < SetTemp Then
              
                                  hs.writelog(LT, "----> Heating To Go On")
                                  hs.setdevicevaluebyref(hs.getdeviceref(Parm2 & "-OpStatus"), 255, True)
                         
                              Else
              
                                  hs.writelog(LT, "----> Heating To Go Off")
                                  hs.setdevicevaluebyref(hs.getdeviceref(Parm2 & "-OpStatus"), 0, True)
                         
                              End If
              
                          Else
              
                              hs.writelog(LT, "--> Heating Overide Mode - Delete Any Rogue Events First")
              
                              'first I need to turn the heating on - can be done here!
                              Dim objCAPIControl As CAPIControl
                              
                              objCAPIControl = hs.CAPIGetSingleControlByUse(hs.DeviceExistsAddress(Parm2 & "-OpStatus", False), ePairControlUse._On)
                                              
                              If objCAPIControl IsNot Nothing Then hs.CAPIControlHandler(objCAPIControl)
              
                              'should I create the event here? 
                              hs.deleteevent(Parm2 & " Heating Override Event")
              
                              Dim MinutesToSet As Integer = hs.devicevalueex(hs.DeviceExistsAddress(Parm2 & "-OvRide", False))
              
                              hs.writelog(LT, "---> Need To Create Time Event: " & MinutesToSet & " Minutes")
              
                              Dim NewEventRef As Integer = 0
              
                              NewEventRef = hs.neweventgetref(Parm2 & " Heating Override Event", "Central Heating Events","")
              
                              hs.writelog(LT, "----> New Event Reference: " & NewEventRef)
              
                              Dim d as Date = DateTime.Now.AddMinutes(MinutesToSet)
              
                              hs.writelog(LT, "-----> Time To Set: " & d.ToString)
              
                              If NewEventRef <> 0 Then
              
                                  Dim Success As Boolean = hs.EventSetTimeTrigger(NewEventRef, d)
              
                                  hs.writelog(LT, "-----> Date Added Success: " & Success)
              
                                  Dim CCtrl As CAPIControl = hs.CAPIGetSingleControlByUse(hs.DeviceExistsAddress(Parm2 & "-OpStatus", False), ePairControlUse._Off)
                                  
                                  hs.writelog(LT, "-----> CAPIControl Nothing? " & IsNothing(CCtrl))
              
                                  If Success = True Then
              
                                      hs.writelog(LT, "-----> Event Added Success: " & hs.AddDeviceActionToEvent(NewEventRef, CCtrl))
              
                                  End If
              
                              End If
                          
                          End If
              
                      End If
              
              
                  Catch ex As Exception : hs.writelog(LT, "Exception: " & ex.Message.ToString)
                  End Try
              
              End Sub
              
              Sub CreateDevices(ByVal RoomName As String)
              
                  Dim CurrRef As Integer = 0
                  Dim BaseRef As Integer = 0
                  Dim dv As Scheduler.Classes.DeviceClass = Nothing
                  Dim root_dv As Scheduler.Classes.DeviceClass = Nothing
              
                  Try
                      hs.writelog(LT, "Devices Do Not Exist - Creating")
              
                      For i As Byte = 0 To 5
                         Select i
                              Case 0
                                  dv = hs.GetDeviceByRef(hs.NewDeviceRef(RoomName & " Thermostat"))
                                  dv.Address(hs) = RoomName & "-Root"
                                  BaseRef = dv.Ref(hs)
                              Case 1
                                  dv = hs.GetDeviceByRef(hs.NewDeviceRef(RoomName & " Set Point"))
                                  dv.Address(hs) = RoomName & "-HeatSet"
                              Case 2
                                  dv = hs.GetDeviceByRef(hs.NewDeviceRef(RoomName & " Mode"))
                                  dv.Address(hs) = RoomName & "-HeatMode"
                              Case 3
                                  dv = hs.GetDeviceByRef(hs.NewDeviceRef(RoomName & " Input Temperature"))
                                  dv.Address(hs) = RoomName & "-InTemp"
                              Case 4
                                  dv = hs.GetDeviceByRef(hs.NewDeviceRef(RoomName & " Override"))
                                  dv.Address(hs) = RoomName & "-OvRide"
                              Case 5
                                  dv = hs.GetDeviceByRef(hs.NewDeviceRef(RoomName & " Operating Status"))
                                  dv.Address(hs) = RoomName & "-OpStatus"
                          End Select
              
                         dv.Location(hs) = RoomName
                         dv.Last_Change(hs) = Now
                         dv.Device_Type_String(hs) = "Thermostat Device"
              
                          If i = 0 Then
                              root_dv = dv
                              dv.Relationship(hs) = Enums.eRelationship.Parent_Root
                          Else
                              If root_dv IsNot Nothing Then root_dv.AssociatedDevice_Add(hs, dv.Ref(hs))
                              dv.Relationship(hs) = Enums.eRelationship.Child
                              dv.AssociatedDevice_Add(hs, BaseRef)
                          End If
              
                          Dim DT As New DeviceTypeInfo
              
                          If i = 0 then 
                              DT.Device_API = DeviceTypeInfo.eDeviceAPI.Thermostat
                              DT.Device_Type = DeviceTypeInfo.eDeviceType_Thermostat.Root
                          ElseIf i = 1
                              DT.Device_API = DeviceTypeInfo.eDeviceAPI.Thermostat
                              DT.Device_Type =  DeviceTypeInfo.eDeviceType_Thermostat.Setpoint
                              DT.Device_SubType = DeviceTypeInfo.eDeviceSubType_Setpoint.Heating_1
                          ElseIf i = 2
                              DT.Device_API = DeviceTypeInfo.eDeviceAPI.Thermostat
                              DT.Device_Type =  DeviceTypeInfo.eDeviceType_Thermostat.Mode_Set
                          ElseIf i = 3
                              DT.Device_API = DeviceTypeInfo.eDeviceAPI.Thermostat
                              DT.Device_Type =  DeviceTypeInfo.eDeviceType_Thermostat.Temperature
                              DT.Device_SubType = DeviceTypeInfo.eDeviceSubType_Temperature.Temperature
                          ElseIf i = 5
                              DT.Device_API = DeviceTypeInfo.eDeviceAPI.Thermostat
                              DT.Device_Type =  DeviceTypeInfo.eDeviceType_Thermostat.Operating_Mode
                          end if
              
                          dv.DeviceType_Set(hs) = DT
              
                          Select Case i
                              Case 0 : hs.setdevicestring(dv.ref(hs), "No Status", True)
                              Case 1
              
                                  Dim Pair As VSPair
              
                                  Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                                  Pair.PairType = VSVGPairType.Range
                                  Pair.RangeStart = 15
                                  Pair.RangeEnd = 25
                                  Pair.RangeStatusSuffix = " C"
                                  Pair.Render = Enums.CAPIControlType.ValuesRangeSlider
                                  Pair.ControlUse = ePairControlUse._HeatSetPoint
                                  hs.DeviceVSP_AddPair(dv.Ref(hs), Pair)
              
                                  hS.setdevicevaluebyref(dv.ref(hs), 20, True)
                                  dv.MISC_Set(hs, Enums.dvMISC.SHOW_VALUES)
              
                              Case 2
              
                                  Dim Pair As VSPair
              
                                  Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                                  Pair.PairType = VSVGPairType.SingleValue
                                  Pair.Value = 100
                                  Pair.Status = "Heat"
                                  Pair.Render = Enums.CAPIControlType.Button
                                  Pair.ControlUse = ePairControlUse._ThermModeHeat
                                  hs.DeviceVSP_AddPair(dv.Ref(hs), Pair)
              
                                  Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                                  Pair.PairType = VSVGPairType.SingleValue
                                  Pair.Value = 0
                                  Pair.Status = "Off"
                                  Pair.Render = Enums.CAPIControlType.Button
                                  Pair.ControlUse = ePairControlUse._ThermModeOff
                                  hs.DeviceVSP_AddPair(dv.Ref(hs), Pair)
              
                                  hS.setdevicevaluebyref(dv.ref(hs), 100, True)
                                  dv.MISC_Set(hs, Enums.dvMISC.SHOW_VALUES)
                              Case 3
              
                                  Dim Pair As VSPair
              
                                  Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Status)
                                  Pair.PairType = VSVGPairType.Range
                                  Pair.RangeStart = 15
                                  Pair.RangeEnd = 25
                                  Pair.RangeStatusSuffix = " C"
                                  Pair.RangeStatusDecimals = 1
                  
                                  hs.DeviceVSP_AddPair(dv.Ref(hs), Pair)
              
                                  hS.setdevicevaluebyref(dv.ref(hs), 20, True)
                                  dv.MISC_Set(hs, Enums.dvMISC.SHOW_VALUES)
                                  dv.MISC_Set(hs, Enums.dvMISC.STATUS_ONLY)
              
                              Case 4
              
                                  Dim Pair As VSPair
                                  
                                  Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                                  Pair.PairType = VSVGPairType.Range
                                  Pair.RangeStart = 15
                                  Pair.RangeEnd = 240
                                  Pair.RangeStatusPrefix = "Heating "
                                  Pair.RangeStatusSuffix = " Minutes"
                                  Pair.Render = Enums.CAPIControlType.ValuesRange
                                  hs.DeviceVSP_AddPair(dv.Ref(hs), Pair)
              
                                  Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                                  Pair.PairType = VSVGPairType.SingleValue
                                  Pair.Value = 0
                                  Pair.Status = "Off"
                                  Pair.Render = Enums.CAPIControlType.Button
                                  
              
                                  hs.DeviceVSP_AddPair(dv.Ref(hs), Pair)
              
                                  hS.setdevicevaluebyref(dv.ref(hs), 0, True)
                                  dv.MISC_Set(hs, Enums.dvMISC.SHOW_VALUES)
              
                              Case 5
              
                                  Dim Pair As VSPair
              
                                  Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                                  Pair.PairType = VSVGPairType.SingleValue
                                  Pair.Value = 255
                                  Pair.Status = "Heating On"
                                  Pair.ControlUse = ePairControlUse._On
                                  Pair.Render = Enums.CAPIControlType.Button
              
                                  hs.DeviceVSP_AddPair(dv.Ref(hs), Pair)
              
                                  Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                                  Pair.PairType = VSVGPairType.SingleValue
                                  Pair.Value = 0
                                  Pair.Status = "Heating Off"
                                  Pair.ControlUse = ePairControlUse._Off
                                  Pair.Render = Enums.CAPIControlType.Button
              
                                  hs.DeviceVSP_AddPair(dv.Ref(hs), Pair)
              
                                  hS.setdevicevaluebyref(dv.ref(hs), 0, True)
                                  dv.MISC_Set(hs, Enums.dvMISC.SHOW_VALUES)
              
                          End Select
              
                          Select Case i
              
                              'this sets the value graphics pairs
              
                              Case 4 'overirde
                                  Dim GPair As VGPair
                                  
                                  GPair = New VGPair
                              
                                  GPair.PairType = VSVGPairType.Range
                                  GPair.RangeStart = 0
                                  GPair.RangeEnd = 240
                                  GPair.Graphic = "/images/HomeSeer/contemporary/timers.png"
              
                                  hs.DeviceVGP_AddPair(dv.ref(hs), GPair)
              
                              Case 3, 1 'overirde
                                  Dim GPair As VGPair
                                  GPair = New VGPair
                              
                                  GPair.PairType = VSVGPairType.Range
                                  GPair.RangeStart = 15
                                  GPair.RangeEnd = 25
                                  GPair.Graphic = "/images/HomeSeer/contemporary/Thermometer-50.png"
              
                                  hs.DeviceVGP_AddPair(dv.ref(hs), GPair)
              
                          End Select
              
                          hs.saveeventsdevices
              
                      Next
              
                      Main(RoomName)
              
                  Catch ex As Exception
                      hs.writelog(LT, "Create Devices Exception: " & ex.message.tostring)
                  End Try
              
              End Sub
              Basically run the script passing in the parameter of the thermostat name (say you wish to call it 'Upstairs'), HS will then create a set of devices in the required format for this name. You would also need to make sure the variable InputTemp had your value that you were testing against (in mine I am taking the average of a number of Z-Wave multi sensor temp sensors).

              The heating status device will then go off and on when there is a requirement to heat/not heat. In my situation I am linking that device to a Fibaro relay module that is controlling my heating.

              You then need to run the script (passing in the room name as parameter) with the following, on a recurring basis (I run every two minutes), when the setpoint device changes and when the override device changes.

              It should work OK with Alexa, works OKish with HSTouch but the raise/lower buttons do not appear to want to work.
              My Plugins:

              Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
              Yeelight 3P | Nanoleaf 3P

              Comment


              • #8
                Originally posted by clisse View Post
                Does anybody know of a virtual thermostat plugin for HS3.

                I am missing a plugin to use a temperature and a output for heating control with settings like:
                Standard setpoint
                Night setpoint
                Away setpoint
                Window/doors sensors to stop heating then a window or doors opens.
                I do have a plug-in I wrote for myself which creates and runs a number of Virtual Thermostats which have three set points High (day?) Low (night?) and Frost (away?). It uses any temperature sensor devices for internal and external temperatures and controls any switch device. I have had it running for a couple of years now with 3 zones each with their own set points and 7 day schedules so have ironed out most of the bugs. It creates a group of devices for each VSTAT which are set up so that I can create custom screens in HSTOUCH which allow me to operate the VSTATS on screens around the house as if they were real thermostats. The 7 day schedules are created in a separate windows program, basically by drawing them with the mouse. However, I also built in the ability to load and save EasyTrigger schedules.

                The main point is that it is developed very much to work the way I want it to and might not do things the way other people want. Also I haven't written a guide as so far it has just been for my own use. If you wanted to give it a go I could email it to you with some basic instructions to try out.

                Some example screen shots attached give an idea of how it works. Note the HSTOUCH screen is functional but not pretty, I'm no graphics designer

                Steve
                Attached Files

                Comment


                • #9
                  Originally posted by SteveMSJ View Post
                  I do have a plug-in I wrote for myself which creates and runs a number of Virtual Thermostats which have three set points High (day?) Low (night?) and Frost (away?). It uses any temperature sensor devices for internal and external temperatures and controls any switch device. I have had it running for a couple of years now with 3 zones each with their own set points and 7 day schedules so have ironed out most of the bugs. It creates a group of devices for each VSTAT which are set up so that I can create custom screens in HSTOUCH which allow me to operate the VSTATS on screens around the house as if they were real thermostats. The 7 day schedules are created in a separate windows program, basically by drawing them with the mouse. However, I also built in the ability to load and save EasyTrigger schedules.

                  The main point is that it is developed very much to work the way I want it to and might not do things the way other people want. Also I haven't written a guide as so far it has just been for my own use. If you wanted to give it a go I could email it to you with some basic instructions to try out.

                  Some example screen shots attached give an idea of how it works. Note the HSTOUCH screen is functional but not pretty, I'm no graphics designer

                  Steve

                  Steve, this looks very interesting and I would love to try it out in my system. Any chance you could send me a copy of the script?

                  Comment


                  • #10
                    Steve, this looks very interesting and I would love to try it out in my system. Any chance you could send me a copy of the script?

                    Comment


                    • #11
                      Steve, I would love to try it out. Appreciate if you would send it to me.

                      Comment


                      • #12
                        Steve, what brand and model# are your temperature sensors?

                        Thanks!

                        Comment


                        • #13
                          Originally posted by Borg1n View Post
                          Steve, this looks very interesting and I would love to try it out in my system. Any chance you could send me a copy of the script?
                          Borg1n and clisse, if you click on my username and send me a private message I will send you a copy of the plug-in to try out. You will probably need to include your email address in the message because I don't think I can send attachments using the forum private message system.

                          There is no user guide so you will probably need to ask some questions to run it. I'm a bit busy at work at the moment but I will try and help out when I can.

                          Steve

                          Comment


                          • #14
                            Originally posted by Bugman1400 View Post
                            Steve, what brand and model# are your temperature sensors?

                            Thanks!
                            I use a variety of Z-Wave temperature sensors. Aeon multisensors versions 5 and 6, Fibaro Universal Sensors and Door and Window sensors (using DS18B20s), HMS100, etc.

                            Steve

                            Comment


                            • #15
                              Originally posted by Borg1n View Post
                              Steve, this looks very interesting and I would love to try it out in my system. Any chance you could send me a copy of the script?
                              Borge, I have sent you a copy of the plug-in with a quick guide to installation and use. Let me know how you get on with it.

                              Steve

                              Comment

                              Working...
                              X