mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
vitoconnect: neue Readings für heating.burners.0.*
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@24795 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
35bf1eabf8
commit
3be3d3a16d
@ -190,7 +190,9 @@
|
|||||||
# 2021-07-19 Anpassungen für privaten apiKey. Redirect URIs muss "http://localhost:4200/" sein.
|
# 2021-07-19 Anpassungen für privaten apiKey. Redirect URIs muss "http://localhost:4200/" sein.
|
||||||
# Nutzung des refresh_token
|
# Nutzung des refresh_token
|
||||||
#
|
#
|
||||||
# ToDo: timeout konfigurierbar machen
|
# 2021-07-19 neue Readings für heating.burners.0.*
|
||||||
|
#
|
||||||
|
# ToDo: timeout, intervall konfigurierbar machen
|
||||||
# Attribute implementieren und dokumentieren
|
# Attribute implementieren und dokumentieren
|
||||||
# Mehrsprachigkeit
|
# Mehrsprachigkeit
|
||||||
# Auswerten der Readings in getCode usw.
|
# Auswerten der Readings in getCode usw.
|
||||||
@ -212,13 +214,11 @@ use DateTime;
|
|||||||
use Time::Piece;
|
use Time::Piece;
|
||||||
use Time::Seconds;
|
use Time::Seconds;
|
||||||
|
|
||||||
|
|
||||||
my $client_secret = "2e21faa1-db2c-4d0b-a10f-575fd372bc8c-575fd372bc8c";
|
my $client_secret = "2e21faa1-db2c-4d0b-a10f-575fd372bc8c-575fd372bc8c";
|
||||||
my $callback_uri = "http://localhost:4200/";
|
my $callback_uri = "http://localhost:4200/";
|
||||||
my $apiURLBase = "https://api.viessmann-platform.io/iot/v1/equipment/";
|
my $apiURLBase = "https://api.viessmann-platform.io/iot/v1/equipment/";
|
||||||
my $apiURL = "https://api.viessmann.com/iot/v1/equipment/";
|
my $apiURL = "https://api.viessmann.com/iot/v1/equipment/";
|
||||||
|
|
||||||
|
|
||||||
my $RequestList = {
|
my $RequestList = {
|
||||||
"heating.boiler.serial.value" => "Kessel_Seriennummer",
|
"heating.boiler.serial.value" => "Kessel_Seriennummer",
|
||||||
"heating.boiler.temperature.value" => "Kessel_Solltemperatur",
|
"heating.boiler.temperature.value" => "Kessel_Solltemperatur",
|
||||||
@ -242,6 +242,12 @@ my $RequestList = {
|
|||||||
"heating.burner.statistics.hours" => "Brenner_Betriebsstunden",
|
"heating.burner.statistics.hours" => "Brenner_Betriebsstunden",
|
||||||
"heating.burner.statistics.starts" => "Brenner_Starts",
|
"heating.burner.statistics.starts" => "Brenner_Starts",
|
||||||
|
|
||||||
|
"heating.burners.0.active" => "Brenner_1_aktiv",
|
||||||
|
"heating.burners.0.modulation.unit" => "Brenner_1_Modulation/Einheit",
|
||||||
|
"heating.burners.0.modulation.value" => "Brenner_1_Modulation",
|
||||||
|
"heating.burners.0.statistics.hours" => "Brenner_1_Betriebsstunden",
|
||||||
|
"heating.burners.0.statistics.starts" => "Brenner_1_Starts",
|
||||||
|
|
||||||
"heating.circuits.enabled" => "Aktive_Heizkreise",
|
"heating.circuits.enabled" => "Aktive_Heizkreise",
|
||||||
"heating.circuits.0.active" => "HK1-aktiv",
|
"heating.circuits.0.active" => "HK1-aktiv",
|
||||||
"heating.circuits.0.type" => "HK1-Typ",
|
"heating.circuits.0.type" => "HK1-Typ",
|
||||||
@ -608,30 +614,42 @@ my $RequestList = {
|
|||||||
"heating.gas.consumption.dhw.week" => "Gasverbrauch_WW/Woche",
|
"heating.gas.consumption.dhw.week" => "Gasverbrauch_WW/Woche",
|
||||||
"heating.gas.consumption.dhw.month" => "Gasverbrauch_WW/Monat",
|
"heating.gas.consumption.dhw.month" => "Gasverbrauch_WW/Monat",
|
||||||
"heating.gas.consumption.dhw.year" => "Gasverbrauch_WW/Jahr",
|
"heating.gas.consumption.dhw.year" => "Gasverbrauch_WW/Jahr",
|
||||||
"heating.gas.consumption.dhw.dayValueReadAt" => "Gasverbrauch_WW/Tag_gelesen_am",
|
"heating.gas.consumption.dhw.dayValueReadAt" =>
|
||||||
"heating.gas.consumption.dhw.weekValueReadAt" => "Gasverbrauch_WW/Woche_gelesen_am",
|
"Gasverbrauch_WW/Tag_gelesen_am",
|
||||||
"heating.gas.consumption.dhw.monthValueReadAt" => "Gasverbrauch_WW/Monat_gelesen_am",
|
"heating.gas.consumption.dhw.weekValueReadAt" =>
|
||||||
"heating.gas.consumption.dhw.yearValueReadAt" => "Gasverbrauch_WW/Jahr_gelesen_am",
|
"Gasverbrauch_WW/Woche_gelesen_am",
|
||||||
|
"heating.gas.consumption.dhw.monthValueReadAt" =>
|
||||||
|
"Gasverbrauch_WW/Monat_gelesen_am",
|
||||||
|
"heating.gas.consumption.dhw.yearValueReadAt" =>
|
||||||
|
"Gasverbrauch_WW/Jahr_gelesen_am",
|
||||||
"heating.gas.consumption.dhw.unit" => "Gasverbrauch_WW/Einheit",
|
"heating.gas.consumption.dhw.unit" => "Gasverbrauch_WW/Einheit",
|
||||||
|
|
||||||
"heating.gas.consumption.heating.day" => "Gasverbrauch_Heizung/Tag",
|
"heating.gas.consumption.heating.day" => "Gasverbrauch_Heizung/Tag",
|
||||||
"heating.gas.consumption.heating.week" => "Gasverbrauch_Heizung/Woche",
|
"heating.gas.consumption.heating.week" => "Gasverbrauch_Heizung/Woche",
|
||||||
"heating.gas.consumption.heating.month" => "Gasverbrauch_Heizung/Monat",
|
"heating.gas.consumption.heating.month" => "Gasverbrauch_Heizung/Monat",
|
||||||
"heating.gas.consumption.heating.year" => "Gasverbrauch_Heizung/Jahr",
|
"heating.gas.consumption.heating.year" => "Gasverbrauch_Heizung/Jahr",
|
||||||
"heating.gas.consumption.heating.dayValueReadAt" => "Gasverbrauch_Heizung/Tag_gelesen_am",
|
"heating.gas.consumption.heating.dayValueReadAt" =>
|
||||||
"heating.gas.consumption.heating.weekValueReadAt" => "Gasverbrauch_Heizung/Woche_gelesen_am",
|
"Gasverbrauch_Heizung/Tag_gelesen_am",
|
||||||
"heating.gas.consumption.heating.monthValueReadAt" => "Gasverbrauch_Heizung/Monat_gelesen_am",
|
"heating.gas.consumption.heating.weekValueReadAt" =>
|
||||||
"heating.gas.consumption.heating.yearValueReadAt" => "Gasverbrauch_Heizung/Jahr_gelesen_am",
|
"Gasverbrauch_Heizung/Woche_gelesen_am",
|
||||||
|
"heating.gas.consumption.heating.monthValueReadAt" =>
|
||||||
|
"Gasverbrauch_Heizung/Monat_gelesen_am",
|
||||||
|
"heating.gas.consumption.heating.yearValueReadAt" =>
|
||||||
|
"Gasverbrauch_Heizung/Jahr_gelesen_am",
|
||||||
"heating.gas.consumption.heating.unit" => "Gasverbrauch_Heizung/Einheit",
|
"heating.gas.consumption.heating.unit" => "Gasverbrauch_Heizung/Einheit",
|
||||||
"heating.gas.consumption.total.day" => "Gasverbrauch_Total/Tag",
|
"heating.gas.consumption.total.day" => "Gasverbrauch_Total/Tag",
|
||||||
"heating.gas.consumption.total.month" => "Gasverbrauch_Total/Woche",
|
"heating.gas.consumption.total.month" => "Gasverbrauch_Total/Woche",
|
||||||
"heating.gas.consumption.total.unit" => "Gasverbrauch_Total/Einheit",
|
"heating.gas.consumption.total.unit" => "Gasverbrauch_Total/Einheit",
|
||||||
"heating.gas.consumption.total.week" => "Gasverbrauch_Total/Woche",
|
"heating.gas.consumption.total.week" => "Gasverbrauch_Total/Woche",
|
||||||
"heating.gas.consumption.total.year" => "Gasverbrauch_Total/Jahr",
|
"heating.gas.consumption.total.year" => "Gasverbrauch_Total/Jahr",
|
||||||
"heating.gas.consumption.total.dayValueReadAt" => "Gasverbrauch_Total/Tag_gelesen_am",
|
"heating.gas.consumption.total.dayValueReadAt" =>
|
||||||
"heating.gas.consumption.total.monthValueReadAt" => "Gasverbrauch_Total/Woche_gelesen_am",
|
"Gasverbrauch_Total/Tag_gelesen_am",
|
||||||
"heating.gas.consumption.total.weekValueReadAt" => "Gasverbrauch_Total/Woche_gelesen_am",
|
"heating.gas.consumption.total.monthValueReadAt" =>
|
||||||
"heating.gas.consumption.total.yearValueReadAt" => "Gasverbrauch_Total/Jahr_gelesen_am",
|
"Gasverbrauch_Total/Woche_gelesen_am",
|
||||||
|
"heating.gas.consumption.total.weekValueReadAt" =>
|
||||||
|
"Gasverbrauch_Total/Woche_gelesen_am",
|
||||||
|
"heating.gas.consumption.total.yearValueReadAt" =>
|
||||||
|
"Gasverbrauch_Total/Jahr_gelesen_am",
|
||||||
|
|
||||||
"heating.gas.consumption.fuelCell.day" =>
|
"heating.gas.consumption.fuelCell.day" =>
|
||||||
"Gasverbrauch_Brennstoffzelle/Tag",
|
"Gasverbrauch_Brennstoffzelle/Tag",
|
||||||
@ -681,10 +699,14 @@ my $RequestList = {
|
|||||||
"heating.power.consumption.total.month" => "Stromverbrauch_Total/Monat",
|
"heating.power.consumption.total.month" => "Stromverbrauch_Total/Monat",
|
||||||
"heating.power.consumption.total.week" => "Stromverbrauch_Total/Woche",
|
"heating.power.consumption.total.week" => "Stromverbrauch_Total/Woche",
|
||||||
"heating.power.consumption.total.year" => "Stromverbrauch_Total/Jahr",
|
"heating.power.consumption.total.year" => "Stromverbrauch_Total/Jahr",
|
||||||
"heating.power.consumption.total.dayValueReadAt" => "Stromverbrauch_Total/Tag_gelesen_am",
|
"heating.power.consumption.total.dayValueReadAt" =>
|
||||||
"heating.power.consumption.total.monthValueReadAt" => "Stromverbrauch_Total/Monat_gelesen_am",
|
"Stromverbrauch_Total/Tag_gelesen_am",
|
||||||
"heating.power.consumption.total.weekValueReadAt" => "Stromverbrauch_Total/Woche_gelesen_am",
|
"heating.power.consumption.total.monthValueReadAt" =>
|
||||||
"heating.power.consumption.total.yearValueReadAt" => "Stromverbrauch_Total/Jahr_gelesen_am",
|
"Stromverbrauch_Total/Monat_gelesen_am",
|
||||||
|
"heating.power.consumption.total.weekValueReadAt" =>
|
||||||
|
"Stromverbrauch_Total/Woche_gelesen_am",
|
||||||
|
"heating.power.consumption.total.yearValueReadAt" =>
|
||||||
|
"Stromverbrauch_Total/Jahr_gelesen_am",
|
||||||
"heating.power.consumption.total.unit" => "Stromverbrauch_Total/Einheit",
|
"heating.power.consumption.total.unit" => "Stromverbrauch_Total/Einheit",
|
||||||
|
|
||||||
"heating.power.production.current.status" =>
|
"heating.power.production.current.status" =>
|
||||||
@ -837,6 +859,7 @@ sub vitoconnect_Define {
|
|||||||
$hash->{".access_token"} = "";
|
$hash->{".access_token"} = "";
|
||||||
$hash->{".installation"} = "";
|
$hash->{".installation"} = "";
|
||||||
$hash->{".gw"} = "";
|
$hash->{".gw"} = "";
|
||||||
|
$hash->{"Redirect_URI"} = $callback_uri;
|
||||||
|
|
||||||
my $isiwebpasswd = vitoconnect_ReadKeyValue( $hash, "passwd" );
|
my $isiwebpasswd = vitoconnect_ReadKeyValue( $hash, "passwd" );
|
||||||
if ( $isiwebpasswd eq "" ) {
|
if ( $isiwebpasswd eq "" ) {
|
||||||
@ -965,7 +988,9 @@ sub vitoconnect_Set {
|
|||||||
$hash,
|
$hash,
|
||||||
"heating.circuits.0.operating.programs.holiday/commands/schedule",
|
"heating.circuits.0.operating.programs.holiday/commands/schedule",
|
||||||
"{\"start\":\"$args[0]\",\"end\":\"$end\"}",
|
"{\"start\":\"$args[0]\",\"end\":\"$end\"}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -980,7 +1005,9 @@ sub vitoconnect_Set {
|
|||||||
$hash,
|
$hash,
|
||||||
"heating.circuits.1.operating.programs.holiday/commands/schedule",
|
"heating.circuits.1.operating.programs.holiday/commands/schedule",
|
||||||
"{\"start\":\"$args[0]\",\"end\":\"$end\"}",
|
"{\"start\":\"$args[0]\",\"end\":\"$end\"}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -995,7 +1022,9 @@ sub vitoconnect_Set {
|
|||||||
$hash,
|
$hash,
|
||||||
"heating.circuits.2.operating.programs.holiday/commands/schedule",
|
"heating.circuits.2.operating.programs.holiday/commands/schedule",
|
||||||
"{\"start\":\"$args[0]\",\"end\":\"$end\"}",
|
"{\"start\":\"$args[0]\",\"end\":\"$end\"}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1005,7 +1034,9 @@ sub vitoconnect_Set {
|
|||||||
$hash,
|
$hash,
|
||||||
"heating.circuits.0.operating.programs.holiday/commands/schedule",
|
"heating.circuits.0.operating.programs.holiday/commands/schedule",
|
||||||
"{\"start\":\"$start\",\"end\":\"$args[0]\"}",
|
"{\"start\":\"$start\",\"end\":\"$args[0]\"}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1015,7 +1046,9 @@ sub vitoconnect_Set {
|
|||||||
$hash,
|
$hash,
|
||||||
"heating.circuits.1.operating.programs.holiday/commands/schedule",
|
"heating.circuits.1.operating.programs.holiday/commands/schedule",
|
||||||
"{\"start\":\"$start\",\"end\":\"$args[0]\"}",
|
"{\"start\":\"$start\",\"end\":\"$args[0]\"}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1025,26 +1058,43 @@ sub vitoconnect_Set {
|
|||||||
$hash,
|
$hash,
|
||||||
"heating.circuits.2.operating.programs.holiday/commands/schedule",
|
"heating.circuits.2.operating.programs.holiday/commands/schedule",
|
||||||
"{\"start\":\"$start\",\"end\":\"$args[0]\"}",
|
"{\"start\":\"$start\",\"end\":\"$args[0]\"}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK1-Urlaub_unschedule" ) {
|
elsif ( $opt eq "HK1-Urlaub_unschedule" ) {
|
||||||
vitoconnect_action( $hash,
|
vitoconnect_action(
|
||||||
|
$hash,
|
||||||
"heating.circuits.0.operating.programs.holiday/commands/unschedule",
|
"heating.circuits.0.operating.programs.holiday/commands/unschedule",
|
||||||
"{}", $name, $opt, @args );
|
"{}",
|
||||||
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK2-Urlaub_unschedule" ) {
|
elsif ( $opt eq "HK2-Urlaub_unschedule" ) {
|
||||||
vitoconnect_action( $hash,
|
vitoconnect_action(
|
||||||
|
$hash,
|
||||||
"heating.circuits.1.operating.programs.holiday/commands/unschedule",
|
"heating.circuits.1.operating.programs.holiday/commands/unschedule",
|
||||||
"{}", $name, $opt, @args );
|
"{}",
|
||||||
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK3-Urlaub_unschedule" ) {
|
elsif ( $opt eq "HK3-Urlaub_unschedule" ) {
|
||||||
vitoconnect_action( $hash,
|
vitoconnect_action(
|
||||||
|
$hash,
|
||||||
"heating.circuits.2.operating.programs.holiday/commands/unschedule",
|
"heating.circuits.2.operating.programs.holiday/commands/unschedule",
|
||||||
"{}", $name, $opt, @args );
|
"{}",
|
||||||
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK1-Zeitsteuerung_Heizung" ) {
|
elsif ( $opt eq "HK1-Zeitsteuerung_Heizung" ) {
|
||||||
@ -1102,29 +1152,32 @@ sub vitoconnect_Set {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK1-Solltemperatur_comfort" ) {
|
elsif ( $opt eq "HK1-Solltemperatur_comfort" ) {
|
||||||
vitoconnect_action(
|
vitoconnect_action($hash,
|
||||||
$hash,
|
|
||||||
"heating.circuits.0.operating.programs.comfort/commands/setTemperature",
|
"heating.circuits.0.operating.programs.comfort/commands/setTemperature",
|
||||||
"{\"targetTemperature\":$args[0]}",
|
"{\"targetTemperature\":$args[0]}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK2-Solltemperatur_comfort" ) {
|
elsif ( $opt eq "HK2-Solltemperatur_comfort" ) {
|
||||||
vitoconnect_action(
|
vitoconnect_action($hash,
|
||||||
$hash,
|
|
||||||
"heating.circuits.1.operating.programs.comfort/commands/setTemperature",
|
"heating.circuits.1.operating.programs.comfort/commands/setTemperature",
|
||||||
"{\"targetTemperature\":$args[0]}",
|
"{\"targetTemperature\":$args[0]}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK3-Solltemperatur_comfort" ) {
|
elsif ( $opt eq "HK3-Solltemperatur_comfort" ) {
|
||||||
vitoconnect_action(
|
vitoconnect_action($hash,
|
||||||
$hash,
|
|
||||||
"heating.circuits.2.operating.programs.comfort/commands/setTemperature",
|
"heating.circuits.2.operating.programs.comfort/commands/setTemperature",
|
||||||
"{\"targetTemperature\":$args[0]}",
|
"{\"targetTemperature\":$args[0]}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1148,56 +1201,62 @@ sub vitoconnect_Set {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK1-Solltemperatur_normal" ) {
|
elsif ( $opt eq "HK1-Solltemperatur_normal" ) {
|
||||||
vitoconnect_action(
|
vitoconnect_action($hash,
|
||||||
$hash,
|
|
||||||
"heating.circuits.0.operating.programs.normal/commands/setTemperature",
|
"heating.circuits.0.operating.programs.normal/commands/setTemperature",
|
||||||
"{\"targetTemperature\":$args[0]}",
|
"{\"targetTemperature\":$args[0]}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK2-Solltemperatur_normal" ) {
|
elsif ( $opt eq "HK2-Solltemperatur_normal" ) {
|
||||||
vitoconnect_action(
|
vitoconnect_action($hash,
|
||||||
$hash,
|
|
||||||
"heating.circuits.1.operating.programs.normal/commands/setTemperature",
|
"heating.circuits.1.operating.programs.normal/commands/setTemperature",
|
||||||
"{\"targetTemperature\":$args[0]}",
|
"{\"targetTemperature\":$args[0]}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK3-Solltemperatur_normal" ) {
|
elsif ( $opt eq "HK3-Solltemperatur_normal" ) {
|
||||||
vitoconnect_action(
|
vitoconnect_action($hash,
|
||||||
$hash,
|
|
||||||
"heating.circuits.2.operating.programs.normal/commands/setTemperature",
|
"heating.circuits.2.operating.programs.normal/commands/setTemperature",
|
||||||
"{\"targetTemperature\":$args[0]}",
|
"{\"targetTemperature\":$args[0]}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK1-Solltemperatur_reduziert" ) {
|
elsif ( $opt eq "HK1-Solltemperatur_reduziert" ) {
|
||||||
vitoconnect_action(
|
vitoconnect_action($hash,
|
||||||
$hash,
|
|
||||||
"heating.circuits.0.operating.programs.reduced/commands/setTemperature",
|
"heating.circuits.0.operating.programs.reduced/commands/setTemperature",
|
||||||
"{\"targetTemperature\":$args[0]}",
|
"{\"targetTemperature\":$args[0]}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK2-Solltemperatur_reduziert" ) {
|
elsif ( $opt eq "HK2-Solltemperatur_reduziert" ) {
|
||||||
vitoconnect_action(
|
vitoconnect_action($hash,
|
||||||
$hash,
|
|
||||||
"heating.circuits.1.operating.programs.reduced/commands/setTemperature",
|
"heating.circuits.1.operating.programs.reduced/commands/setTemperature",
|
||||||
"{\"targetTemperature\":$args[0]}",
|
"{\"targetTemperature\":$args[0]}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "HK3-Solltemperatur_reduziert" ) {
|
elsif ( $opt eq "HK3-Solltemperatur_reduziert" ) {
|
||||||
vitoconnect_action(
|
vitoconnect_action($hash,
|
||||||
$hash,
|
|
||||||
"heating.circuits.2.operating.programs.reduced/commands/setTemperature",
|
"heating.circuits.2.operating.programs.reduced/commands/setTemperature",
|
||||||
"{\"targetTemperature\":$args[0]}",
|
"{\"targetTemperature\":$args[0]}",
|
||||||
$name, $opt, @args
|
$name,
|
||||||
|
$opt,
|
||||||
|
@args
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1217,7 +1276,8 @@ sub vitoconnect_Set {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $opt eq "WW-einmaliges_Aufladen" ) {
|
elsif ( $opt eq "WW-einmaliges_Aufladen" ) {
|
||||||
vitoconnect_action( $hash, "heating.dhw.oneTimeCharge/commands/$args[0]",
|
vitoconnect_action( $hash,
|
||||||
|
"heating.dhw.oneTimeCharge/commands/$args[0]",
|
||||||
"{}", $name, $opt, @args );
|
"{}", $name, $opt, @args );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1400,8 +1460,6 @@ sub vitoconnect_GetUpdate {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vitoconnect_getResource($hash);
|
vitoconnect_getResource($hash);
|
||||||
|
|
||||||
#vitoconnect_getCode($hash);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1452,7 +1510,7 @@ sub vitoconnect_getCodeCallback {
|
|||||||
$response_body =~ /code=(.*)"/;
|
$response_body =~ /code=(.*)"/;
|
||||||
$hash->{".code"} = $1;
|
$hash->{".code"} = $1;
|
||||||
Log3 $name, 4, "$name - code: " . $hash->{".code"};
|
Log3 $name, 4, "$name - code: " . $hash->{".code"};
|
||||||
if ( $hash->{".code"} && $hash->{".code"} ne "4") {
|
if ( $hash->{".code"} && $hash->{".code"} ne "4" ) {
|
||||||
$hash->{login} = "ok";
|
$hash->{login} = "ok";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1468,7 +1526,8 @@ sub vitoconnect_getCodeCallback {
|
|||||||
vitoconnect_getAccessToken($hash);
|
vitoconnect_getAccessToken($hash);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
readingsSingleUpdate( $hash, "state", "Login failure. Check password and apiKey", 1 );
|
readingsSingleUpdate( $hash, "state",
|
||||||
|
"Login failure. Check password and apiKey", 1 );
|
||||||
Log3 $name, 1, "$name - Login failure. Check password and apiKey";
|
Log3 $name, 1, "$name - Login failure. Check password and apiKey";
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -1481,18 +1540,20 @@ sub vitoconnect_getAccessToken {
|
|||||||
my $param = {
|
my $param = {
|
||||||
url => "https://iam.viessmann.com/idp/v2/token",
|
url => "https://iam.viessmann.com/idp/v2/token",
|
||||||
hash => $hash,
|
hash => $hash,
|
||||||
header =>
|
header => "Content-Type: application/x-www-form-urlencoded",
|
||||||
"Content-Type: application/x-www-form-urlencoded",
|
|
||||||
data => "grant_type=authorization_code"
|
data => "grant_type=authorization_code"
|
||||||
. "&code_verifier=" . $client_secret
|
. "&code_verifier="
|
||||||
|
. $client_secret
|
||||||
. "&client_id=$client_id"
|
. "&client_id=$client_id"
|
||||||
. "&redirect_uri=$callback_uri"
|
. "&redirect_uri=$callback_uri"
|
||||||
. "&code=" . $hash->{".code"} ,
|
. "&code="
|
||||||
|
. $hash->{".code"},
|
||||||
sslargs => { SSL_verify_mode => 0 },
|
sslargs => { SSL_verify_mode => 0 },
|
||||||
method => "POST",
|
method => "POST",
|
||||||
timeout => $hash->{timeout},
|
timeout => $hash->{timeout},
|
||||||
callback => \&vitoconnect_getAccessTokenCallback
|
callback => \&vitoconnect_getAccessTokenCallback
|
||||||
};
|
};
|
||||||
|
|
||||||
#Log3 $name, 1, "$name - " . $param->{"data"};
|
#Log3 $name, 1, "$name - " . $param->{"data"};
|
||||||
HttpUtils_NonblockingGet($param);
|
HttpUtils_NonblockingGet($param);
|
||||||
return;
|
return;
|
||||||
@ -1518,7 +1579,8 @@ sub vitoconnect_getAccessTokenCallback {
|
|||||||
$hash->{".access_token"} = $access_token;
|
$hash->{".access_token"} = $access_token;
|
||||||
$hash->{"refresh_token"} = $decode_json->{"refresh_token"};
|
$hash->{"refresh_token"} = $decode_json->{"refresh_token"};
|
||||||
|
|
||||||
Log3 $name, 4, "$name - Access Token: " . substr ($access_token, 0, 20) . "...";
|
Log3 $name, 4,
|
||||||
|
"$name - Access Token: " . substr( $access_token, 0, 20 ) . "...";
|
||||||
vitoconnect_getGw($hash);
|
vitoconnect_getGw($hash);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1543,16 +1605,17 @@ sub vitoconnect_getRefresh {
|
|||||||
my $param = {
|
my $param = {
|
||||||
url => "https://iam.viessmann.com/idp/v2/token",
|
url => "https://iam.viessmann.com/idp/v2/token",
|
||||||
hash => $hash,
|
hash => $hash,
|
||||||
header =>
|
header => "Content-Type: application/x-www-form-urlencoded",
|
||||||
"Content-Type: application/x-www-form-urlencoded",
|
|
||||||
data => "grant_type=refresh_token"
|
data => "grant_type=refresh_token"
|
||||||
. "&client_id=$client_id"
|
. "&client_id=$client_id"
|
||||||
. "&refresh_token=" . $hash->{"refresh_token"} ,
|
. "&refresh_token="
|
||||||
|
. $hash->{"refresh_token"},
|
||||||
sslargs => { SSL_verify_mode => 0 },
|
sslargs => { SSL_verify_mode => 0 },
|
||||||
method => "POST",
|
method => "POST",
|
||||||
timeout => $hash->{timeout},
|
timeout => $hash->{timeout},
|
||||||
callback => \&vitoconnect_getRefreshCallback
|
callback => \&vitoconnect_getRefreshCallback
|
||||||
};
|
};
|
||||||
|
|
||||||
#Log3 $name, 1, "$name - " . $param->{"data"};
|
#Log3 $name, 1, "$name - " . $param->{"data"};
|
||||||
HttpUtils_NonblockingGet($param);
|
HttpUtils_NonblockingGet($param);
|
||||||
return;
|
return;
|
||||||
@ -1576,9 +1639,11 @@ sub vitoconnect_getRefreshCallback {
|
|||||||
my $access_token = $decode_json->{"access_token"};
|
my $access_token = $decode_json->{"access_token"};
|
||||||
if ( $access_token ne "" ) {
|
if ( $access_token ne "" ) {
|
||||||
$hash->{".access_token"} = $access_token;
|
$hash->{".access_token"} = $access_token;
|
||||||
|
|
||||||
#$hash->{"refresh_token"} = $decode_json->{"refresh_token"};
|
#$hash->{"refresh_token"} = $decode_json->{"refresh_token"};
|
||||||
|
|
||||||
Log3 $name, 4, "$name - Access Token: " . substr ($access_token, 0, 20) . "...";
|
Log3 $name, 4,
|
||||||
|
"$name - Access Token: " . substr( $access_token, 0, 20 ) . "...";
|
||||||
vitoconnect_getGw($hash);
|
vitoconnect_getGw($hash);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1601,10 +1666,10 @@ sub vitoconnect_getGw {
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $access_token = $hash->{".access_token"};
|
my $access_token = $hash->{".access_token"};
|
||||||
my $param = {
|
my $param = {
|
||||||
url => $apiURL ."gateways",
|
url => $apiURL . "gateways",
|
||||||
hash => $hash,
|
hash => $hash,
|
||||||
header => "Authorization: Bearer $access_token",
|
header => "Authorization: Bearer $access_token",
|
||||||
timeout => $hash->{timeout} ,
|
timeout => $hash->{timeout},
|
||||||
sslargs => { SSL_verify_mode => 0 },
|
sslargs => { SSL_verify_mode => 0 },
|
||||||
callback => \&vitoconnect_getGwCallback
|
callback => \&vitoconnect_getGwCallback
|
||||||
};
|
};
|
||||||
@ -1636,7 +1701,7 @@ sub vitoconnect_getGwCallback {
|
|||||||
$file_handle->print( Dumper($items) );
|
$file_handle->print( Dumper($items) );
|
||||||
}
|
}
|
||||||
$hash->{".gw"} = $items->{data}[0]->{serial};
|
$hash->{".gw"} = $items->{data}[0]->{serial};
|
||||||
readingsSingleUpdate ( $hash, "gw", $response_body, 1);
|
readingsSingleUpdate( $hash, "gw", $response_body, 1 );
|
||||||
vitoconnect_getInstallation($hash);
|
vitoconnect_getInstallation($hash);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1652,10 +1717,10 @@ sub vitoconnect_getInstallation {
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $access_token = $hash->{".access_token"};
|
my $access_token = $hash->{".access_token"};
|
||||||
my $param = {
|
my $param = {
|
||||||
url => $apiURL ."installations",
|
url => $apiURL . "installations",
|
||||||
hash => $hash,
|
hash => $hash,
|
||||||
header => "Authorization: Bearer $access_token",
|
header => "Authorization: Bearer $access_token",
|
||||||
timeout => $hash->{timeout} ,
|
timeout => $hash->{timeout},
|
||||||
sslargs => { SSL_verify_mode => 0 },
|
sslargs => { SSL_verify_mode => 0 },
|
||||||
callback => \&vitoconnect_getInstallationCallback
|
callback => \&vitoconnect_getInstallationCallback
|
||||||
};
|
};
|
||||||
@ -1687,14 +1752,14 @@ sub vitoconnect_getInstallationCallback {
|
|||||||
$file_handle->print( Dumper($items) );
|
$file_handle->print( Dumper($items) );
|
||||||
}
|
}
|
||||||
my $id = $items->{data}[0]->{id};
|
my $id = $items->{data}[0]->{id};
|
||||||
if ($id == "") {
|
if ( $id == "" ) {
|
||||||
Log3 $name, 1, "$name - Something went wrong. Will retry";
|
Log3 $name, 1, "$name - Something went wrong. Will retry";
|
||||||
InternalTimer( gettimeofday() + $hash->{intervall},
|
InternalTimer( gettimeofday() + $hash->{intervall},
|
||||||
"vitoconnect_GetUpdate", $hash );
|
"vitoconnect_GetUpdate", $hash );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$hash->{".installation"} = $items->{data}[0]->{id};
|
$hash->{".installation"} = $items->{data}[0]->{id};
|
||||||
readingsSingleUpdate ( $hash, "installation", $response_body, 1);
|
readingsSingleUpdate( $hash, "installation", $response_body, 1 );
|
||||||
vitoconnect_getDevice($hash);
|
vitoconnect_getDevice($hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1713,10 +1778,10 @@ sub vitoconnect_getDevice {
|
|||||||
my $installation = $hash->{".installation"};
|
my $installation = $hash->{".installation"};
|
||||||
my $gw = $hash->{".gw"};
|
my $gw = $hash->{".gw"};
|
||||||
my $param = {
|
my $param = {
|
||||||
url => $apiURL ."installations/$installation/gateways/$gw/devices",
|
url => $apiURL . "installations/$installation/gateways/$gw/devices",
|
||||||
hash => $hash,
|
hash => $hash,
|
||||||
header => "Authorization: Bearer $access_token",
|
header => "Authorization: Bearer $access_token",
|
||||||
timeout => $hash->{timeout} ,
|
timeout => $hash->{timeout},
|
||||||
sslargs => { SSL_verify_mode => 0 },
|
sslargs => { SSL_verify_mode => 0 },
|
||||||
callback => \&vitoconnect_getDeviceCallback
|
callback => \&vitoconnect_getDeviceCallback
|
||||||
};
|
};
|
||||||
@ -1747,7 +1812,7 @@ sub vitoconnect_getDeviceCallback {
|
|||||||
my $file_handle = $file->openw_utf8();
|
my $file_handle = $file->openw_utf8();
|
||||||
$file_handle->print( Dumper($items) );
|
$file_handle->print( Dumper($items) );
|
||||||
}
|
}
|
||||||
readingsSingleUpdate ( $hash, "device", $response_body, 1);
|
readingsSingleUpdate( $hash, "device", $response_body, 1 );
|
||||||
vitoconnect_getFeatures($hash);
|
vitoconnect_getFeatures($hash);
|
||||||
vitoconnect_getResource($hash);
|
vitoconnect_getResource($hash);
|
||||||
}
|
}
|
||||||
@ -1758,72 +1823,74 @@ sub vitoconnect_getDeviceCallback {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub vitoconnect_getFeatures {
|
sub vitoconnect_getFeatures {
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $access_token = $hash->{".access_token"};
|
my $access_token = $hash->{".access_token"};
|
||||||
my $installation = $hash->{".installation"};
|
my $installation = $hash->{".installation"};
|
||||||
my $gw = $hash->{".gw"};
|
my $gw = $hash->{".gw"};
|
||||||
my $dev = AttrVal( $name, 'vitoconnect_device', 0);
|
my $dev = AttrVal( $name, 'vitoconnect_device', 0 );
|
||||||
|
|
||||||
Log3 $name, 4, "$name - getFeatures went ok";
|
Log3 $name, 4, "$name - getFeatures went ok";
|
||||||
# Service Documents
|
|
||||||
|
# Service Documents -ToDo
|
||||||
|
|
||||||
# Gateway features
|
# Gateway features
|
||||||
my $param = {
|
my $param = {
|
||||||
url => $apiURL ."installations/$installation/gateways/$gw/features",
|
url => $apiURL . "installations/$installation/gateways/$gw/features",
|
||||||
hash => $hash,
|
hash => $hash,
|
||||||
header => "Authorization: Bearer $access_token",
|
header => "Authorization: Bearer $access_token",
|
||||||
timeout => $hash->{timeout} ,
|
timeout => $hash->{timeout},
|
||||||
sslargs => { SSL_verify_mode => 0 },
|
sslargs => { SSL_verify_mode => 0 },
|
||||||
};
|
};
|
||||||
( my $err, my $msg ) = HttpUtils_BlockingGet($param);
|
( my $err, my $msg ) = HttpUtils_BlockingGet($param);
|
||||||
my $decode_json = eval { decode_json($msg) };
|
my $decode_json = eval { decode_json($msg) };
|
||||||
if ( $err ne "" || $decode_json->{statusCode} ne "" ) {
|
if ( $err ne "" || $decode_json->{statusCode} ne "" ) {
|
||||||
Log3 $name, 1, "$name - Fehler während "
|
Log3 $name, 1,
|
||||||
. "Gateway features: $err :: $msg";
|
"$name - Fehler während " . "Gateway features: $err :: $msg";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
readingsSingleUpdate ( $hash, "gw_features", $msg, 1);
|
readingsSingleUpdate( $hash, "gw_features", $msg, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
# installation features
|
# installation features
|
||||||
my $param = {
|
my $param = {
|
||||||
url => $apiURL ."installations/$installation/features",
|
url => $apiURL . "installations/$installation/features",
|
||||||
hash => $hash,
|
hash => $hash,
|
||||||
header => "Authorization: Bearer $access_token",
|
header => "Authorization: Bearer $access_token",
|
||||||
timeout => $hash->{timeout} ,
|
timeout => $hash->{timeout},
|
||||||
sslargs => { SSL_verify_mode => 0 },
|
sslargs => { SSL_verify_mode => 0 },
|
||||||
};
|
};
|
||||||
( my $err, my $msg ) = HttpUtils_BlockingGet($param);
|
( my $err, my $msg ) = HttpUtils_BlockingGet($param);
|
||||||
my $decode_json = eval { decode_json($msg) };
|
my $decode_json = eval { decode_json($msg) };
|
||||||
if ( $err ne "" || $decode_json->{statusCode} ne "" ) {
|
if ( $err ne "" || $decode_json->{statusCode} ne "" ) {
|
||||||
Log3 $name, 1, "$name - Fehler während "
|
Log3 $name, 1,
|
||||||
. "installation features: $err :: $msg";
|
"$name - Fehler während " . "installation features: $err :: $msg";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
readingsSingleUpdate ( $hash, "installation_features", $msg, 1);
|
readingsSingleUpdate( $hash, "installation_features", $msg, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#Events
|
#Events
|
||||||
# my $param = {
|
# my $param = {
|
||||||
# url => "https://api.viessmann.com/iot/v1/events-history/events",
|
# url => "https://api.viessmann.com/iot/v1/events-history/events",
|
||||||
# hash => $hash,
|
# hash => $hash,
|
||||||
# header => "Authorization: Bearer $access_token",
|
# header => "Authorization: Bearer $access_token",
|
||||||
# data => "gatewaySerial=$gw",
|
# data => "gatewaySerial=$gw",
|
||||||
# method => "POST",
|
# method => "POST",
|
||||||
# timeout => $hash->{timeout} ,
|
# timeout => $hash->{timeout} ,
|
||||||
# sslargs => { SSL_verify_mode => 0 },
|
# sslargs => { SSL_verify_mode => 0 },
|
||||||
# };
|
# };
|
||||||
# ( my $err, my $msg ) = HttpUtils_BlockingGet($param);
|
# ( my $err, my $msg ) = HttpUtils_BlockingGet($param);
|
||||||
# my $decode_json = eval { decode_json($msg) };
|
# my $decode_json = eval { decode_json($msg) };
|
||||||
# if ( $err ne "" || $decode_json->{statusCode} ne "" ) {
|
# if ( $err ne "" || $decode_json->{statusCode} ne "" ) {
|
||||||
# Log3 $name, 1, "$name - Fehler während "
|
# Log3 $name, 1, "$name - Fehler während "
|
||||||
# . "events: $err :: $msg";
|
# . "events: $err :: $msg";
|
||||||
# }
|
# }
|
||||||
# else {
|
# else {
|
||||||
# readingsSingleUpdate ( $hash, "events", $msg, 1);
|
# readingsSingleUpdate ( $hash, "events", $msg, 1);
|
||||||
# }
|
# }
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1834,10 +1901,11 @@ sub vitoconnect_getResource {
|
|||||||
my $access_token = $hash->{".access_token"};
|
my $access_token = $hash->{".access_token"};
|
||||||
my $installation = $hash->{".installation"};
|
my $installation = $hash->{".installation"};
|
||||||
my $gw = $hash->{".gw"};
|
my $gw = $hash->{".gw"};
|
||||||
my $dev = AttrVal( $name, 'vitoconnect_device', 0);
|
my $dev = AttrVal( $name, 'vitoconnect_device', 0 );
|
||||||
|
|
||||||
Log3 $name, 4, "$name - enter getResource";
|
Log3 $name, 4, "$name - enter getResource";
|
||||||
Log3 $name, 4, "$name - access_token: " . substr ($access_token, 0, 20) . "...";
|
Log3 $name, 4,
|
||||||
|
"$name - access_token: " . substr( $access_token, 0, 20 ) . "...";
|
||||||
Log3 $name, 4, "$name - installation: $installation";
|
Log3 $name, 4, "$name - installation: $installation";
|
||||||
Log3 $name, 4, "$name - gw: $gw";
|
Log3 $name, 4, "$name - gw: $gw";
|
||||||
if ( $access_token eq "" || $installation eq "" || $gw eq "" ) {
|
if ( $access_token eq "" || $installation eq "" || $gw eq "" ) {
|
||||||
@ -1845,10 +1913,11 @@ sub vitoconnect_getResource {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my $param = {
|
my $param = {
|
||||||
url => $apiURL . "installations/$installation/gateways/$gw/devices/$dev/features",
|
url => $apiURL
|
||||||
|
. "installations/$installation/gateways/$gw/devices/$dev/features",
|
||||||
hash => $hash,
|
hash => $hash,
|
||||||
header => "Authorization: Bearer $access_token",
|
header => "Authorization: Bearer $access_token",
|
||||||
timeout => $hash->{timeout} ,
|
timeout => $hash->{timeout},
|
||||||
sslargs => { SSL_verify_mode => 0 },
|
sslargs => { SSL_verify_mode => 0 },
|
||||||
callback => \&vitoconnect_getResourceCallback
|
callback => \&vitoconnect_getResourceCallback
|
||||||
};
|
};
|
||||||
@ -1863,7 +1932,8 @@ sub vitoconnect_getResourceCallback {
|
|||||||
|
|
||||||
if ( $err eq "" ) {
|
if ( $err eq "" ) {
|
||||||
Log3 $name, 4, "$name - getResourceCallback went ok";
|
Log3 $name, 4, "$name - getResourceCallback went ok";
|
||||||
Log3 $name, 5, "$name - Received response: " . substr ($response_body, 0,100) . "...";
|
Log3 $name, 5, "$name - Received response: "
|
||||||
|
. substr( $response_body, 0, 100 ) . "...";
|
||||||
my $items = eval { decode_json($response_body) };
|
my $items = eval { decode_json($response_body) };
|
||||||
if ($@) {
|
if ($@) {
|
||||||
readingsSingleUpdate( $hash, "state",
|
readingsSingleUpdate( $hash, "state",
|
||||||
@ -1886,13 +1956,17 @@ sub vitoconnect_getResourceCallback {
|
|||||||
"statusCode: $items->{statusCode} "
|
"statusCode: $items->{statusCode} "
|
||||||
. "errorType: $items->{errorType} "
|
. "errorType: $items->{errorType} "
|
||||||
. "message: $items->{message} "
|
. "message: $items->{message} "
|
||||||
. "error: $items->{error}", 1 );
|
. "error: $items->{error}",
|
||||||
|
1
|
||||||
|
);
|
||||||
if ( $items->{statusCode} eq "401" ) {
|
if ( $items->{statusCode} eq "401" ) {
|
||||||
|
|
||||||
# EXPIRED TOKEN
|
# EXPIRED TOKEN
|
||||||
vitoconnect_getRefresh($hash);
|
vitoconnect_getRefresh($hash);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $items->{statusCode} eq "404" ) {
|
elsif ( $items->{statusCode} eq "404" ) {
|
||||||
|
|
||||||
# DEVICE_NOT_FOUND
|
# DEVICE_NOT_FOUND
|
||||||
Log3 $name, 1, "$name - Device not found: Optolink prüfen!";
|
Log3 $name, 1, "$name - Device not found: Optolink prüfen!";
|
||||||
InternalTimer( gettimeofday() + $hash->{intervall},
|
InternalTimer( gettimeofday() + $hash->{intervall},
|
||||||
@ -1900,6 +1974,7 @@ sub vitoconnect_getResourceCallback {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $items->{statusCode} eq "429" ) {
|
elsif ( $items->{statusCode} eq "429" ) {
|
||||||
|
|
||||||
# RATE_LIMIT_EXCEEDED
|
# RATE_LIMIT_EXCEEDED
|
||||||
Log3 $name, 1,
|
Log3 $name, 1,
|
||||||
"$name - Anzahl der möglichen API Calls in überschritten!";
|
"$name - Anzahl der möglichen API Calls in überschritten!";
|
||||||
@ -1908,6 +1983,7 @@ sub vitoconnect_getResourceCallback {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ( $items->{statusCode} eq "502" ) {
|
elsif ( $items->{statusCode} eq "502" ) {
|
||||||
|
|
||||||
# DEVICE_COMMUNICATION_ERROR error: Bad Gateway
|
# DEVICE_COMMUNICATION_ERROR error: Bad Gateway
|
||||||
Log3 $name, 1, "$name - temporärer API Fehler";
|
Log3 $name, 1, "$name - temporärer API Fehler";
|
||||||
InternalTimer( gettimeofday() + $hash->{intervall},
|
InternalTimer( gettimeofday() + $hash->{intervall},
|
||||||
@ -1936,14 +2012,17 @@ sub vitoconnect_getResourceCallback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
foreach (@{$items->{data}}) {
|
foreach ( @{ $items->{data} } ) {
|
||||||
my $feature = $_;
|
my $feature = $_;
|
||||||
my $properties = $feature->{properties};
|
my $properties = $feature->{properties};
|
||||||
foreach my $key ( keys %$properties ) {
|
foreach my $key ( keys %$properties ) {
|
||||||
my $Reading = $RequestList->{ $feature->{feature} . "." . $key };
|
my $Reading =
|
||||||
|
$RequestList->{ $feature->{feature} . "." . $key };
|
||||||
if ( !defined($Reading)
|
if ( !defined($Reading)
|
||||||
|| AttrVal( $name, 'vitoconnect_raw_readings', 0 ) eq "1" )
|
|| AttrVal( $name, 'vitoconnect_raw_readings', 0 ) eq "1" )
|
||||||
{ $Reading = $feature->{feature}. "." . $key; }
|
{
|
||||||
|
$Reading = $feature->{feature} . "." . $key;
|
||||||
|
}
|
||||||
my $Type = $properties->{$key}->{type};
|
my $Type = $properties->{$key}->{type};
|
||||||
my $Value = $properties->{$key}->{value};
|
my $Value = $properties->{$key}->{value};
|
||||||
if ( $Type eq "array" ) {
|
if ( $Type eq "array" ) {
|
||||||
@ -1951,23 +2030,22 @@ sub vitoconnect_getResourceCallback {
|
|||||||
if ( ref($Value) eq 'ARRAY' ) {
|
if ( ref($Value) eq 'ARRAY' ) {
|
||||||
my $Array = ( join( ",", @$Value ) );
|
my $Array = ( join( ",", @$Value ) );
|
||||||
readingsBulkUpdate( $hash, $Reading, $Array );
|
readingsBulkUpdate( $hash, $Reading, $Array );
|
||||||
Log3 $name, 5,
|
Log3 $name, 5, "$name - $Reading $Array ($Type)";
|
||||||
"$name - $Reading $Array ($Type)";
|
}
|
||||||
} else {
|
else {
|
||||||
Log3 $name, 4, "$name - Array Workaround for Property: $Reading";
|
Log3 $name, 4,
|
||||||
|
"$name - Array Workaround for Property: $Reading";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ( $Type eq "Schedule" ) {
|
elsif ( $Type eq "Schedule" ) {
|
||||||
my $Result = encode_json($Value);
|
my $Result = encode_json($Value);
|
||||||
readingsBulkUpdate( $hash, $Reading, $Result );
|
readingsBulkUpdate( $hash, $Reading, $Result );
|
||||||
Log3 $name, 5,
|
Log3 $name, 5, "$name - $Reading: $Result ($Type)";
|
||||||
"$name - $Reading: $Result ($Type)";
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
readingsBulkUpdate( $hash, $Reading, $Value );
|
readingsBulkUpdate( $hash, $Reading, $Value );
|
||||||
Log3 $name, 5,
|
Log3 $name, 5, "$name - $Reading: $Value ($Type)";
|
||||||
"$name - $Reading: $Value ($Type)";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1989,7 +2067,8 @@ sub vitoconnect_action {
|
|||||||
my $gw = $hash->{".gw"};
|
my $gw = $hash->{".gw"};
|
||||||
my $dev = AttrVal( $name, 'vitoconnect_device', 0 );
|
my $dev = AttrVal( $name, 'vitoconnect_device', 0 );
|
||||||
my $param = {
|
my $param = {
|
||||||
url => $apiURLBase ."installations/$installation/gateways/$gw/"
|
url => $apiURLBase
|
||||||
|
. "installations/$installation/gateways/$gw/"
|
||||||
. "devices/$dev/features/$feature",
|
. "devices/$dev/features/$feature",
|
||||||
hash => $hash,
|
hash => $hash,
|
||||||
header => "Authorization: Bearer $access_token\r\n"
|
header => "Authorization: Bearer $access_token\r\n"
|
||||||
@ -2003,6 +2082,7 @@ sub vitoconnect_action {
|
|||||||
Log3 $name, 4, "$name - data=$param->{data}";
|
Log3 $name, 4, "$name - data=$param->{data}";
|
||||||
( my $err, my $msg ) = HttpUtils_BlockingGet($param);
|
( my $err, my $msg ) = HttpUtils_BlockingGet($param);
|
||||||
my $decode_json = eval { decode_json($msg) };
|
my $decode_json = eval { decode_json($msg) };
|
||||||
|
|
||||||
if ( $err ne "" || $decode_json->{statusCode} ne "" ) {
|
if ( $err ne "" || $decode_json->{statusCode} ne "" ) {
|
||||||
Log3 $name, 1, "$name - set $name $opt @args: Fehler während der "
|
Log3 $name, 1, "$name - set $name $opt @args: Fehler während der "
|
||||||
. "Befehlsausführung: $err :: $msg";
|
. "Befehlsausführung: $err :: $msg";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user