- Install the gem
- Find a thermostat on the network
- Controlling the Thermostat
I’ve got a nifty Venstar thermostat that hooks up to the wifi so I can control it from the Venstar mobile app. The app works fine, and uses a cloud service so you don’t have to be on local wifi, but I wanted direct control of it from my LAN.
It turns out the good people at Venstar provide documentation for their local API. You will need to enable the “Local API” on your thermostat before this library will work.
Install the gem
Let’s start by installing the gem:
I recommend loading the library in irb or pry (I use pry) so we can interact with the receiver:
We of course have to load our gem, you can do it with this:
Find a thermostat on the network
The gem can leverage SSDP discover your thermostats and return
Thermostat objects that will let us easily control them. The
search method returns an array of found thermostats. We’re just going to take the
Controlling the Thermostat
Now that we have our
Thermostat object, we can easily control it:
Heat to 80 degrees:
Cool to 60 degrees:
Automatically keep the temp between 70 and 74 degrees:
Turn off heating and/or cooling
Control the fan:
Control the schedule:
Check out the renstar gem on github and submit a PR!