skip to Main Content

Taking Control of Your Thermostat

Once in a while I come across a new product that solves a problem so elegantly that I just have to ask myself, why didn’t think of this before? It’s been very cold recently in the East Coast and when it gets very cold, my house’s gas heating system goes completely nuts. If I set the thermostat desired temperature to 70 degrees, the temperature in the bedroom will be in the roasting 80’s. The temperature differential depends how how cold it is outside, so I can’t just simply set the thermostat to a specific offset and forget either. I constantly need to get up in the middle of the night to adjust the thermostat downstairs when it gets cold outside. Why do I have to do this? I guess nobody told my house that we are in the 21st century.

image

So, the first thing I thought of is a remote control for the thermostat. Well, no surprise, they do make them. Apparently, my problem is fairly common for two-story homes with a single HVAC system. This Lux TX9000RF Programmable Thermostat with Remote looked very promising to me. A product like this would allow adjusting the thermostat temperature from anywhere in the house.

That still requires some work however. Hmm… what if there is a thermostat that can read the current temperature from a remote sensor? Bingo: they make those too. There are not many to be found, and after searching around, I decided to go for the  Honeywell YTHX9321R5003 Prestige HD Thermostat Kit and I’ve been very happy with the result so far. This kit is expensive, but very well made and it works as advertised. It also looks very nice. The kit includes the thermostat, a remote control/sensor, and an outdoor sensor. This kit is in Honeywell Pro Install line, which means it’s sold mainly through HVAC contractors and installers. I found the installation process only slightly more complicated than a regular programmable thermostat. The only thing you need to watch out for is that this thermostat requires a 24vac Common wire (commonly black in color), which may not be available in your setup. If that is the case, then you will need to run/fish a new wire from your furnace – a pretty big job.

Now with this cool new gadget hooked up and everything humming, all I have to do is bring the remote with me to the bedroom and push the button on it named “Read temp from this device” and I am set for the night. If I ever want to tweak the temperature for some reason, I can do it right there with the remote. If only everything else was this easy!

clip_image001

Automating Maven with PowerShell

I found out the hard way that mvn (Maven) on Windows always return a success code of true, which means you cannot use the return code ($?) to check whether the mvn command succeeded or failed. Why they decided to break this seemingly basic program contract is a mystery. A work-around is to scan the mvn output and look for specific strings such as “BUILD SUCCESSFUL”.

Here’s how:

function InvokeAndCheckStdOut($cmd, $successString, $failString) {
    Write-Host "====> InvokeAndCheckStdOut"
    $fullCmd = "$cmd|Tee-Object -variable result" 

    Invoke-Expression $fullCmd
    $found = $false
    $success = $false
    foreach ($line in $result) {
      if ($line -match $failString) {
       $found = $true
       $success = $false
       break
      }
      else {
       if ($line -match $successString) {
        $found = $true
        $success = $true
        #"[InvokeAndCheckStdOut] FOUND MATCH: $line"
        break
       }
       else {
        #"[InvokeAndCheckStdOut] $line"
       }
      }
    }

    if (! $success) {
      PlayWav "${env:windir}\Media\ding.wav"
      throw "Mvn command failed."
    }

    Write-Host "InvokeAndCheckStdOut <===="
}

function InvokeMvn($cmd) {
    InvokeAndCheckStdOut $cmd "BUILD SUCCESSFUL" "BUILD FAILED"
}


InvokeMvn "mvn clean install"

See Also

Tee-Object and Invoke-Expression in PowerShell

The PowerShell Tee-Object Cmdlet allows you to send command output to a file or a variable, and display it in the console at the same time. This is very useful for those instances where you need to parse the text output of a command. I had a hard time getting it to work with Invoke-Expression. After trying different things, I finally found the solution. To get Tee-Object to work with Invoke-Expression in PowerShell 1, include the Tee command in the Invoke-Expression command like this:

Invoke-Expression "mvn clean install | Tee –variable result”

The following, which I guess is what most people try first, doesn’t work (at least in PowerShell V1). I guess because you are storing the result of the “Invoke-Expression” command itself into the variable instead of “mvn clean install”.

    Invoke-Expression "mvn clean install” | Tee -variable result

Wrapping Invoke-Expression in parenthesis (see below) works, but has a drawback: the output is not written to Standard Out until the whole command finishes.

    (Invoke-Expression "mvn clean install”) | Tee -variable result

7-Zip Can Be Used to Open ISO Archives

Did you know that 7-Zip can open and extract ISO archives? I had to install OneNote today from the MSDN ISO and I didn’t have an virtual drive/ISO mounting tool installed on my work PC. So I tried to open the ISO in 7-Zip and it opened it just fine. All I then had to do was to extract the files to a temp folder and did the install from there.

image

Back To Top