From 195b015050dc0ff2cf9a7103b0e3e4a9e0a584cc Mon Sep 17 00:00:00 2001 From: eisler Date: Mon, 7 Sep 2020 18:25:34 +0000 Subject: [PATCH] 12_OilFox: API fix v4 git-svn-id: https://svn.fhem.de/fhem/trunk@22745 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/12_OilFox.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fhem/FHEM/12_OilFox.pm b/fhem/FHEM/12_OilFox.pm index b174793dc..5bde6f9c2 100644 --- a/fhem/FHEM/12_OilFox.pm +++ b/fhem/FHEM/12_OilFox.pm @@ -34,7 +34,7 @@ use Blocking; use Data::Dumper; use GPUtils qw(GP_Import); -use constant API => "https://api.oilfox.io/v3/"; +use constant API => "https://api.oilfox.io/"; BEGIN { GP_Import( @@ -294,7 +294,7 @@ sub APIAuth($) { }'; HttpUtils_NonblockingGet({ - url => API . "login", + url => API . "v3/login", timeout => 5, hash => $hash, method => "POST", @@ -399,7 +399,7 @@ sub get($) { my $header = "Content-Type: application/json\r\nAccept: application/json\r\nAuthorization: Bearer " . $token; HttpUtils_NonblockingGet({ - url => API . "user/summary", + url => API . "v4/summary", timeout => 5, hash => $hash, method => "GET", @@ -445,11 +445,11 @@ sub getResponse($) { $hash->{OilFox}->{oilfox_name} = $myoilfox->{'name'}; $hash->{OilFox}->{oilfox_hwid} = $myoilfox->{'hwid'}; $hash->{OilFox}->{oilfox_tankVolume} = $myoilfox->{'tankVolume'}; - $hash->{OilFox}->{oilfox_metering_value} = $myoilfox->{'metering'}->{'value'}; - $hash->{OilFox}->{oilfox_metering_fillingPercentage} = $myoilfox->{'metering'}->{'fillingPercentage'}; - $hash->{OilFox}->{oilfox_metering_liters} = $myoilfox->{'metering'}->{'liters'}; - $hash->{OilFox}->{oilfox_metering_currentOilHeight} = $myoilfox->{'metering'}->{'currentOilHeight'}; - $hash->{OilFox}->{oilfox_metering_battery} = $myoilfox->{'metering'}->{'battery'}; + $hash->{OilFox}->{oilfox_metering_value} = $myoilfox->{'lastMetering'}->{'value'}; + $hash->{OilFox}->{oilfox_metering_fillingPercentage} = $myoilfox->{'lastMetering'}->{'fillingPercentage'}; + $hash->{OilFox}->{oilfox_metering_liters} = $myoilfox->{'lastMetering'}->{'liters'}; + $hash->{OilFox}->{oilfox_metering_currentOilHeight} = $myoilfox->{'lastMetering'}->{'currentOilHeight'}; + $hash->{OilFox}->{oilfox_metering_battery} = $myoilfox->{'lastMetering'}->{'battery'}; CONNECTED($hash,'connected');