Renstar is a Ruby SDK for interacting with the Venstar Thermostat Local API.
You can control your thermostat programmatically!
Add this line to your application's Gemfile:
gem 'renstar'And then execute:
$ bundle install
Or install it yourself as:
$ gem install renstar
Well, OK, it's just a script that uses the library, but it wraps all of the functionality and lets you just control your thermostat if that's all you're here for.
When installing the gem, we install renstar.rb for you automatically. You can
pass the -h flag for more info.
The help page does not list all the accepted commands or their values but all of the methods below are supported. The binary just passes your arguments to the methods below.
So, if you want to cool your house to 72 using the binary, you can do this in your favorite shell:
renstar.rb cool 72You can apply the logic above to any of the methods below for the same effect.
The binary chooses the first thermostat it finds on the network, so you may get unexpected results if you have more than one on your network.
You can use the -t option to pass the hostname or IP address of a thermostat
if you know it and don't want to wait for autodiscovery to find it.
First we need to create a Thermostat object.
- Search for thermostats on the LAN, return the first one found:
thermo = Renstar::Thermostat.search.firstThese methods let you see the thermostat info (controls and settings status), sensor info, runtimes, and alerts.
- Get information about the thermostat:
thermo.info- Get the current sensors and their readings:
thermo.sensors- Get runtimes:
thermo.runtimes- See alerts and their status:
thermo.alertsThese methods let you control the thermostat temperature controls, and fan. You
can use the info method to check the current state of these controls.
- Heat to 80 degrees:
thermo.heat(80)- Cool to 60 degrees:
thermo.cool(60)- Automatically keep the temp between 70 and 74 degrees:
thermo.auto(70, 74)- Turn off heating and/or cooling
thermo.off- Control the fan:
thermo.fan_on
thermo.fan_off
thermo.fan_toggleThese methods let you change the schedule and vacation settings on your
thermostat. You can use the info method to check the current state of the
settings.
- Set the schedule:
thermo.schedule_on
thermo.schedule_off
thermo.schedule_toggle- Set Home/Away:
thermo.home
thermo.awayAfter checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/renstar.