NAME
Protocol::IR::Format::Wig - HAIR wig JSON import and export
VERSION
version 1.0
SYNOPSIS
use Protocol::IR::Converter;
my $converter = Protocol::IR::Converter->new();
my @codes = @{ $converter->import_format('CSV', 'remote.csv') };
# Export Protocol::IR::Code objects to a HAIR hair-wig/3 JSON document
my $wig = $converter->export_codes('wig', \@codes,
name => 'Tigersecu DVR',
brand => 'Tigersecu',
model => 'TS-1080',
kind => 'dvr',
notes => 'Converted from the IRDB sample set',
);
# Import a wig (file path or JSON string) back into Protocol::IR::Code objects
my $imported = $converter->import_format('wig', 'remote.wig.json');
for my $code (@$imported) {
print $code->alias . " (" . $code->protocol . ")\n";
}
DESCRIPTION
wig is the portable IR code set format used by the HAIR Home Assistant integration (https://github.com/DAB-LABS/HAIR): one JSON file, one remote, raw Pronto hex as the payload.
Protocol::IR::Format::Wig emits hair-wig/3, the current recipe major: every signal carries an explicit ditto_count and bypass_protocol, plus an optional send_count (how many times the whole signal transmits per press) when a code carries a repeat count other than the default. On import, signals are decoded fresh through the registered protocols (the file never carries decoded fields), and each signal's transmit recipe is kept on the resulting Protocol::IR::Code. Formats hair-wig/1 through hair-wig/3 are accepted on import.
METHODS
export
my $json = $class->export($codes, $registry, %opts);
Serializes one Protocol::IR::Code or an arrayref of them into a hair-wig/3 JSON document. Options:
name-- remote name (required by the format; default'Untitled')brand,model,kind,notes-- optional remote metadataorigin-- provenance string; defaults to'converted by Protocol::IR::Converter'wig_id-- identity UUID (default: a freshly minted v4 UUID)format-- format major to emit (default:hair-wig/3)
decode
my $codes = $class->decode($input, $registry);
Parses a wig file path or JSON string and returns an arrayref of Protocol::IR::Code objects. alias, ditto_count, bypass_protocol, and send_count when present are preserved on each code. Dies if the JSON is invalid, the format is unsupported, or a signal's Pronto payload cannot be decoded.
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.