NAME

App::OpenHAP::Tasmota::Lightbulb - Tasmota light HAP accessory

SYNOPSIS

use App::OpenHAP::Tasmota::Lightbulb;

my $light = App::OpenHAP::Tasmota::Lightbulb->new(
    aid => 4,
    name => 'Living Room Light',
    mqtt_topic => 'tasmota_445566',
    mqtt_client => $mqtt,
    capabilities => App::OpenHAP::Tasmota::Lightbulb::CAP_DIMMER
        | App::OpenHAP::Tasmota::Lightbulb::CAP_COLOR,
);

DESCRIPTION

This module implements a HAP Lightbulb accessory for a Tasmota light. It is an App::OpenHAP::Tasmota::Device, so it inherits the MQTT subscriptions and the availability state.

The accessory always publishes the On characteristic. The other characteristics follow the capability flags, because a controller that sees a characteristic expects the device to answer it.

CAPABILITY FLAGS

capabilities is a bit mask. The default is CAP_DIMMER.

CAP_DIMMER (1)

The light dims. The accessory adds Brightness, and it drives the Tasmota Dimmer command.

CAP_COLOR (2)

The light has color. The accessory adds Hue and Saturation, and it drives the Tasmota HSBColor command.

CAP_CT (4)

The light has an adjustable white. The accessory adds ColorTemperature, and it drives the Tasmota CT command.

CHARACTERISTICS

On

The power state. It follows POWER in the state messages, and a write publishes a power command.

Brightness

A percentage from 0 to 100, which is also the Tasmota Dimmer range. No conversion is necessary.

Hue

Degrees from 0 to 360, and Saturation is a percentage from 0 to 100. Both come from the Tasmota HSBColor triple, and a write publishes the whole triple: Tasmota takes hue, saturation, and brightness together.

ColorTemperature

Mireds from 153 to 500. That is the Tasmota CT range as well, so the value passes through, clamped at both ends.

SEE ALSO

App::OpenHAP::Tasmota::Device, Protocol::HAP::Characteristic, spec/HAP-Characteristics.md, spec/MQTT-Control.md