NAME
Protocol::IR::Format::Tasmota - Tasmota RawData import and IRSend export
VERSION
version 0.08
SYNOPSIS
use Protocol::IR::Converter;
my $converter = Protocol::IR::Converter->new();
# Decode a Tasmota IR log capture (compact letter-coded RawData)
my $capture = "+9185-4490+650-500+655dE-1630C-505+630-525Ed...";
my $code = $converter->import_format('Tasmota', $capture)->[0];
print $code->protocol; # NEC
print $code->data; # Tasmota DataLSB value
# Re-export as a Tasmota IRSend command (comma style with carrier)
my $irsend = $converter->export_code($code, 'Tasmota',
style => 'comma', frequency => 38000);
# IRSend 38000,9185,4490,650,...
# Compact letter-coded style is the default
my $compact = $converter->export_code($code, 'Tasmota');
# IRSend 0,+9185-4490+650-500+655dE-...
DESCRIPTION
Protocol::IR::Format::Tasmota imports Tasmota "RawData" IR captures and exports Tasmota IRSend commands.
Decode input forms
decode accepts the content of a Tasmota RawData field in any of these forms:
The compact letter-compressed form (
+8570-4240+550-1580C-510+565-1565F-505Fh...). Each new timing magnitude gets the next letter (A-Z) in order of first appearance; a repeated value is written as its letter, uppercase for a mark and lowercase for a space. Magnitudes are multiples of 5 microseconds. Values beyond the 26 letter table are written numerically every time they occur.A plain comma-separated mark/space list (
926,844,958,...).A full
IRSend <freq>,<rawdata>command line.An arrayref of integer timings, alternating mark, space, mark, ...
A protocol-structured IRrecv line (
IRrecv: Protocol = NEC, Bits = 32, Data = 0x10EF00FF), possibly with a timestamp prefix. The line imports through the named protocol rather than by timing decode.
The timings are decoded to microsecond mark/space pairs and tried against every registered protocol. The resulting Protocol::IR::Code keeps the raw timings on the timings accessor so the signal can be re-exported losslessly, even when no protocol matches (the code's protocol is then UNKNOWN).
A protocol-structured line and a raw-data signal that decodes to a known protocol get their alias set to the signal's Data hex value (e.g. 0x10EF00FF, width-matched to the protocol's bit count), so a WIG built from them carries editable button names.
Decoding a full console dump
decode treats input containing newlines as a Tasmota console dump and splits it into one signal per line. Each line may be protocol-structured, a RawData line (compact or comma form), or an IRsend command line; timestamps and other log noise are ignored. Lines that fail to decode to a registered protocol are dropped. decode_dump performs the same split explicitly.
Export forms
export produces a Tasmota IRSend command:
IRSend <frequency>,<rawdata>
The rawdata is the compact letter-coded form by default, or the comma-separated mark/space list with style => 'comma'. When the code was decoded from Tasmota data its original timings are reused; otherwise they are derived by round-tripping the code through the protocol encoder's Pronto output, so the emitted timings match the other timing formats exactly.
METHODS
decode
my $codes = $class->decode($input, $registry);
Returns an arrayref containing one Protocol::IR::Code per captured signal. A single Tasmota RawData string or protocol-structured line yields a single code; multi-line input is split into one code per signal (see "Decoding a full console dump").
decode_dump
my $codes = $class->decode_dump($dump_text, $registry);
Splits a Tasmota console dump (any mix of protocol-structured, RawData, and IRsend lines) into one Protocol::IR::Code per decodable signal. Lines that do not decode to a registered protocol are dropped; every returned code carries a Data-hex alias.
export
my $cmd = $class->export($ir_code, $registry, %opts);
Serializes an Protocol::IR::Code (or a single-element arrayref) into an IRSend command. Options:
style--'compact'(default) or'comma'.frequency-- carrier frequency in Hz to embed in the command (default0).
SUPPORT
Source code: https://github.com/bwarden/perl-protocol-ir
Bug reports and feature requests: https://github.com/bwarden/perl-protocol-ir/issues
AUTHOR
Brett T. Warden <bwarden@cpan.org>
COPYRIGHT AND LICENSE
Copyright (c) 2026 Brett T. Warden
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.