mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
vitoconnect: Bugfix und Geofence-Readingsx
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@20824 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1ee28b6293
commit
0cf3fb5191
@ -139,6 +139,9 @@
|
|||||||
# Behoben: vitoconnect bringt FHEM zum Absturz in Zeile 1376 (Forum: #391)
|
# 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)
|
# Überwachung der Aktualität: Zeitpunkt des letzten Updates wird in State angezeigt (Forum #397)
|
||||||
#
|
#
|
||||||
|
# 2019-12-25 heating.solar.power.cumulativeProduced.value, heating.circuits.X.geofencing.active, heating.circuits.X.geofencing.status hinzugefügt
|
||||||
|
# Behoben: Readings wurden nicht mehr aktualisiert, wenn Resource an weiteren Stellen nicht als JSON interpretiert werden konnte(Forum: #390)
|
||||||
|
#
|
||||||
# ToDo: timeout konfigurierbar machen
|
# ToDo: timeout konfigurierbar machen
|
||||||
# "set"s für Schedules zum Steuern der Heizung implementieren
|
# "set"s für Schedules zum Steuern der Heizung implementieren
|
||||||
# Nicht bei jedem Lesen neu einloggen (wenn möglich)
|
# Nicht bei jedem Lesen neu einloggen (wenn möglich)
|
||||||
@ -205,6 +208,8 @@ my $RequestList = {
|
|||||||
"heating.circuits.0.circulation.schedule.active" => "HK1-Zeitsteuerung_Zirkulation_aktiv",
|
"heating.circuits.0.circulation.schedule.active" => "HK1-Zeitsteuerung_Zirkulation_aktiv",
|
||||||
"heating.circuits.0.circulation.schedule.entries" => "HK1-Zeitsteuerung_Zirkulation",
|
"heating.circuits.0.circulation.schedule.entries" => "HK1-Zeitsteuerung_Zirkulation",
|
||||||
"heating.circuits.0.frostprotection.status" => "HK1-Frostschutz_Status",
|
"heating.circuits.0.frostprotection.status" => "HK1-Frostschutz_Status",
|
||||||
|
"heating.circuits.0.geofencing.active" => "HK1-Geofencing",
|
||||||
|
"heating.circuits.0.geofencing.status" => "HK1-Geofencing_Status",
|
||||||
"heating.circuits.0.heating.curve.shift" => "HK1-Heizkurve-Niveau",
|
"heating.circuits.0.heating.curve.shift" => "HK1-Heizkurve-Niveau",
|
||||||
"heating.circuits.0.heating.curve.slope" => "HK1-Heizkurve-Steigung",
|
"heating.circuits.0.heating.curve.slope" => "HK1-Heizkurve-Steigung",
|
||||||
"heating.circuits.0.heating.schedule.active" => "HK1-Zeitsteuerung_Heizung_aktiv",
|
"heating.circuits.0.heating.schedule.active" => "HK1-Zeitsteuerung_Heizung_aktiv",
|
||||||
@ -245,6 +250,8 @@ my $RequestList = {
|
|||||||
"heating.circuits.1.circulation.schedule.active" => "HK2-Zeitsteuerung_Zirkulation_aktiv",
|
"heating.circuits.1.circulation.schedule.active" => "HK2-Zeitsteuerung_Zirkulation_aktiv",
|
||||||
"heating.circuits.1.circulation.schedule.entries" => "HK2-Zeitsteuerung_Zirkulation",
|
"heating.circuits.1.circulation.schedule.entries" => "HK2-Zeitsteuerung_Zirkulation",
|
||||||
"heating.circuits.1.frostprotection.status" => "HK2-Frostschutz_Status",
|
"heating.circuits.1.frostprotection.status" => "HK2-Frostschutz_Status",
|
||||||
|
"heating.circuits.1.geofencing.active" => "HK2-Geofencing",
|
||||||
|
"heating.circuits.1.geofencing.status" => "HK2-Geofencing_Status",
|
||||||
"heating.circuits.1.heating.curve.shift" => "HK2-Heizkurve-Niveau",
|
"heating.circuits.1.heating.curve.shift" => "HK2-Heizkurve-Niveau",
|
||||||
"heating.circuits.1.heating.curve.slope" => "HK2-Heizkurve-Steigung",
|
"heating.circuits.1.heating.curve.slope" => "HK2-Heizkurve-Steigung",
|
||||||
"heating.circuits.1.heating.schedule.active" => "HK2-Zeitsteuerung_Heizung_aktiv",
|
"heating.circuits.1.heating.schedule.active" => "HK2-Zeitsteuerung_Heizung_aktiv",
|
||||||
@ -285,6 +292,8 @@ my $RequestList = {
|
|||||||
"heating.circuits.2.circulation.schedule.active" => "HK3-Zeitsteuerung_Zirkulation_aktiv",
|
"heating.circuits.2.circulation.schedule.active" => "HK3-Zeitsteuerung_Zirkulation_aktiv",
|
||||||
"heating.circuits.2.circulation.schedule.entries" => "HK3-Zeitsteuerung_Zirkulation",
|
"heating.circuits.2.circulation.schedule.entries" => "HK3-Zeitsteuerung_Zirkulation",
|
||||||
"heating.circuits.2.frostprotection.status" => "HK3-Frostschutz_Status",
|
"heating.circuits.2.frostprotection.status" => "HK3-Frostschutz_Status",
|
||||||
|
"heating.circuits.2.geofencing.active" => "HK3-Geofencing",
|
||||||
|
"heating.circuits.2.geofencing.status" => "HK3-Geofencing_Status",
|
||||||
"heating.circuits.2.heating.curve.shift" => "HK3-Heizkurve-Niveau",
|
"heating.circuits.2.heating.curve.shift" => "HK3-Heizkurve-Niveau",
|
||||||
"heating.circuits.2.heating.curve.slope" => "HK3-Heizkurve-Steigung",
|
"heating.circuits.2.heating.curve.slope" => "HK3-Heizkurve-Steigung",
|
||||||
"heating.circuits.2.heating.schedule.active" => "HK3-Zeitsteuerung_Heizung_aktiv",
|
"heating.circuits.2.heating.schedule.active" => "HK3-Zeitsteuerung_Heizung_aktiv",
|
||||||
@ -397,6 +406,7 @@ my $RequestList = {
|
|||||||
"heating.solar.sensors.temperature.dhw.value" => "Solar_Sensor_Temperatur_WW",
|
"heating.solar.sensors.temperature.dhw.value" => "Solar_Sensor_Temperatur_WW",
|
||||||
"heating.solar.statistics.hours" => "Solar_Sensor_Statistik_Stunden",
|
"heating.solar.statistics.hours" => "Solar_Sensor_Statistik_Stunden",
|
||||||
|
|
||||||
|
"heating.solar.power.cumulativeProduced.value" => "Solarproduktion_Gesamtertrag",
|
||||||
"heating.solar.power.production.month" => "Solarproduktion/Monat",
|
"heating.solar.power.production.month" => "Solarproduktion/Monat",
|
||||||
"heating.solar.power.production.day" => "Solarproduktion/Tag",
|
"heating.solar.power.production.day" => "Solarproduktion/Tag",
|
||||||
"heating.solar.power.production.unit" => "Solarproduktion/Einheit",
|
"heating.solar.power.production.unit" => "Solarproduktion/Einheit",
|
||||||
@ -1245,6 +1255,7 @@ sub vitoconnect_getAccessTokenCallback($) {
|
|||||||
my $decode_json = eval{decode_json($response_body)};
|
my $decode_json = eval{decode_json($response_body)};
|
||||||
if($@) {
|
if($@) {
|
||||||
Log3 $name, 1, "$name - JSON error while request: $@";
|
Log3 $name, 1, "$name - JSON error while request: $@";
|
||||||
|
InternalTimer(gettimeofday()+$hash->{intervall}, "vitoconnect_GetUpdate", $hash);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my $access_token = $decode_json->{"access_token"};
|
my $access_token = $decode_json->{"access_token"};
|
||||||
@ -1287,17 +1298,18 @@ sub vitoconnect_getGwCallback($) {
|
|||||||
if ($err eq "") {
|
if ($err eq "") {
|
||||||
Log3 $name, 4, "$name - getGwCallback went ok";
|
Log3 $name, 4, "$name - getGwCallback went ok";
|
||||||
Log3 $name, 5, "$name: Received response: $response_body\n";
|
Log3 $name, 5, "$name: Received response: $response_body\n";
|
||||||
|
|
||||||
my $decode_json = eval{decode_json($response_body)};
|
my $decode_json = eval{decode_json($response_body)};
|
||||||
if($@) { Log3 $name, 1, "$name - JSON error while request: $@"; return; }
|
if($@) {
|
||||||
|
Log3 $name, 1, "$name - JSON error while request: $@";
|
||||||
|
InternalTimer(gettimeofday()+$hash->{intervall}, "vitoconnect_GetUpdate", $hash);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ($hash->{".logResponseOnce"}) {
|
if ($hash->{".logResponseOnce"}) {
|
||||||
my $dir = path("log");
|
my $dir = path("log");
|
||||||
my $file = $dir->child("gw.json");
|
my $file = $dir->child("gw.json");
|
||||||
my $file_handle = $file->openw_utf8();
|
my $file_handle = $file->openw_utf8();
|
||||||
$file_handle->print(Dumper($decode_json));
|
$file_handle->print(Dumper($decode_json));
|
||||||
}
|
}
|
||||||
|
|
||||||
my $aggregatedStatus = $decode_json->{entities}[0]->{properties}->{aggregatedStatus};
|
my $aggregatedStatus = $decode_json->{entities}[0]->{properties}->{aggregatedStatus};
|
||||||
Log3 $name, 5, "$name: aggregatedStatus: $aggregatedStatus";
|
Log3 $name, 5, "$name: aggregatedStatus: $aggregatedStatus";
|
||||||
readingsSingleUpdate($hash, "state", "$aggregatedStatus (".TimeNow().")", 1);
|
readingsSingleUpdate($hash, "state", "$aggregatedStatus (".TimeNow().")", 1);
|
||||||
@ -1487,7 +1499,11 @@ sub vitoconnect_action($) {
|
|||||||
|
|
||||||
if ($err eq "") {
|
if ($err eq "") {
|
||||||
my $decode_json = eval{decode_json($response_body)};
|
my $decode_json = eval{decode_json($response_body)};
|
||||||
if($@) { Log3 $name, 1, "$name - JSON error while request: $@"; return; }
|
if($@) {
|
||||||
|
Log3 $name, 1, "$name - JSON error while request: $@";
|
||||||
|
InternalTimer(gettimeofday()+$hash->{intervall}, "vitoconnect_GetUpdate", $hash);
|
||||||
|
return;
|
||||||
|
}
|
||||||
$access_token = $decode_json->{access_token};
|
$access_token = $decode_json->{access_token};
|
||||||
Log3 $name, 5, "$name - access_token: $access_token";
|
Log3 $name, 5, "$name - access_token: $access_token";
|
||||||
} else { Log3 $name, 1, "$name: getAccessToken: An error occured: $err"; }
|
} else { Log3 $name, 1, "$name: getAccessToken: An error occured: $err"; }
|
||||||
@ -1503,14 +1519,15 @@ sub vitoconnect_action($) {
|
|||||||
if ($err eq "") {
|
if ($err eq "") {
|
||||||
Log3 $name, 5, "$name - action (installation and gw): $response_body";
|
Log3 $name, 5, "$name - action (installation and gw): $response_body";
|
||||||
my $decode_json = eval{decode_json($response_body)};
|
my $decode_json = eval{decode_json($response_body)};
|
||||||
if($@) { Log3 $name, 1, "$name - JSON error while request: $@"; return; }
|
if($@) {
|
||||||
|
Log3 $name, 1, "$name - JSON error while request: $@";
|
||||||
|
InternalTimer(gettimeofday()+$hash->{intervall}, "vitoconnect_GetUpdate", $hash);
|
||||||
|
return;
|
||||||
|
}
|
||||||
$installation = $decode_json->{entities}[0]->{properties}->{id};
|
$installation = $decode_json->{entities}[0]->{properties}->{id};
|
||||||
$gw = $decode_json->{entities}[0]->{entities}[0]->{properties}->{serial};
|
$gw = $decode_json->{entities}[0]->{entities}[0]->{properties}->{serial};
|
||||||
Log3 $name, 4, "$name: installation: $installation :: gw: $gw"
|
Log3 $name, 4, "$name: installation: $installation :: gw: $gw"
|
||||||
} else { Log3 $name, 1, "$name: An error occured: $err"; }
|
} else { Log3 $name, 1, "$name: An error occured: $err"; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user