NAME
   Device::RadioThermostat - Access Radio Thermostat Co of America
   (3M-Filtrete) WiFi thermostats

SYNOPSIS
     use Device::RadioThermostat;
     my $thermostat = Device::RadioThermostat->new( address => "http://$ip");
     $thermostat->temp_cool(65);
     say "It is currently " . $thermostat->tstat()->{temp} "F inside.";

DESCRIPTION
   Device::RadioThermostat is a perl module for accessing the API of
   thermostats manufactured by Radio Thermostat Corporation of America.
   3M-Filtrete themostats with WiFi are OEM versions manufactured by RTCOA.

METHODS
   For additional information on the arguments and values returned see the
   RTCOA API documentation (pdf)
   <http://www.radiothermostat.com/documents/RTCOAWiFIAPIV1_3.pdf>.

 new( address=> 'http://192.168.1.1')
   Constructor takes named parameters. Currently only "address" which
   should be the HTTP URL for the thermostat.

 find_all(address1, address2)
   This finds all the thermostats in the address range and returns a
   reference to a hash which contains Device::RadioThermostat objects
   indexed by the device uuid. For example, it might return a structure as
   follows:

       Device::RadioThermostat->find_all("192.168.1.1", "192.168.1.254")

   returns

       {
       "5cdad4123456" => Device::RadioThermostat(address => 'http://192.168.1.76'),
       "5cdad4654321" => Device::RadioThermostat(address => 'http://192.168.1.183')
       }

 tstat
   Retrieve a hash of lots of info on the current thermostat state.
   Possible keys include: "temp", "tmode", "fmode", "override", "hold",
   "t_heat", "t_cool", "it_heat", "It_cool", "a_heat", "a_cool", "a_mode",
   "t_type_post", "t_state". For a description of their values see the
   RTCOA API documentation (pdf)
   <http://www.radiothermostat.com/documents/RTCOAWiFIAPIV1_3.pdf>.

 sys
   Retrieve a hash of lots of info on the current thermostat itself.
   Possible keys include: "uuid", "api_version", "fw_version",
   "wlan_fw_version". For a description of their values see the RTCOA API
   documentation (pdf)
   <http://www.radiothermostat.com/documents/RTCOAWiFIAPIV1_3.pdf>.

 set_mode($mode)
   Takes a single integer argument for your desired mode. Values are 0 for
   off, 1 for heating, 2 for cooling, and 3 for auto.

 get_target
   Returns undef if current mode is off. Returns heat or cooling set point
   based on the current mode. If current mode is auto returns a reference
   to a two element array containing the cooling and heating set points.

 get_targets
   Returns a reference to a hash of the set points. Keys are "t_cool" and
   "t_heat".

 temp_heat($temp)
   Set a temporary heating set point, takes one argument the desired
   target. Will also set current mode to heating.

 temp_cool($temp)
   Set a temporary cooling set point, takes one argument the desired
   target. Will also set current mode to cooling.

 remote_temp
   Returns a reference to a hash containing at least "rem_mode" but
   possibly also "rem_temp". When "rem_mode" is 1, the temperature passed
   to "set_remote_temp" is used instead of the thermostats internal temp
   sensor for thermostat operation.

   This can be used to have the thermostat act as if it was installed in a
   better location by feeding the temp from a sensor at that location to
   the thermostat periodically.

 set_remote_temp($temp)
   Takes a single value to set the current remote temp.

 disable_remote_temp
   Disables remote_temp mode and reverts to using the thermostats internal
   temp sensor.

 lock
 lock($mode)
   With mode specified, sets mode and returns false on failure. With
   successful mode change or no mode specified, returns the current mode.
   Mode is an integer, 0 - disabled, 1 - partial lock, 2 - full lock, 3 -
   utility lock.

 user_message($line, $message)
   Display a message on one of the two lines of alphanumeric display at the
   bottom of the thermostat. Valid values for line are 0 and 1. Messages
   too long will scroll. This is only supported by the CT-80 model
   thermostats.

 price_message($line, $message)
   Display a message in the price message area on the thermostat. Messages
   can be numeric plus decimal only. Valid values for line are 0 - 3.
   Multiple messages for different lines are rotated through. I believe
   line number used will cause an indicator for units to display based on
   the number used but it's not mentioned in the API docs and I'm not home
   currently.

 clear_message
   Clears the "price_message" area. May also clear the "user_message", I'd
   appreciate someone with a CT-80 letting me know.

 datalog
   Returns individual run times for heating and cooling yesterday and
   today. This method isn't documented in the current API so it may go away
   in the future but does still work with the latest firmware. Sample data:

       $data = {
                 'today' => {
                            'cool_runtime' => { 'minute' => 29, 'hour' => 2 },
                            'heat_runtime' => { 'minute' => 0,  'hour' => 0 }
                          },
                 'yesterday' => {
                            'heat_runtime' => { 'minute' => 0,  'hour' => 0 },
                            'cool_runtime' => { 'minute' => 14, 'hour' => 0 }
                          }
               };

 get_uuid
   Returns the unique ID of the thermostat which is the MAC address. This
   helps distinguish thermostats when there are many on the same network.

AUTHOR
   Mike Greb <[email protected]>

COPYRIGHT
   Copyright 2013- Mike Greb

LICENSE
   This library is free software; you can redistribute it and/or modify it
   under the same terms as Perl itself.

SEE ALSO