This is probably easy but for the hstouch i don't want a pulldown and want to simulate pressing a button and making the setpoint go up or down by 1 degree. I figured probably the best way to do this would be with scripting. Anyone have any ideas?
Announcement
Collapse
No announcement yet.
Script for increasing/decreasing degrees
Collapse
This topic is closed.
X
X
-
Found this in a separate thread if anyone needs it in the future.
Sub Main(parms As Object)
Dim pi As Object
Dim currentHeatSetPoint As Double
pi = hs.Plugin("BeakerStat")
currentHeatSetPoint = pi.getHeatSet(1, 1)
currentHeatSetPoint = currentHeatSetPoint + 1
pi.cmdSetHeat(1, currentHeatSetPoint, 1)
End Sub
-
Here is a more complete script you can use. You pass it two arguments: thermostat name (as displayed in the plugin configuration thermostats page) and temperature difference. The second argument is a positive or negative integer.
Code:Public Sub Main(byval parm as Object) ' Pass two parameters to this script. First parameter ' should be the unit name of the thermostat as reported in ' the BeakerStaat configuration Thermostats page. ' Second parameter is the number of degrees to raise ' or lower setpoint. e.g. "Living Room,-1" would lower by 1 degree. Dim parms = Split(parm.ToString, ",") Dim setpoint As Integer Dim index As Integer Dim x As Integer Dim mode As Integer = 0 index = -1 ' Get the thermostat index For x = 1 To hs.Plugin("BeakerStat").NThermostats() If hs.Plugin("BeakerStat").ThermName(x) = parms(0) Then index = x End If Next If index = -1 Then hs.WriteLog("Thermostat", "Thermostat not found") Return End If ' Get the current operating mode (Heat or Cool) mode = hs.Plugin("BeakerStat").GetModeSet(index, 0) Select Case mode Case 1 ' Get heat setpoint setpoint = hs.Plugin("BeakerStat").GetHeatSet(index, 0) hs.WriteLog("Thermostat", "Current setpoint is " & setpoint.ToString) ' Compute new setpoint setpoint = setpoint + Convert.ToInt32(parms(1)) ' Set the new setpoint hs.Plugin("BeakerStat").CmdSetHeat(index, setpoint, 0) Case 2 ' Get cool setpoint setpoint = hs.Plugin("BeakerStat").GetCoolSet(index, 0) hs.WriteLog("Thermostat", "Current setpoint is " & setpoint.ToString) ' Compute new setpoint setpoint = setpoint + Convert.ToInt32(parms(1)) ' Set the new setpoint hs.Plugin("BeakerStat").CmdSetCool(index, setpoint, 0) Case Else End Select hs.WriteLog("Thermostat", "New setpoint is " & setpoint.ToString) End Sub
Last edited by reidfo; January 24, 2013, 11:42 AM.HS Pro 3.0 | Linux Ubuntu 16.04 x64 virtualized under Proxmox (KVM)
Hardware: Z-NET - W800 Serial - Digi PortServer TS/8 and TS/16 serial to Ethernet - Insteon PLM - RFXCOM - X10 Wireless
Plugins: HSTouch iOS and Android, RFXCOM, BlueIris, BLLock, BLDSC, BLRF, Insteon PLM (MNSandler), Device History, Ecobee, BLRing, Kodi, UltraWeatherWU3
Second home: Zee S2 with Z-Wave, CT101 Z-Wave Thermostat, Aeotec Z-Wave microswitches, HSM200 occupancy sensor, Ecolink Z-Wave door sensors, STI Driveway Monitor interfaced to Zee S2 GPIO pins.
Comment
-
Originally posted by reidfo View PostHere is a more complete script you can use. You pass it two arguments: thermostat name (as displayed in the plugin configuration thermostats page) and temperature difference. The second argument is a positive or negative integer.
Code:Public Sub Main(byval parm as Object) ' Pass two parameters to this script. First parameter ' should be the unit name of the thermostat as reported in ' the BeakerStaat configuration Thermostats page. ' Second parameter is the number of degrees to raise ' or lower setpoint. e.g. "Living Room,-1" would lower by 1 degree. Dim parms = Split(parm.ToString, ",") Dim setpoint As Integer Dim index As Integer Dim x As Integer Dim mode As Integer = 0 index = -1 ' Get the thermostat index For x = 1 To hs.Plugin("BeakerStat").NThermostats() If hs.Plugin("BeakerStat").ThermName(x) = parms(0) Then index = x End If Next If index = -1 Then hs.WriteLog("Thermostat", "Thermostat not found") Return End If ' Get the current operating mode (Heat or Cool) mode = hs.Plugin("BeakerStat").GetModeSet(index, 0) Select Case mode Case 1 ' Get heat setpoint setpoint = hs.Plugin("BeakerStat").GetHeatSet(index, 0) hs.WriteLog("Thermostat", "Current setpoint is " & setpoint.ToString) ' Compute new setpoint setpoint = setpoint + Convert.ToInt32(parms(1)) ' Set the new setpoint hs.Plugin("BeakerStat").CmdSetHeat(index, setpoint, 0) Case 2 ' Get cool setpoint setpoint = hs.Plugin("BeakerStat").GetCoolSet(index, 0) hs.WriteLog("Thermostat", "Current setpoint is " & setpoint.ToString) ' Compute new setpoint setpoint = setpoint + Convert.ToInt32(parms(1)) ' Set the new setpoint hs.Plugin("BeakerStat").CmdSetCool(index, setpoint, 0) Case Else End Select hs.WriteLog("Thermostat", "New setpoint is " & setpoint.ToString) End Sub
Comment
Comment