Announcement

Collapse
No announcement yet.

Gaining access to the thermostats through scripts

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Gaining access to the thermostats through scripts

    Hi, I am a long-time user of Beakerstat to run my five RM-50 thermostats, and I love it. I'd like to control the thermostats directly from scripts, without messing up the plugin (and while preserving the normal operation of the plugin).

    All I want to do through scripts is change the temperature setting. It appears I can change the value of the current temperature device by simply using the hs.setdevicevalue command, but I can't tell whether this change is actually is sent to the thermostat or not (I'm not physically present at the location; I'll be there in two weeks). And the stringvalue of the main thermostat device in Homeseer (the device where the stringvalue has a thermostat icon and shows current temp, temp setting, fan position, etc) is obviously not updated when I issue the setdevicevalue command to the temperature setting device; I assume you construct the stringvalue of the main thermostat device in the plugin each time a change is made.

    I don't want to mess with the Homeseer variables using scripts and get them out of sync with the plugin. Is there an easy way for me to control the thermostats through the plugin using scripts?

    (FYI, before I used the plugin I was able to read and write directly to the thermostats over wifi - I can't remember the commands, but I think it was using XML? - but I much prefer to work through the plugin if that is possible.
    I also realize I can accomplish the same thing using events, which I will do if there is no way to control the plugin via scripts.

    Thanks in advance for any help you can provide.

    #2
    Sorry, I need to update my post - I figured out how to access the thermostats through a script using the Thermostat API for Homeseer, with which Beakerstat complies. I can set the heat setpoint using the cmdSetHeat command.

    However, it seems that this command is not as reliable as using Homeseer to set the setpoint. For example - I have five thermostats, and I loop through the five and send a setpoint command to each, writing a confirmation to the HS log when the command finishes executing. According to the log file, three of the commands (for thermostats #1, #2 and #3) finish almost instantly, and the log entries are one second apart. But the fourth and fifth commands take 20 seconds each, and while they write that they are complete to the log file the setpoints don't actually change. It's as if there was a timeout and after 20 seconds or so cmdSetHEat gives up and tells the script engine that it is done, and the script moves on to the next statement (writing to the log file).

    Do I need to check the thermostats to see if they actually changed their setpoint, and if not loop back and repeat the command? Is this what the plugin does in Homeseer, making it more reliable?

    Sorry for the detailed question, and thanks in advance for your help.

    Comment


      #3
      Changing the set point value from the HS interface and calling cmdSetHeat do the same thing, so I'm not sure why one would be more reliable than the other. I do recommend checking the set point a few seconds after you call the function, since the thermostats do on occasion miss commands. If you PM me or post a verbose debug log showing when the thermostat does not change I might be able to help diagnose what's going on.
      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


        #4
        Thanks, belatedly, for your reply. I've not had any trouble recently and I don't know if I can replicate the error I was seeing, so I will drop the issue for now.

        Comment


          #5
          Hi, I've had a chance to do a little bit more exploring, and I'm now able to check directly through the API whether or not the thermostat has "taken" the command to change the heat setpoint. The following script loops through all the thermostats on the system and attempts to set the heat setpoint to the value of 'setpoint'. If the value of 'return' is zero the command was accepted; if the value is nonzero it indicates there was a problem.

          For example - if the thermostat is not connected via wifi the return value = 1, indicating the thermostat is offline.

          I monitor these thermostats in a vacation home in a cold climate, so knowing whether a thermostat is online or not, and knowing that the temperature reading from the thermostat is current or not, is important.

          Here's the code I used, in case it is helpful to anyone. The code, of course, requires the BeakerStat plugin to operate:

          Code:
          Sub Main(ByVal parms as Object)
          
          	Dim pi As Object
          	dim i as integer
          	dim setpoint as double
          	dim result as integer
          
          	setpoint = hs.devicevalue("T10")
          
          	pi = hs.Plugin("BeakerStat") 
          
          	for i = 1 to 5
          		result = pi.cmdSetHeat(i, setpoint,1)
          		hs.writelog ("Temp", "Set temp of " & pi.ThermName(i) & " to " & setpoint & "; result is " & result)
          	next
          
          End Sub
          Again, I hope this is helpful to those of you using the 3M-50 thermostats and the plugin. The plugin is great, but the thermostats are (how shall I put it?) less great. They really need supervision if you plan to use them for mission-critical functions.

          Comment


            #6
            Thanks for the post. I'm sure this will be helpful to many folks. It should be pretty easy for me to include something like this in the plugin itself. I'm thinking that I could make this part of the polling process. When a thermostat is polled if its actual set point doesn't match then try to reset it. I'll put that on the list of enhancements for the HS3 version.
            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

            Working...
            X