add more powerwall readings
This commit is contained in:
parent
ccefae7ee6
commit
39070d643d
@ -715,39 +715,58 @@ sub ReadingsProcessing_Powerwalls {
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my %readings;
|
my %readings;
|
||||||
|
|
||||||
if ( ref( $decode_json->{powerwalls} ) eq 'ARRAY'
|
if ( ref($decode_json) eq 'HASH' ) {
|
||||||
&& scalar( @{ $decode_json->{powerwalls} } ) > 0 )
|
for (keys %{$jsondata}) {
|
||||||
{
|
$readings{$_} = $jsondata->{$_}
|
||||||
my $i = 0;
|
if ( ref($jsondata->{$_}) ne 'ARRAY'
|
||||||
for my $powerwall ( @{ $decode_json->{powerwalls} } ) {
|
and defined($jsondata->{$_}) );
|
||||||
if ( ref($powerwall) eq 'HASH' ) {
|
|
||||||
while ( my ($r,$v) = each %{$powerwall} ) {
|
if ( ref($jsondata->{$_}) eq 'ARRAY' ) {
|
||||||
$readings{ 'wall_' . $i . '_' . $r } = $v
|
my $i = 0;
|
||||||
if ( ref($v) ne 'HASH' );
|
my $r1 = $_;
|
||||||
|
for my $hRef (@{$jsondata->{$_}}) {
|
||||||
|
for (keys %{$hRef}) {
|
||||||
|
$r1 =~ s/s$//g;
|
||||||
|
$readings{qq(${r1}_${i}_${_})} = $hRef->{$_}
|
||||||
|
if ( ref($hRef->{$_}) ne 'ARRAY'
|
||||||
|
and ref($hRef->{$_}) ne 'HASH'
|
||||||
|
and defined($hRef->{$_}) );
|
||||||
|
|
||||||
|
if ( ref($hRef->{$_}) eq 'HASH' ) {
|
||||||
|
my $r2 = $_;
|
||||||
|
my $r3 = $hRef->{$_};
|
||||||
|
for (keys %{$r3}) {
|
||||||
|
$readings{qq(${r1}_${i}_${r2}_${_})} = $r3->{$_}
|
||||||
|
if ( ref($r3->{$_}) ne 'ARRAY'
|
||||||
|
and defined($r3->{$_}) );
|
||||||
|
|
||||||
# if ( ref($v) eq 'HASH' ) {
|
if ( ref($r3->{$_}) eq 'ARRAY' ) {
|
||||||
# while ( my ( $s, $ts ) = each %{$v} ) {
|
my $ii = 0;
|
||||||
# if ( ref( $ts ) eq 'ARRAY'
|
my $r4 = $_;
|
||||||
# && scalar( @{ $ts } ) > 0 )
|
for $hRef (@{$r3->{$_}}) {
|
||||||
# {
|
for (keys %{$hRef}) {
|
||||||
# my $j = 0;
|
$r4 =~ s/s$//g;
|
||||||
# for my $t ( @{ $ts } ) {
|
$readings{qq(${r1}_${i}_${r2}_${r4}_${ii}_${_})} = $hRef->{$_}
|
||||||
# $readings{ 'wall_' . $i . '_' . $r . '_' . $s . '_' . $j } = $t;
|
if ( ref($hRef->{$_}) ne 'HASH'
|
||||||
# $j++;
|
and defined($hRef->{$_}) );
|
||||||
# }
|
}
|
||||||
# }
|
|
||||||
# }
|
$ii++
|
||||||
# }
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$readings{'numberOfWalls'} = $i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$readings{'numberOfWalls'} = $i;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$readings{'error'} = 'aggregates response is not a Array';
|
$readings{'error'} = 'powerwalls response is not a Hash';
|
||||||
}
|
}
|
||||||
|
|
||||||
return \%readings;
|
return \%readings;
|
||||||
@ -1095,7 +1114,7 @@ sub Rename {
|
|||||||
],
|
],
|
||||||
"release_status": "stable",
|
"release_status": "stable",
|
||||||
"license": "GPL_2",
|
"license": "GPL_2",
|
||||||
"version": "v1.0.5",
|
"version": "v1.0.6",
|
||||||
"author": [
|
"author": [
|
||||||
"Marko Oldenburg <leongaultier@gmail.com>"
|
"Marko Oldenburg <leongaultier@gmail.com>"
|
||||||
],
|
],
|
||||||
|
@ -1 +1 @@
|
|||||||
UPD 2021-03-05_10:54:12 31392 FHEM/46_TeslaPowerwall2AC.pm
|
UPD 2021-03-08_20:13:47 32353 FHEM/46_TeslaPowerwall2AC.pm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user