Device::Nest - Methods for wrapping the Nest API calls so that they are accessible via Perl
Version 0.09
This module provides a Perl interface to a Nest Thermostat via the following methods: - new - connect - fetch_Ambient_Temperature - fetch_Designation In order to use this module, you will require a Nest thermostat installed in your home as well. You will also need your ClientID and ClientSecret provided by Nest when you register as a developper at https://developer.nest.com. You will aos need an access code which can be obtained at https://home.nest.com/login/oauth2?client_id=CLIENT_ID&state=FOO Your authorization code will be obtained and stored in this module when you call it. The module is written entirely in Perl and has been developped on Raspbian Linux.
use Device::Nest; $my_Nest = Device::Nest->new($ClientID,$ClientSecret,$code,$phrase,$debug); $my_Nest->connect(); undef $my_Nest; You need to get an authorization code by going to https://home.nest.com/login/oauth2?client_id=CLIENT_ID&state=FOO and specifying your client ID in the URL along with a random string for state Use this code, along with your ClientID and ClientSecret to get an authorization code by using the 'connect' function below. From now on, all you need is your auth_token
All by default.
Creates a new instance which will be able to fetch data from a unique Nest sensor. my $Nest = Device::Nest->new($ClientID, $ClientSecret, $phrase, $debug); This method accepts the following parameters: - $ClientID : Client ID for the account - Required - $ClientSecret : Secret key for the account - Required - $auth_token : authentication token to access the account - Required - $debug : enable or disable debug messages (disabled by default - Optional) Returns a Nest object if successful. Returns 0 on failure
This function will display the authenticaton token for the PIN code provided. This can only be done once per PIN code. Pleas make sure to note and store your auth code since it will be the only thing requiired for all other API calls. $Nest->fetch_Auth_Token(); This method accepts no parameters Returns 1 on success and prints auth_token Returns 0 on failure
Retrieves the code designating your thermostat and stores it in $self $Nest->fetch_Thermostat_Designation(); This method accepts no parameters Returns 1 on success Returns 0 on failure
Retrieves the ambient temperature reported by the Nest in Celcius $Nest->fetch_Ambient_Temperature_C(); This method accepts no parameters Returns the ambient temperature in Celcius Returns 0 on failure
Retrieves the target temperature reported by the Nest in Celcius $Nest->fetch_Target_Temperature_C(); This method accepts no parameters Returns the target temperature in Celcius Returns 0 on failure
Retrieves the high target temperature reported by the Nest in Celcius $Nest->fetch_Target_Temperature_high_C(); This method accepts no parameters Returns the high target temperature in Celcius Returns 0 on failure
Retrieves the lower target temperature reported by the Nest in Celcius $Nest->fetch_Target_Temperature_low_C(); This method accepts no parameters Returns the lower target temperature in Celcius Returns 0 on failure
Retrieves the lower away temperature reported by the Nest in Celcius $Nest->fetch_Away_Temperature_low_C(); This method accepts no parameters Returns the lower away temperature in Celcius Returns 0 on failure
Retrieves the high away temperature reported by the Nest in Celcius $Nest->fetch_Away_Temperature_high_C(); This method accepts no parameters Returns the high away temperature in Celcius Returns 0 on failure
Retrieves the ambient temperature reported by the Nest in Fahrenheit $Nest->fetch_Ambient_Temperature_F(); This method accepts no parameters Returns the ambient temperature in Fahrenheit Returns 0 on failure
Retrieves the lower away temperature reported by the Nest in Fahrenheit $Nest->fetch_Away_Temperature_low_F(); This method accepts no parameters Returns the lower away temperature in Fahrenheit Returns 0 on failure
Retrieves the higher away temperature reported by the Nest in Fahrenheit $Nest->fetch_Away_Temperature_high_F(); This method accepts no parameters Returns the higher away temperature in Fahrenheit Returns 0 on failure
Retrieves the lower target temperature reported by the Nest in Fahrenheit $Nest->fetch_Target_Temperature_low_F(); This method accepts no parameters Returns the lower target temperature in Fahrenheit Returns 0 on failure
Retrieves the target temperature reported by the Nest in Fahrenheit $Nest->fetch_Target_Temperature_F(); This method accepts no parameters Returns the target temperature in Fahrenheit Returns 0 on failure
Retrieves the higher target temperature reported by the Nest in Fahrenheit $Nest->fetch_Target_Temperature_high_F(); This method accepts no parameters Returns the target temperature in Fahrenheit Returns 0 on failure
Retrieves the temperature scale reported by the Nest as either F (Fahrenheit) or C (Celcius) $Nest->fetch_Temperature_Scale(); This method accepts no parameters Returns the temperature scale Returns 0 on failure
Retrieves the state of the Nest indicating whether it is using Emergency Heat $Nest->fetch_Is_Using_Emergency_Heat(); This method accepts no parameters Returns a Boolean
Retrieves the state of the Nest indicating whether it is online $Nest->fetch_Is_Online(); This method accepts no parameters Returns a Boolean
Retrieves the state of the Nest indicating whether it can heat $Nest->fetch_Can_Heat(); This method accepts no parameters Returns a Boolean
Retrieves the state of the Nest indicating whether it can cool $Nest->fetch_Can_Cool(); This method accepts no parameters Returns a Boolean
Retrieves the state of the Nest indicating whether it has a fan $Nest->fetch_Has_Fan(); This method accepts no parameters Returns a Boolean
Retrieves the away state reported by the Nest $Nest->fetch_Away_State(); This method accepts no parameters Returns the away state Returns 0 on failure
Retrieves the country code reported by the Nest $Nest->fetch_Country_Code(); This method accepts no parameters Returns the away state Returns 0 on failure
Retrieves the locale reported by the Nest $Nest->fetch_Locale(); This method accepts no parameters Returns the locale Returns 0 on failure
Retrieves the name reported by the Nest $Nest->fetch_Name(); This method accepts no parameters Returns the name of the thermostat Returns 0 on failure
Retrieves the long name reported by the Nest $Nest->fetch_Long_Name(); This method accepts no parameters Returns the long name of the thermostat Returns 0 on failure
Retrieves the HVAC Mode reported by the Nest as either 'heat' or 'cool' $Nest->fetch_HVAC_Mode(); This method accepts no parameters Returns the HVAC mode Returns 0 on failure
Retrieves the software version reported by the Nest $Nest->fetch_SW_Version(); This method accepts no parameters Returns the software version Returns 0 on failure
Set the target temperature in Celcius $Nest->set_Target_Temperature_C($temperature); This method accepts the following parameters: - $temperature : target temperature in Celcius - Required Returns 1 on success Returns 0 on failure
Set the high target temperature in Celcius $Nest->set_Target_Temperature_high_C($temperature); This method accepts the following parameters: - $temperature : high target temperature in Celcius - Required Returns 1 on success Returns 0 on failure
Set the low target temperature in Celcius $Nest->set_Target_Temperature_low_C($temperature); This method accepts the following parameters: - $temperature : low target temperature in Celcius - Required Returns 1 on success Returns 0 on failure
Set the target temperature in Fahrenheit $Nest->set_Target_Temperature_F($temperature); This method accepts the following parameters: - $temperature : target temperature in Fahrenheit - Required Returns 1 on success Returns 0 on failure
Set the high target temperature in Fahrenheit $Nest->set_Target_Temperature_high_F($temperature); This method accepts the following parameters: - $temperature : high target temperature in Fahrenheit - Required Returns 1 on success Returns 0 on failure
Set the low target temperature in Fahrenheit $Nest->set_Target_Temperature_low_F($temperature); This method accepts the following parameters: - $temperature : low target temperature in Fahrenheit - Required Returns 1 on success Returns 0 on failure
Set the away state of the Nest to either 'home' or 'away' $Nest->set_Away_State($state); This method accepts the following parameters: - $state : away state either 'home' or 'away' - Required Returns 1 on success Returns 0 on failure
shows the contents of the local Nest object in human readable form $Nest->dump_Object(); This method accepts no parameters Returns nothing
Returns the HTTP Header code for the most recent fetch command $Nest->get_last_code(); This method accepts no parameters Returns the numeric code
Returns the HTTP Header reason for the most recent fetch command $Nest->get_last_reason(); This method accepts no parameters Returns the textual reason
Returns the number of milliseconds it took for the last fetch call $Nest->get_last_exec_time(); This method accepts no parameters Returns the number of milliseconds
Kedar Warriner, kedar at cpan.org
kedar at cpan.org
Please report any bugs or feature requests to C<bug-device-Nest at rt.cpan.org> or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Device-Nest I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command. perldoc Device::Nest You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Device-Nest
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Device-Nest
CPAN Ratings
http://cpanratings.perl.org/d/Device-Nest
Search CPAN
http://search.cpan.org/dist/Device-Nest/
Many thanks to: The guys at Nest for creating the Nest Thermostat sensor and developping the API. Everyone involved with CPAN.
Copyright 2014 Kedar Warriner <kedar at cpan.org>. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information.
To install Device::Nest, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::Nest
CPAN shell
perl -MCPAN -e shell install Device::Nest
For more information on module installation, please visit the detailed CPAN module installation guide.