mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 02:10:32 +00:00
98_vitoconnect: Buxfix Releasex
git-svn-id: https://svn.fhem.de/fhem/trunk@20566 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
7f00dc71e1
commit
8a6220c472
@ -134,6 +134,11 @@
|
||||
#
|
||||
# 2019-09-07 Readings werden wieder erzeugt auch wenn sich der Wert nicht ändert
|
||||
#
|
||||
# 2019-11-23 Readings für "heating.power.consumption.total.*" hinzugefügt. Scheint identisch mit "heating.power.consumption.*"
|
||||
# Behoben: Readings wurden nicht mehr aktualisiert, wenn in getResourceCallback die Resource nicht als JSON interpretiert werden konnte (Forum: #390)
|
||||
# Behoben: vitoconnect bringt FHEM zum Absturz in Zeile 1376 (Forum: #391)
|
||||
# Überwachung der Aktualität: Zeitpunkt des letzten Updates wird in State angezeigt (Forum #397)
|
||||
#
|
||||
# ToDo: timeout konfigurierbar machen
|
||||
# "set"s für Schedules zum Steuern der Heizung implementieren
|
||||
# Nicht bei jedem Lesen neu einloggen (wenn möglich)
|
||||
@ -142,7 +147,7 @@
|
||||
# "sinnvolle" Readings statt 1:1 aus der API übernommene
|
||||
# mapping der Readings optional machen
|
||||
# Mehrsprachigkeit
|
||||
# Auswerten der Reading in getCode usw.
|
||||
# Auswerten der Readings in getCode usw.
|
||||
# devices/0 ? Was, wenn es mehrere Devices gibt?
|
||||
# vitoconnect_Set effizienter implementieren
|
||||
# nach einem set Befehl Readings aktualisieren, vorher alten Timer löschen
|
||||
@ -361,6 +366,12 @@ my $RequestList = {
|
||||
"heating.power.consumption.week" => "Stromverbrauch/Woche",
|
||||
"heating.power.consumption.year" => "Stromverbrauch/Jahr",
|
||||
"heating.power.consumption.unit" => "Stromverbrauch/Einheit",
|
||||
"heating.power.consumption.total.day" => "Stromverbrauch_Total/Tag",
|
||||
"heating.power.consumption.total.month" => "Stromverbrauch_Total/Monat",
|
||||
"heating.power.consumption.total.week" => "Stromverbrauch_Total/Woche",
|
||||
"heating.power.consumption.total.year" => "Stromverbrauch_Total/Jahr",
|
||||
"heating.power.consumption.total.unit" => "Stromverbrauch_Total/Einheit",
|
||||
|
||||
"heating.sensors.temperature.outside.status" => "Aussen_Status",
|
||||
"heating.sensors.temperature.outside.statusWired" => "Aussen_StatusWired",
|
||||
"heating.sensors.temperature.outside.statusWireless" => "Aussen_StatusWireless",
|
||||
@ -1168,7 +1179,6 @@ sub vitoconnect_getCode($) {
|
||||
method => "POST",
|
||||
callback => \&vitoconnect_getCodeCallback
|
||||
};
|
||||
|
||||
#Log3 $name, 4, "$name: user=$param->{user} passwd=$param->{pwd}";
|
||||
# Log3 $name, 5, Dumper($hash);
|
||||
HttpUtils_NonblockingGet($param);
|
||||
@ -1199,9 +1209,7 @@ sub vitoconnect_getCodeCallback ($) {
|
||||
if ($hash->{login} eq "ok") {
|
||||
vitoconnect_getAccessToken($hash);
|
||||
} else {
|
||||
readingsBeginUpdate($hash);
|
||||
readingsBulkUpdate($hash, "state", "login failure" );
|
||||
readingsEndUpdate($hash, 1);
|
||||
readingsSingleUpdate($hash, "state", "login failure", 1);
|
||||
Log3 $name, 1, "$name: Login failure";
|
||||
# neuen Timer starten in einem konfigurierten Interval.
|
||||
InternalTimer(gettimeofday()+$hash->{intervall}, "vitoconnect_GetUpdate", $hash);
|
||||
@ -1292,7 +1300,7 @@ sub vitoconnect_getGwCallback($) {
|
||||
|
||||
my $aggregatedStatus = $decode_json->{entities}[0]->{properties}->{aggregatedStatus};
|
||||
Log3 $name, 5, "$name: aggregatedStatus: $aggregatedStatus";
|
||||
readingsSingleUpdate($hash, "state", $aggregatedStatus, 1);
|
||||
readingsSingleUpdate($hash, "state", "$aggregatedStatus (".TimeNow().")", 1);
|
||||
|
||||
my $installation = $decode_json->{entities}[0]->{properties}->{id};
|
||||
Log3 $name, 5, "$name: installation: $installation";
|
||||
@ -1337,7 +1345,9 @@ sub vitoconnect_getResourceCallback($) {
|
||||
Log3 $name, 4, "$name - getResourceCallback went ok";
|
||||
Log3 $name, 5, "Received response: $response_body\n";
|
||||
my $decode_json = eval{decode_json($response_body)};
|
||||
if($@) { Log3 $name, 1, "$name - JSON error while request: $@";
|
||||
if($@) {
|
||||
Log3 $name, 1, "$name - JSON error while request: $@";
|
||||
InternalTimer(gettimeofday()+$hash->{intervall}, "vitoconnect_GetUpdate", $hash);
|
||||
return; }
|
||||
my $items = $decode_json;
|
||||
|
||||
@ -1373,9 +1383,11 @@ sub vitoconnect_getResourceCallback($) {
|
||||
readingsBulkUpdate($hash, $Reading, $Value);
|
||||
Log3 $name, 5, "$FieldName".".$Key: $Value ($Type)";
|
||||
} elsif ( $Type eq "array" ) {
|
||||
if ( defined($Value) ) {
|
||||
my $Array = join(",", @$Value);
|
||||
readingsBulkUpdate($hash, $Reading, $Array);
|
||||
Log3 $name, 5, "$FieldName".".$Key: $Array ($Type)";
|
||||
}
|
||||
} elsif ( $Type eq "boolean" ) {
|
||||
readingsBulkUpdate($hash, $Reading, $Value);
|
||||
Log3 $name, 5, "$FieldName".".$Key: $Value ($Type)";
|
||||
@ -1395,14 +1407,9 @@ sub vitoconnect_getResourceCallback($) {
|
||||
readingsBulkUpdate($hash, $Reading, $Result);
|
||||
Log3 $name, 5, "$FieldName".".$Key: $Result ($Type)";
|
||||
} elsif ( $Type eq "ErrorListChanges" ) {
|
||||
# not implemented yet
|
||||
#readingsBulkUpdate($hash, $Reading, "ErrorListChanges");
|
||||
#Log3 $name, 5, "$FieldName".".$Key: $Value ($Type)";
|
||||
|
||||
my $Result = encode_json($Value);
|
||||
readingsBulkUpdate($hash, $Reading, $Result);
|
||||
Log3 $name, 5, "$FieldName".".$Key: $Result ($Type)";
|
||||
|
||||
} else {
|
||||
readingsBulkUpdate($hash, $Reading, "Unknown: $Type");
|
||||
Log3 $name, 5, "$FieldName".".$Key: $Value ($Type)";
|
||||
|
Loading…
x
Reference in New Issue
Block a user