- 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:
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 heeating and/or cooling
Control the fan:
thermo.fan_on thermo.fan_off thermo.fan_toggle
Control the schedule:
thermo.schedule_on thermo.scheduel_off thermo.schedule_toggle
Check out the renstar gem on github and submit a PR!