Control Venstar thermostats with Ruby via their local API.


License
MIT
Install
gem install renstar -v 0.2.1

Documentation

Renstar

Renstar is a Ruby SDK for interacting with the Venstar Thermostat Local API.

You can control your thermostat programmatically!

Installation

Add this line to your application's Gemfile:

gem 'renstar'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install renstar

Using the included binary

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 72

You can apply the logic above to any of the methods below for the same effect.

Note about thermostat selection

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.

Using the library

First we need to create a Thermostat object.

  • Search for thermostats on the LAN, return the first one found:
thermo = Renstar::Thermostat.search.first

Query

These 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.alerts

Control

These 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_toggle

Settings

These 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.away

Development

After 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.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/renstar.