=head1 NAME
power-outlet-json.cgi - Control Power::Outlet device with JSON web service (e.g. Node-Red)
=head1 DESCRIPTION
power-outlet-json.cgi is a CGI application to control a Power::Outlet devic
wer-outlet/power-outlet-json.cgi?name=Lamp;action=off
http://localhost/power-outlet/power-outlet-json.cgi?name=Lamp;action=on
http://localhost/power-outlet/power-outlet-json.cgi?name=Lamp;action=q
uery
http://localhost/power-outlet/power-outlet-json.cgi?name=Lamp;action=switch
Return is a JSON hash with keys status and state. status is OK if there are no errors, state is the state of the sw
#isa JSON Boolean
return $value ? 'ON' : 'OFF';
}
=head2 on
Sends a message to the API to turn the device relay ON
=cut
sub on {
my $self = shift;
my $state_boolean = \1; #JSON true
urn the device relay OFF
=cut
sub off {
my $self = shift;
my $state_boolean = \0; #JSON false
my $response = $self->_WebService_Tuya_IoT_API->device_command_code_value($self->dev
age Power::Outlet::Shelly;
use strict;
use warnings;
use base qw{Power::Outlet::Common::IP::HTTP::JSON};
our $VERSION = '0.50';
=head1 NAME
Power::Outlet::Shelly - Control and query a Shelly GIPO R
Floor
$ power-outlet Config ON section Kitchen
$ curl http://127.0.0.1/cgi-bin/power-outlet-json.cgi?name=Kitchen;action=ON
=head1 CONSTRUCTOR
=head2 new
my $outlet = Power::Outlet->new(typ
$url->query_form(%param);
my $hash = $self->json_request(GET => $url); #isa HASH
die('Error: Method _call failed to return expected JSON format') unless ref($hash) eq 'HASH';
return $has
e strict;
use warnings;
use Data::Dumper qw{Dumper};
use base qw{Power::Outlet::Common::IP::HTTP::JSON};
our $VERSION = '0.50';
=head1 NAME
Power::Outlet::Hue - Control and query a Philips Hue ligh
rl; #isa URI from Power::Outlet::Common::IP::HTTP
$url->path($self->_path);
my $res = $self->json_request(GET => $url); #isa perl structure
return $res->{"name"}; #isa string
}
=head1 METHODS
er::Outlet::Common::IP::HTTP
$url->path($self->_path);
#web request
my $res = $self->json_request(GET => $url); #isa perl structure
#Response is an ARRAY on error and a HASH on succe
5m
public_key_file => 'suffitauth_pub.key',
userfile_format => 'user-%s.json',
});
# . . .
}
... configuration:
# SuffitAuth Client configuration
=head2 userfile_format
userfile_format => 'u.%s.json'
This option sets default format of userdata authorization filename
Default: 'u.%s.json'
=head1 HELPERS
This plugin provides the following
}
This helper performs authentication backend subprocess and returns
result object (L<Mojo::JSON::Pointer>) that contains data structure:
{
error => '', # Error messa
ge Power::Outlet::Tasmota;
use strict;
use warnings;
use base qw{Power::Outlet::Common::IP::HTTP::JSON};
our $VERSION = '0.50';
=head1 NAME
Power::Outlet::Tasmota - Control and query a Tasmota GIPO
sh = $self->json_request(GET => $url); #isa HASH
#{"POWER1":"OFF"}
#{"Command":"Unknown"}
#{"WARNING":"Enter command cmnd="}
die("Error: Method _get failed to return expected JSON object") un
t::SonoffDiy;
use strict;
use warnings;
use base qw{Power::Outlet::Common::IP::HTTP::JSON};
use JSON qw{decode_json};
our $VERSION = '0.50';
=head1 NAME
Power::Outlet::SonoffDiy - Control and query
'The operation failed and the request was formatted incorrectly. The request body is not a valid JSON format.',
'401' => 'The operation failed and the request was unauthorized. D
Power::Outlet::Common::IP::HTTP
$url->path($path);
#print "$url\n";
my $hash = $self->json_request(POST => $url, $payload); #isa HASH
#{"seq":16,"error":0}
#{"seq":17,"error":0,"data":
::SuccessfulResponseAsObject;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON::MaybeXS qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
f = shift;
my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
return $_hash;
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $
serialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
my $_is_nullable = ($self->openapi_nullable->{
onseLinksGetAllServicesLinks;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON::MaybeXS qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
f = shift;
my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
return $_hash;
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $
serialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
my $_is_nullable = ($self->openapi_nullable->{
esCloud::Object::AlphaFloorEffect;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::
{ $args_key } );
}
$self->{ type } = 'AlphaFloor';
return $self;
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
foreach my $_key (keys %{$self->a
tent-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$he
tent-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$he
tent-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$he
/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json
tent-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$he
tent-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$he
##############
use JSON::Relaxed qw();
use JSON::XS qw();
use File::LoadLines;
use Encode qw(decode_utf8);
binmode STDOUT => ':utf8';
binmode STDERR => ':utf8';
my $parser = JSON::Relaxed::Parser->n
> "soft" };
my $json = loadlines( $file, $opts );
die( "$file: $opts->{error}\n") if $opts->{error};
my $data = $parser->decode($json);
if ( $parser->is_error ) {
warn( "$file: JSON error: ", $par
ser->err_msg, "\n" );
next;
}
my $writer = JSON::XS->new->canonical->utf8(0)->pretty($test)->convert_blessed;
if ( $output && $output ne "-" ) {
open( my $fd, '>:utf8', $output )
or die
erimental::signatures';
# Package name.
my $my_package = 'JSON::Relaxed';
# Program name and version.
my ($my_name, $my_version) = qw( rrjson 0.03 );
################ Command line parameters #######
#########
use Getopt::Long 2.13;
# Command line options.
my $mode = "rrjson";
my $execute; # direct JSON from command line
my $schema; # schema (optional)
# Parser options.
my $strict;
my $pret
n/../lib";
use JSON::Relaxed;
use JSON::PP;
use File::LoadLines;
use Encode qw(decode_utf8);
binmode STDOUT => ':utf8';
binmode STDERR => ':utf8';
if ( $schema ) {
my $parser = JSON::Relaxed::Par
::signatures';
use Readonly;
use Carp qw(croak);
use Data::UUID;
use Mojo::File;
use Mojo::JSON qw(decode_json);
use Mojo::UserAgent;
use OIDC::Client::ResponseParser;
use OIDC::Client::TokenResponseP
ey ($self) {
if (my $private_jwk_file = $self->private_jwk_file) {
my $private_jwk = decode_json(Mojo::File->new($private_jwk_file)->slurp);
return $private_jwk;
}
elsif (my $private_jwk
}
$ua->on(start => sub {
my ($ua, $tx) = @_;
$tx->req->headers->accept('application/json');
});
return $ua;
}
sub _build_claim_mapping ($self) {
return $self->config->{claim_mapp
:ApiDiscoveryResponseProduct;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON::MaybeXS qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
f = shift;
my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
return $_hash;
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $
serialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
my $_is_nullable = ($self->openapi_nullable->{
000;
use strict;
use warnings;
use utf8;
use Carp();
use Moo;
use HTTP::Tiny;
use JSON::PP qw(encode_json decode_json);
use Net::Gotify::Application;
use Net::Gotify::Client;
use Net::Gotify::Error;
verify_SSL => $self->verify_ssl,
default_headers => {'Content-Type' => 'application/json', 'X-Gotify-Key' => $self->_get_token($token_type)},
agent => sprintf('%s/%s',
ete @$data{grep { not defined $data->{$_} } keys %{$data}};
$options = {content => encode_json($data)};
}
my $response = $ua->request($method, $url, $options);
if (my $logger = $
be part of this???
hash keys. Setting/getting them employs a serialization method, by default JSON???
B<uplevel should allow execution AFTER the group is closed>
There should be an indicator
use strict;
use warnings;
use Cpanel::JSON::XS;
my $true_ref = \&Cpanel::JSON::XS::true;
my $false_ref = \&Cpanel::JSON::XS::false;
ApiDiscoveryResponseCustomer;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON::MaybeXS qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
f = shift;
my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
return $_hash;
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $
serialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
my $_is_nullable = ($self->openapi_nullable->{