Neues Modul: OilFox

Begonnen von eisler, 09 März 2020, 10:42:48

Vorheriges Thema - Nächstes Thema

eisler

Da ich zur zeit leider keinen zugriff auf einen OilFox wäre ein Auszug aus dem logfile hilfreich.

Grüße
Stephan

DoubleD

#31
Zitat von: eisler am 01 September 2020, 20:16:38
Da ich zur zeit leider keinen zugriff auf einen OilFox wäre ein Auszug aus dem logfile hilfreich.

Grüße
Stephan

Hallo Stephan





2020.09.02 05:58:25 5: OilFox (HeizoelBruck) - Notify: $VAR1 = [
          'ATTR HeizoelBruck verbose 5'
        ];

2020.09.02 05:58:33 3: HeizoelBruck: set called with update
2020.09.02 05:58:33 3: HeizoelBruck: set update
2020.09.02 05:58:33 5: doUpdate() called.
2020.09.02 05:58:33 2: LOGIN TOKEN MISSING OR EXPIRED
2020.09.02 05:58:33 5: OilFox (HeizoelBruck) - Notify: $VAR1 = [
          'state: disconnected'
        ];

2020.09.02 05:58:33 3: Reconnecting...
2020.09.02 05:58:34 2: {"token_type":"Bearer",....DIyIn0.7nqjlnjfwYmqfvVOs...."}
2020.09.02 05:58:34 5: OilFox (HeizoelBruck) - Notify: $VAR1 = [
          'token: ....NZeTspjVssNgvTZVIXC_1JPGOzyCMai9wOlywf1_kKaHUNIGnkA....',
          'expires: 2020-09-02 06:03:34'
        ];

2020.09.02 05:58:34 5: OilFox (HeizoelBruck) - Notify: $VAR1 = [
          'state: authenticated'
        ];

2020.09.02 05:58:34 5: OilFox(s) found
2020.09.02 05:58:34 5: <!doctype html><html lang="en"><head><title>HTTP Status 404 – Not Found</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 404 – Not Found</h1></body></html>
2020.09.02 05:58:34 2:  - JSON error while request: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<!doctype html><html...") at ./FHEM/12_OilFox.pm line 435.


Ich habe teile vom token gelöscht. Sollte der wichtig sein sag bitte bescheid dann bekommst ihn per PN.

Danke fürs anschauen!

Gruß
Daniel

DoubleD

#32
Hallo Stephan,

ich hab mal etwas weiter getestet, es scheint so als sei die API-Url nicht mehr gültig/erreichbar.
Echtl hat der Hersteller diese geändert.

Wie könnte man die neue URL herausfinden. In der Android-App muss die ja drin stecken weil diese funktioniert...

Gruß
Daniel

eisler

Hallo Daniel,

"HTTP Status 404 – Not Found" sieht genau danach aus.
Wenn du die URL herausfinden kannst kann man das einfach testen.

Grüße
Stephan

DoubleD

Zitat von: eisler am 02 September 2020, 22:29:45
Hallo Daniel,

"HTTP Status 404 – Not Found" sieht genau danach aus.
Wenn du die URL herausfinden kannst kann man das einfach testen.

Grüße
Stephan

Wie bekommt man die URL raus? Woher hattest du sie bei der Erstellung des Modules?

amenomade

Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

eisler

danke amenomade das sieht gut aus.
Ich schaue mal ob ich diese Woche noch zeit finde das Modul anzupassen.

Grüße
Stephan

DoubleD

Hallo

mit diesem diff funktioniert das Modul wieder


*** 12_OilFox_DD.pm 2020-09-07 19:39:44.219672100 +0200
--- 12_OilFox.pm 2020-09-07 19:41:10.554729200 +0200
***************
*** 34,42 ****
  use Data::Dumper;
  use GPUtils qw(GP_Import);
 
! use constant API => "https://api.oilfox.io/";
! #use constant API => "https://api.oilfox.io/v3/";
! #use constant API => "https://api.oilfox.io/v4/";
 
  BEGIN {
      GP_Import(
--- 34,40 ----
  use Data::Dumper;
  use GPUtils qw(GP_Import);
 
! use constant API => "https://api.oilfox.io/v3/";
 
  BEGIN {
      GP_Import(
***************
*** 296,302 ****
                  }';
 
      HttpUtils_NonblockingGet({
!         url        => API . "v3/login",
          timeout    => 5,
          hash        => $hash,
          method      => "POST",
--- 294,300 ----
                  }';
 
      HttpUtils_NonblockingGet({
!         url        => API . "login",
          timeout    => 5,
          hash        => $hash,
          method      => "POST",
***************
*** 401,407 ****
      my $header = "Content-Type: application/json\r\nAccept: application/json\r\nAuthorization: Bearer " . $token;
 
      HttpUtils_NonblockingGet({
!         url        => API . "v4/summary",
          timeout    => 5,
          hash        => $hash,
          method      => "GET",
--- 399,405 ----
      my $header = "Content-Type: application/json\r\nAccept: application/json\r\nAuthorization: Bearer " . $token;
 
      HttpUtils_NonblockingGet({
!         url        => API . "user/summary",
          timeout    => 5,
          hash        => $hash,
          method      => "GET",
***************
*** 417,423 ****
      my ($param, $err, $data) = @_;
      my $hash = $param->{hash};
      my $name = $hash->{NAME};
!
      if($err ne "") {
          Log3 $name, 2, "error while requesting ".$param->{url}." - $err";     
                                             
--- 415,421 ----
      my ($param, $err, $data) = @_;
      my $hash = $param->{hash};
      my $name = $hash->{NAME};
!
      if($err ne "") {
          Log3 $name, 2, "error while requesting ".$param->{url}." - $err";     
                                             
***************
*** 435,441 ****
              Log3 $name, 5, $data;
             
              my $result = eval { decode_json($data) };
-
              if ($@) {
                  Log3( $name, 2, " - JSON error while request: $@");
                  return;
--- 433,438 ----
***************
*** 448,458 ****
              $hash->{OilFox}->{oilfox_name} = $myoilfox->{'name'};
              $hash->{OilFox}->{oilfox_hwid} = $myoilfox->{'hwid'};
              $hash->{OilFox}->{oilfox_tankVolume} = $myoilfox->{'tankVolume'};
!             $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');
 
--- 445,455 ----
              $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'};
         
              CONNECTED($hash,'connected');
 
Dateien 12_OilFox_DD.pm und 12_OilFox.pm sind verschieden.
37,39c37
< use constant API => "https://api.oilfox.io/";
< #use constant API => "https://api.oilfox.io/v3/";
< #use constant API => "https://api.oilfox.io/v4/";
---
> use constant API => "https://api.oilfox.io/v3/";
299c297
<         url        => API . "v3/login",
---
>         url        => API . "login",
404c402
<         url        => API . "v4/summary",
---
>         url        => API . "user/summary",
420c418
<
---
>
438d435
<
451,455c448,452
<             $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'};
---
>             $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'};


Login läuft noch über v3 aber das summary über v4.
JSON aus metering wurde lastMetering

Gruß
DD

eisler


Darkmann

Wird hier noch weiter entwickelt? Weil momentan scheint es nicht mehr zu gehen.

Gruß

Butzel

bei mir läuft es noch. Gerade heute geprüft.

Darkmann

Hi,

ich hatte es erst alexa-fhem in verdacht, aber Oilfox spammt das Logfile voll.

2021.01.18 19:08:15 2: LOGIN TOKEN MISSING OR EXPIRED
2021.01.18 19:08:15 3: Reconnecting...
2021.01.18 19:08:15 2: {"token_type":"Bearer","access_token":"iJKV1..........gekürzt...............JuNF_d6CNbMzeQ","refresh_token":"iJKV1............gekürzt..................RFd4gg"}


Kommt alle 5 Minuten wenn er einen refresh macht

Gruß

Butzel

ich lasse einen Eintrag nur bei Änderung zu. Minimiert das Logfile ungemein....

eisler

ich schaue mal was ich machen kann.

Grüße
Stephan

Butzel

Hallo zusammen,
kann es sein, dass eine wesentliche Änderung durchgeführt wurde ? Mein Oilfox ist seit 2 Tagen disconnected und lässt sich nicht mehr zur Zusammenarbeit bewegen. Die App zeigt zwar noch an, aber die api scheint nicht mehr zu reagieren. Ich bin ratlos. Hat jemand nähere Infos ?