NAME

Device::WallyHome::Place - WallyHome REST API Interface - Place

SYNOPSIS

# 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();

DESCRIPTION

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.

Methods

sensors
my $sensors = $place->sensors();

Returns a list of all sensors associated with the given place. Each sensor returned is a Device::WallyHome::Sensor object.

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

EXAMPLES

# 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());
}

AUTHOR

Chris Hamilton

COPYRIGHT AND LICENSE

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.

BUG REPORTING, ENHANCEMENT/FEATURE REQUESTS

Please report bugs or enhancement requests on GitHub directly at https://github.com/cjhamil/Device-WallyHome/issues