The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Device::WallyHome::Sensor - WallyHome REST API Interface - Sensor

SYNOPSIS

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

DESCRIPTION

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.

Methods

thresholds
    my $thresholds = $sensor->thresholds();

Returns a list of all thresholds associated with the given sensor. Each threshold returned is a Device::WallyHome::Threshold object.

threshold (thresholdAbbreviation)
    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:

RH Relative Humidity
TEMP Temperature
states
    my $states = $sensor->states();

Returns a list of all states associated with the given sensor. Each state returned is a Device::WallyHome::State object.

state (stateAbbreviation)
    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:

RH Relative Humidity
TEMP Temperature
LEAK Water Leak
SENSOR Sensor
COND Condition

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