Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. [Gelöst] Problem mit URL Request: "Error: self signed certificate"

NEWS

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    24
    1
    1.4k

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    9.3k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    14
    1
    2.6k

[Gelöst] Problem mit URL Request: "Error: self signed certificate"

Scheduled Pinned Locked Moved Skripten / Logik
10 Posts 3 Posters 2.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thosch
    wrote on last edited by
    #1

    Hallo zusammen,

    ich möchte gerne in einem Skript eine URL Aufrufen lassen.

    Das Skript dazu bekomme ich auch gebaut, allerdings scheints Probleme mit dem "https" zu geben.

    Ich bekomme als error im log "Error: self signed certificate"

    Die URL die ausgeführt wird, gehört zu einer webcam, die für den SSL Zugriff offenbar ein selbstsigniertes Zertifikat verwendet. Zugriff ohne SSL lässt sich leider nicht aktivieren.

    Gibt es eine Möglichkeit iobroker dazu zu bringen auch diese Zertifikate zu akzeptieren?

    1 Reply Last reply
    0
    • apollon77A Offline
      apollon77A Offline
      apollon77
      wrote on last edited by
      #2

      Ich habe mal für dich gegoogelt … Erstes Ergebnis: https://stackoverflow.com/questions/108 ... ps-request

      Beitrag hat geholfen? Votet rechts unten im Beitrag :-) https://paypal.me/Apollon77 / https://github.com/sponsors/Apollon77

      • Debug-Log für Instanz einschalten? Admin -> Instanzen -> Expertenmodus -> Instanz aufklappen - Loglevel ändern
      • Logfiles auf Platte /opt/iobroker/log/… nutzen, Admin schneidet Zeilen ab
      1 Reply Last reply
      0
      • T Offline
        T Offline
        Thosch
        wrote on last edited by
        #3

        Danke!

        Leider komm ich damit auch nicht weiter. Habe nun folgenden Code:

        on({id: 'mihome.0.devices.switch_158d0002107b85.click', change: "ne"}, function (obj) {
          var value = obj.state.val;
          var oldValue = obj.oldState.val;
          if (getState("mihome.0.devices.switch_158d0002107b85.click").val == true) {
            var request = require("request");
            var agentOptions;
            var agent;
        
        agentOptions = {
          host: '192.168.178.161'
        , port: '443'
        , path: '/'
        , rejectUnauthorized: false
        };
        
        agent = new https.Agent(agentOptions);
        
        request({
          url: "https://192.168.178.161/cgi-bin/action.cgi?cmd=ir_led_off"
        , method: 'GET'
        , agent: agent
        }, function (err, resp, body) {
          // ...
        });
        }
        });
        

        Bekomme aber damit folgenden Fehler:

        javascript.0 2018-08-22 08:27:56.627 error at Object. <anonymous>(script.js.Cam.Skript2:16:13)

        javascript.0 2018-08-22 08:27:56.627 error Error in callback: ReferenceError: https is not defined

        Jemand noch eine Idee, was ich falsch mache?</anonymous>

        1 Reply Last reply
        0
        • apollon77A Offline
          apollon77A Offline
          apollon77
          wrote on last edited by
          #4

          Mal mindestens fehlt denke ich ein

          https = require(‚https‘);

          Und bitte die Anführungszeichen nicht kopieren sondern selber richtig schreiben ;-)

          Gesendet vom Handy …

          Beitrag hat geholfen? Votet rechts unten im Beitrag :-) https://paypal.me/Apollon77 / https://github.com/sponsors/Apollon77

          • Debug-Log für Instanz einschalten? Admin -> Instanzen -> Expertenmodus -> Instanz aufklappen - Loglevel ändern
          • Logfiles auf Platte /opt/iobroker/log/… nutzen, Admin schneidet Zeilen ab
          1 Reply Last reply
          0
          • AlCalzoneA Offline
            AlCalzoneA Offline
            AlCalzone
            Developer
            wrote on last edited by
            #5

            @Thosch:

            agent = new https.Agent(agentOptions);
            
            

            ReferenceError: https is not defined `

            Ja, ganz oben einfügen:

            const https = require("https");
            
            

            Warum `sudo` böse ist: https://forum.iobroker.net/post/17109

            1 Reply Last reply
            0
            • T Offline
              T Offline
              Thosch
              wrote on last edited by
              #6

              Danke!!

              Jetzt gibt das Skript keinen Error mehr aus.

              Allerdings wird offenbar die URL nicht ausgeführt.

              Wenn ich die URL im Browser ausführe, schaltet sich das IR-Licht meiner Webcam aus. Beim Skript tut sich allerdings nichts.

              1 Reply Last reply
              0
              • AlCalzoneA Offline
                AlCalzoneA Offline
                AlCalzone
                Developer
                wrote on last edited by
                #7

                Dann logge mal im Callback den Inhalt von resp und err:

                if (err) log(JSON.stringify(err));
                if (resp) log(JSON.stringify(resp));
                

                Warum `sudo` böse ist: https://forum.iobroker.net/post/17109

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  Thosch
                  wrote on last edited by
                  #8

                  Wirklich echt super, dass ihr mir auf die Sprünge helft!!

                  Sorry, ich bin totaler Neuanfänger mit Javascript.

                  Ich hab die Zeilen jetzt so eingebaut:

                  const https = require("https");
                  
                  on({id: 'javascript.0.Alarm', change: "ne"}, function (obj) {
                    var value = obj.state.val;
                    var oldValue = obj.oldState.val;
                    if (getState("javascript.0.Alarm").val == true) {
                      var request = require("request");
                      var agentOptions;
                      var agent;
                  
                  agentOptions = {
                    host: '192.168.178.161'
                  , port: '443'
                  , path: '/'
                  , rejectUnauthorized: false
                  };
                  
                  agent = new https.Agent(agentOptions);
                  
                  request({
                    url: "https://192.168.178.161/cgi-bin/action.cgi?cmd=ir_led_off"
                  , method: 'GET'
                  , agent: agent
                  }, function (err, resp, body) {
                  if (err) log(JSON.stringify(err));
                  if (resp) log(JSON.stringify(resp));
                  });
                  }
                  });
                  
                  

                  Bekomme aber keinen log Eintrag.

                  1 Reply Last reply
                  0
                  • AlCalzoneA Offline
                    AlCalzoneA Offline
                    AlCalzone
                    Developer
                    wrote on last edited by
                    #9

                    Dann wird der Request sehr wahrscheinlich nicht ausgeführt. Das kannst du am besten überprüfen, indem du direkt vor der Zeile noch eine Logausgabe einfügst.

                    Warum `sudo` böse ist: https://forum.iobroker.net/post/17109

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      Thosch
                      wrote on last edited by
                      #10

                      Der Request wird offenbar doch ausgeführt. Aber ich bekomme die Rückmeldung 401, da ich auch noch ganz vergessen hatte, dass die http Oberfläche durch Zugangsdaten gesperrt ist.

                      Mit der angepassten url: https://user:password@192.x usw. hats dann funktioniert!

                      Nochmal vielen Dank euch für die Hilfe!!!

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      Support us

                      ioBroker
                      Community Adapters
                      Donate

                      719

                      Online

                      32.5k

                      Users

                      81.7k

                      Topics

                      1.3m

                      Posts
                      Community
                      Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                      ioBroker Community 2014-2025
                      logo
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Home
                      • Recent
                      • Tags
                      • Unread 0
                      • Categories
                      • Unreplied
                      • Popular
                      • GitHub
                      • Docu
                      • Hilfe