Device::WallyHome::Sensor - WallyHome REST API Interface - Sensor
# A Device::WallyHome::Sensor will always be instantiated from a parent Device::WallyHome::Place object. use Device::WallyHome; my $wally = Device::WallyHome->new( token => 'f4379e51-222f-4def-8ee1-edf0b15be3b8', ); my $place = $wally->getPlaceById('qyWIClYakQX8TQxtFv1ypN6c'); my $sensor = $place->getSensorBySnid('90-7a-f1-ff-ff-ff'); # Get sensor thresholds my $temperatureMin = $sensor->threshold('TEMP')->min(); my $temperatureMax = $sensor->threshold('TEMP')->max(); my $relativeHumidityMin = $sensor->threshold('RH')->min(); my $relativeHumidityMax = $sensor->threshold('RH')->max(); # Check sensor values my $currentTemperature = $sensor->state('TEMP')->value(); my $currentRelativeHumidity = $sensor->state('RH')->value(); my $currentLeak = $sensor->state('LEAK')->value();
Device::WallyHome::Sensor represents a child class of the Device::WallyHome Perl5 interface for the WallyHome REST API.
Device::WallyHome::Sensor objects are returned from various methods via a parent Device::WallyHome::Place object and are not intended to be instantiated directly.
my $thresholds = $sensor->thresholds();
Returns a list of all thresholds associated with the given sensor. Each threshold returned is a Device::WallyHome::Threshold object.
my $threshold = $sensor->threshold('TEMP');
Returns a single Device::WallyHome::Threshold object matching the passed threshold name. The threshold name must be a valid value from the following list:
my $states = $sensor->states();
Returns a list of all states associated with the given sensor. Each state returned is a Device::WallyHome::State object.
my $state = $sensor->state('TEMP');
Returns a single Device::WallyHome::State object matching the passed state name. The state name must be a valid value from the following list:
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.