The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

AVM::AHA::Switch - Object representing an AHA managed switch/actor

SYNOPSIS

   # Parent object for doing the HTTP communication
   my $aha = new AVM::AHA("fritz.box","s!cr!t");

   # Switch represented by the $ain which can be a name or a real AIN 
   my $switch = new AVM::AHA::Switch($aha,$ain)

   # Obtain all switches from a list operation
   for my $switch (@{$aha->list()}) {
       say $switch->name(),": ",$switch->is_on();
   }
   

DESCRIPTION

This module represents an actor/switch for the AVM home automation system. It encapsulated an actor with a certain AIN and provides all methods as described in "AVM::AHA" with the difference, that not AIN is required, since this has been already provided during the construction of this object.

METHODS

$switch = new AVM::AHA::Switch($aha,$ain)

Create a new switch object. The first object must be an "AVM::AHA" instance, which is responsible for the HTTP communication. The second argument Many must be an 8-digit AIN (actor id) or a symbolic name. This symbolic name can be configured in the admin UI of the Fritz Box.

$ain = $switch->ain()

Get the AIN which this object represents.

$switch->is_on()
$switch->is_present()
$switch->on()
$switch->off()
$switch->energy()
$switch->power()
$switch->name()

Same as the corresponding method in "AVM::AHA" with the exception, that no $ain argument is required since it already has been given during construction time