2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

69_SoftliqCloud.pm: Added "realtime_error" if Cloud-Connection fails

git-svn-id: https://svn.fhem.de/fhem/trunk@27003 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
KernSani 2023-01-08 13:21:45 +00:00
parent fb16612ec6
commit fb4789262a

View File

@ -1182,7 +1182,7 @@ sub parseInfo {
my $data = $cdata[0];
Log3 $name, LOG_DEBUG, Dumper($data);
if ( defined( $data->{error} ) ) {
if ( $data->{error} ) {
readingsBeginUpdate($hash);
readingsBulkUpdate( $hash, "error", $data->{error} );
readingsBulkUpdate( $hash, "error_description", $data->{error_description} );
@ -1426,6 +1426,12 @@ sub parseWebsocketId {
readingsEndUpdate( $hash, 1 );
return;
}
else {
readingsBeginUpdate($hash);
readingsBulkUpdate( $hash, "realtime_error","ok");
readingsEndUpdate( $hash, 1 );
}
$hash->{helper}{wsId} = $data->{connectionId};
return if ( !$data->{connectionId} );
@ -1484,6 +1490,27 @@ sub parseRealtime {
my $hash = $param->{hash};
my $name = $hash->{NAME};
my $data;
Log3 $name, LOG_RECEIVE, qq($err / $json);
if ($json ne $EMPTY) {
$data = safe_decode_json( $hash, $json );
Log3 $name, LOG_DEBUG, Dumper($data);
}
if ( defined( $data->{error}{type} ) ) {
readingsBeginUpdate($hash);
readingsBulkUpdate( $hash, "realtime_error",$data->{error}{type} );
readingsEndUpdate( $hash, 1 );
return;
}
else {
readingsBeginUpdate($hash);
readingsBulkUpdate( $hash, "realtime_error","ok");
readingsEndUpdate( $hash, 1 );
}
return;
}
### stolen from HTTPMOD
@ -2015,7 +2042,7 @@ sub wsReadDevIo {
}
foreach my $bufi (@bufs) {
Log3( $name, LOG_RECEIVE, "[$name] - Extracted" . $bufi );
Log3( $name, LOG_RECEIVE, "[$name] - Extracted: " . $bufi );
parseWebsocketRead( $hash, $bufi );
}