Device::RadioThermostat - Access Radio Thermostat Co of America (3M-Filtrete) WiFi thermostats
use Device::RadioThermostat; my $thermostat = Device::RadioThermostat->new( address => "http://$ip"); $thermostat->temp_cool(65); say "It is currently " . $thermostat->tstat()->{temp} "F inside.";
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.
For additional information on the arguments and values returned see the RTCOA API documentation (pdf).
Constructor takes named parameters. Currently only address which should be the HTTP URL for the thermostat.
address
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') }
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).
temp
tmode
fmode
override
hold
t_heat
t_cool
it_heat
It_cool
a_heat
a_cool
a_mode
t_type_post
t_state
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).
uuid
api_version
fw_version
wlan_fw_version
Retrieve a hash with information about the current thermostat model. Currently hash only has key model.
model
Takes a single integer argument for your desired mode. Values are 0 for off, 1 for heating, 2 for cooling, and 3 for auto.
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.
Returns a reference to a hash of the set points. Keys are t_cool and t_heat.
Returns a reference to a hash containing current relative humidity (only supported by CT-80 Thermostats). Key is humidity.
humidity
Set a temporary heating set point, takes one argument the desired target. Will also set current mode to heating.
Set a temporary cooling set point, takes one argument the desired target. Will also set current mode to cooling.
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.
rem_mode
rem_temp
set_remote_temp
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.
Takes a single value to set the current remote temp.
Disables remote_temp mode and reverts to using the thermostats internal temp sensor.
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.
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. This is only supported by the CT-80 model thermostats. CT-80 Thermostat supports 2 rows of alphanumeric strings of 26 characters in length.
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.
CT-80 model thermostats support displaying 2 alphanumeric strings of 6 characters in length in the price message area.
Clears the price_message area.
price_message
Clears the user_message area.
user_message
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 } } };
Returns the unique ID of the thermostat which is the MAC address. This helps distinguish thermostats when there are many on the same network.
Mike Greb <michael@thegrebs.com>
Copyright 2013- Mike Greb
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Device::RadioThermostat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::RadioThermostat
CPAN shell
perl -MCPAN -e shell install Device::RadioThermostat
For more information on module installation, please visit the detailed CPAN module installation guide.