Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Wunsch: Pollenflug-(Adapter/wasauchimmer)

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Wunsch: Pollenflug-(Adapter/wasauchimmer)

    This topic has been deleted. Only users with topic management privileges can see it.
    • Homoran
      Homoran Global Moderator Administrators @SBorg last edited by

      @SBorg
      ich habe aber noch den 1.4.2
      Das kann es nicht sein.

      Jetzt kam wenigstens die Fehlermeldung:

      javascript.0 script.js.Wetter_und_Klima.Pollenskript: TypeScript compilation had errors: import request = require("request"); ^ ERROR: Cannot find module 'request'.
      

      Aber laut putty ist es da

      1 Reply Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @SBorg last edited by

        @SBorg

        Habe noch zwei ungelöste Threads gefunden:

        https://forum.iobroker.net/topic/18086/js-request-modul-installieren
        und
        https://forum.iobroker.net/topic/17321/typescript-modul-request-geht-nicht-mehr

        1 Reply Last reply Reply Quote 0
        • SBorg
          SBorg Forum Testing Most Active last edited by

          Ok, Theorie gestrichen, zumindest mochte er ab da bei mir nicht mehr 😉
          Ersetze mal die "request-Zeile" jeweils mit diesen beiden Versionen:

          import * as request from "request";
          oder
          const request = require("request");
          
          Homoran 1 Reply Last reply Reply Quote 0
          • Homoran
            Homoran Global Moderator Administrators @SBorg last edited by

            @SBorg sagte in Wunsch: Pollenflug-(Adapter/wasauchimmer):

            import * as request from "request";

            Danke!

            Antwort1:

            javascript.0 script.js.Wetter_und_Klima.Pollenskript: TypeScript compilation had errors: import * as request from "request"; ^ ERROR: Cannot find module 'request'.
            

            Antwort2:

            javascript.0 script.js.Wetter_und_Klima.Pollenskript: TypeScript compilation had errors: const request = require("request"); ^ ERROR: Cannot redeclare block-scoped variable 'request'.
            

            Das Skript ist aber in TypeScript geschrieben

            1 Reply Last reply Reply Quote 0
            • SBorg
              SBorg Forum Testing Most Active last edited by

              Sprach der Blinde zum tauben...
              Ich kann zwar leidlich JS, aber TS ist ne andere Hausnummer. Zumindest Antwort 1 ist mir mittlerweile klar, es braucht keinen "import" mehr.
              Zumindest habe ich jetzt keinen Compilation-Error mehr (geht aber immer noch nicht).
              Füge mal ganz oben unter "use strict..." ~Zeile 8 noch ein

              export {};
              

              ein, ev. geht es ja bei dir.

              Homoran 1 Reply Last reply Reply Quote 0
              • Segway
                Segway @SBorg last edited by

                @SBorg sagte in Wunsch: Pollenflug-(Adapter/wasauchimmer):

                IMHO am JS-Controller. Seit 1.5.7

                Läuft bei mir mit 1.5.7 einwandfrei

                1 Reply Last reply Reply Quote 0
                • Homoran
                  Homoran Global Moderator Administrators @SBorg last edited by

                  @SBorg

                  javascript.0 script.js.Wetter_und_Klima.Pollenskript: TypeScript compilation had errors: import request = require("request"); ^ ERROR: Cannot find module 'request'.
                  

                  Ich habe aber wieder in Zeile +/- 152 den import reingenommen

                  1 Reply Last reply Reply Quote 0
                  • SBorg
                    SBorg Forum Testing Most Active last edited by

                    @Homoran sagte in Wunsch: Pollenflug-(Adapter/wasauchimmer):

                    const request = require("request");

                    Ne, der "import" wird nicht funktionieren, deswegen läuft es bei @Segway auch bspw. einfach durch auskommentieren. Der "richtige" Weg ist schon

                    const request = require("request");
                    

                    aber anscheinend hat er dann, warum auch immer, ein Problem die Seite zu parsen (vermutlich weil request doch nicht funktioniert...).

                    Homoran 1 Reply Last reply Reply Quote 0
                    • Homoran
                      Homoran Global Moderator Administrators @SBorg last edited by

                      @SBorg sagte in Wunsch: Pollenflug-(Adapter/wasauchimmer):

                      const request = require("request");

                      Ok
                      Also wieder zurück und siehe da:

                      13:38:12.863	info	javascript.0 script.js.Wetter_und_Klima.Pollenskript: TypeScript compilation successful
                      

                      Aber die anderen Fehler bleiben und die WErte werden nicht gefüllt

                      1 Reply Last reply Reply Quote 0
                      • Segway
                        Segway last edited by

                        @SBorg & @Homoran :

                        Also ich revidiere folgendes:

                        Auf meinem Produktivsystem gerade eingespielt das Skript und es läuft auch nicht. 😞 Nun bin ich genau so schlauh wie Ihr:

                        13:44:34.106	[error]	javascript.0 script.js.UserDefined.DasWetter.Pollenvorhersage: TypeScript compilation failed: import request = require("request"); ^ ERROR: Cannot find module 'request'.
                        

                        und

                        javascript.0	2019-03-11 13:44:34.104	error	ERROR: Cannot find module 'request'.
                        javascript.0	2019-03-11 13:44:34.104	error	^
                        javascript.0	2019-03-11 13:44:34.104	error	import request = require("request");
                        javascript.0	2019-03-11 13:44:34.104	error	script.js.UserDefined.DasWetter.Pollenvorhersage: TypeScript compilation failed: 
                        
                        1 Reply Last reply Reply Quote 0
                        • SBorg
                          SBorg Forum Testing Most Active last edited by

                          ^^ Solange man es anscheinend kpl. in Ruhe lässt funktioniert es...
                          Darf man hier fluchen und mal K*cke in die Runde werfen (nur wörtlich, nicht physisch 😉 )
                          Funktioniert bei mir, also geht auch request. Probiert bitte mal folgendes:
                          Neues TS mit folgendem Inhalt anlegen

                          export {};
                          const request = require('request');
                          
                          request('https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY', { json: true }, (err, res, body) => {
                            if (err) { return console.log(err); }
                            console.log(body.url);
                            console.log(body.explanation);
                          });
                          

                          Da sollte nun bisserl was in der Console auftauchen...

                          Homoran 2 Replies Last reply Reply Quote 0
                          • AlCalzone
                            AlCalzone Developer last edited by

                            Um kurz meinen Senf dazu zu geben:

                            • request ist im JS-Adapter per Default geladen und muss nicht extra importiert oder required werden.
                            • Warnmeldungen im Callback bedeuten für mich, dass der Request funktioniert hat, aber die Antwort ein Problem enthält oder fehlerhaft ausgewertet wird.

                            Es sollte also eine noch kürzere Version des Skripts von meinem Vorposter funktionieren:

                            request('https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY', { json: true }, (err, res, body) => {
                              if (err) { return console.log(err); }
                              console.log(body.url);
                              console.log(body.explanation);
                            });
                            
                            Homoran 1 Reply Last reply Reply Quote 1
                            • Homoran
                              Homoran Global Moderator Administrators @SBorg last edited by

                              @SBorg sagte in Wunsch: Pollenflug-(Adapter/wasauchimmer):

                              ^^ Solange man es anscheinend kpl. in Ruhe lässt funktioniert es...

                              Das ist genau das was ich beobachte und NICHT verstehe

                              1 Reply Last reply Reply Quote 0
                              • Homoran
                                Homoran Global Moderator Administrators @AlCalzone last edited by

                                @AlCalzone

                                läuft wunderbar:

                                14:03:36.927	info	javascript.1 Stop script script.js.Wetter_und_Klima.request_test
                                14:03:36.929	info	javascript.0 Stop script script.js.Wetter_und_Klima.request_test
                                14:03:40.311	info	javascript.0 script.js.Wetter_und_Klima.request_test: compiling TypeScript source...
                                14:03:40.311	info	javascript.0 script.js.Wetter_und_Klima.request_test: TypeScript compilation successful
                                14:03:40.311	info	javascript.0 script.js.Wetter_und_Klima.request_test: registered 0 subscriptions and 0 schedules
                                14:03:41.180	info	javascript.0 script.js.Wetter_und_Klima.request_test: https://apod.nasa.gov/apod/image/1903/M82Magnet_SOFIA_960.jpg
                                14:03:41.180	info	javascript.0 script.js.Wetter_und_Klima.request_test: Are galaxies giant magnets? Yes, but the magnetic fields in galaxies are typically much weaker than on Earth's surface, as well as more complex and harder to measure. Recently, though, the HAWC+ instrument onboard the airborne (747) SOFIA observatory has been successful in detailing distant magnetic fields by observing infrared light polarized by reflection from dust grains. Featured here, HAWC+ observations of the M82, the Cigar galaxy, show that the central magnetic field is perpendicular to the disk and parallel to the strong supergalactic wind. This observation bolsters the hypothesis that M82's central magnetic field helps its wind transport the mass of millions of stars out from the central star-burst region. The featured image shows magnetic field lines superposed on top of an optical light (gray) and hydrogen gas (red) image from Kitt Peak National Observatory, further combined with infrared images (yellow) from SOFIA and the Spitzer Space Telescope. The Cigar Galaxy is about 12 million light years distant and visible with binoculars towards the constellation of the Great Bear.
                                
                                1 Reply Last reply Reply Quote 0
                                • Nashra
                                  Nashra Most Active Forum Testing last edited by

                                  Habe gerade mal versucht im js Request einzutragen. Kleingeschrieben steht es schon drin
                                  aber ich dachte, nachdem was ich hier gelesen habe, versuch es mal mit Großschreibung
                                  also so: Request
                                  Ergebnis:

                                  javascript.0	2019-03-11 14:04:32.312	info	npm install Request --production --prefix "/opt/iobroker/node_modules/iobroker.javascript" (System call)
                                  javascript.0	2019-03-11 14:04:32.309	error	Cannot install Request: 1
                                  javascript.0	2019-03-11 14:04:32.251	error	npm ERR! A complete log of this run can be found in: npm ERR! /home/iobroker/.npm/_logs/2019-03-11T13_04_32_241Z-debug.log
                                  javascript.0	2019-03-11 14:04:32.249	error	
                                  javascript.0	2019-03-11 14:04:32.235	error	ERR! 404 Not Found: Request@latest
                                  javascript.0	2019-03-11 14:04:32.233	error	
                                  javascript.0	2019-03-11 14:04:32.230	error	npm
                                  javascript.0	2019-03-11 14:04:32.224	error	ERR! code E404
                                  javascript.0	2019-03-11 14:04:32.223	error	npm
                                  javascript.0	2019-03-11 14:04:27.455	info	npm install Request --production --prefix "/opt/iobroker/node_modules/iobroker.javascript" (System call)
                                  
                                  Homoran 1 Reply Last reply Reply Quote 0
                                  • Homoran
                                    Homoran Global Moderator Administrators @Nashra last edited by

                                    @Nashra
                                    ich habe jetzt beide wieder rausgenommen, da request ja schon im js-Adapter integriert sein soll.

                                    Hilft auch nicht

                                    1 Reply Last reply Reply Quote 0
                                    • SBorg
                                      SBorg Forum Testing Most Active last edited by

                                      Danke @AlCalzone
                                      Ich debuge es gerade, Daten kommen, aber nicht so wie sie wohl waren/sollen.
                                      ...und fragt nicht warum es mal ging, oder jetzt nicht geht, oder... 😉

                                      Homoran 1 Reply Last reply Reply Quote 0
                                      • Nashra
                                        Nashra Most Active Forum Testing last edited by

                                        Nachtrag noch von mir...
                                        Fehlermeldungen ohne Ende aber Datenpunkte sind angelegt und werden auch gefüllt.

                                        1 Reply Last reply Reply Quote 0
                                        • Homoran
                                          Homoran Global Moderator Administrators @SBorg last edited by Homoran

                                          @SBorg
                                          ich hatte mal den Quelltext heruntergelden und bei regex101 getestet.

                                          Das klappte ganz gut.
                                          Im Parser Adapter bekam ich dann live eine 503 forbidden
                                          Da kann ich ja keinen useragent eingeben

                                          1 Reply Last reply Reply Quote 0
                                          • Homoran
                                            Homoran Global Moderator Administrators @SBorg last edited by

                                            @SBorg sagte in Wunsch: Pollenflug-(Adapter/wasauchimmer):

                                            Solange man es anscheinend kpl. in Ruhe lässt funktioniert es...

                                            Mir fällt gerade die Meldung auf:

                                            TypeScript compilation successful
                                            

                                            Das heisst doch:
                                            sobald man das Skript anfasst wird es neu kompiliert!

                                            ...und dann läuft es nicht mehr

                                            AlCalzone 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate
                                            FAQ Cloud / IOT
                                            HowTo: Node.js-Update
                                            HowTo: Backup/Restore
                                            Downloads
                                            BLOG

                                            451
                                            Online

                                            31.8k
                                            Users

                                            80.0k
                                            Topics

                                            1.3m
                                            Posts

                                            43
                                            266
                                            43610
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo