Device::WallyHome::Place - WallyHome REST API Interface - Place
# A Device::WallyHome::Place will always be instantiated from a base Device::WallyHome object. use Device::WallyHome; my $wally = Device::WallyHome->new( token => 'f4379e51-222f-4def-8ee1-edf0b15be3b8', ); my $place = $wally->getPlaceById('qyWIClYakQX8TQxtFv1ypN6c'); # Get a list (ArrayRef) of all sensors my $sensors = $place->sensors(); # Get a single Device::WallyHome::Sensor object by Sensor ID (snid) my $sensor = $place->getSensorBySnid();
Device::WallyHome::Place represents a child class of the Device::WallyHome Perl5 interface for the WallyHome REST API.
Device::WallyHome::Place objects are returned from various methods via a parent Device::WallyHome object and are not intended to be instantiated directly.
my $sensors = $place->sensors();
Returns a list of all sensors associated with the given place. Each sensor returned is a Device::WallyHome::Sensor object.
my $sensor = $place->getSensorById('90-7a-f1-ff-ff-ff');
Returns a single Device::WallyHome::Sensor object matching the passed sensor identifier (snid). If no matching sensor is found, undef will be returned.
undef
# Iterate through a list of sensors, printing the identifier and current temperature for each foreach my $sensor (@$sensors) { printf("%s - %0.2f\n", $sensor->snid(), $sensor->state('TEMP')->value()); }
Chris Hamilton
This software is copyright (c) 2016 by Chris Hamilton.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Please report bugs or enhancement requests on GitHub directly at https://github.com/cjhamil/Device-WallyHome/issues
To install Device::WallyHome, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::WallyHome
CPAN shell
perl -MCPAN -e shell install Device::WallyHome
For more information on module installation, please visit the detailed CPAN module installation guide.