Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Statusänderung von iobroker mittles MQTT an Domoticz übergeben

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Statusänderung von iobroker mittles MQTT an Domoticz übergeben

    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rudiraz last edited by

      Hallo,

      nachdem ich mich nun etwas eingelesen habe, kommen einige Fragen 🙂

      Ich habe vorher Domoticz als System benutzt und bin nun auf iobroker umgestiegen.

      Da ich momentan noch Imperihome nutze (das von iobroker (noch) nicht unterstützt wird), möchte ich die states von iobroker nach Domoticz per mqtt und blockly an virtuelle Schalter übergeben. So kann ich bestimmte Stati noch in Imperihome einsehen.

      MQTT läuft auf beiden Systemen.

      Wie kann ich es nun anstellen, dass wenn sich ein State von iobroker von z.B. "False" auf "True" ändert, dass ich diese Änderung an Domoticz weitergeben kann, damit sich dort auch der Status ändern kann?

      Grüße

      1 Reply Last reply Reply Quote 0
      • Dutchman
        Dutchman Developer Most Active Administrators last edited by

        Hi,

        Ich hatte die dafür dich denn Link zu meinen Script gegeben darin steht wie man den HTML String (http) per Script ausführen kann?

        Eventuell sollte ich dich Mal einen komplette thread mit Script und HowTo dazu schreiben…?


        Send from mobile device

        1 Reply Last reply Reply Quote 0
        • R
          rudiraz last edited by

          Hi

          ja diesmal gehts ja von iobroker zu Domoticz (also die andere Richtung 🙂 )

          Aber schreib mir das mal auf….ich bin blutiger Anfänger

          1 Reply Last reply Reply Quote 0
          • Dutchman
            Dutchman Developer Most Active Administrators last edited by

            @rudiraz:

            Hi

            ja diesmal gehts ja von iobroker zu Domoticz (also die andere Richtung 🙂 )

            Aber schreib mir das mal auf….ich bin blutiger Anfänger `

            Der Code dazu steht in selber thread da waren 3 scripte.

            Wenn das nicht hilft muss ich abends ne how-to schreiben bin gerade unterwegs.

            Das Script hier unten überwacht die states welche du mir den anderen Script erstellt hast und sendet true/false per http-api ls Commando nach Domoticz

            //Configure IP & Port of domoticz
            var IP = 'xxx.xxx.x.xxx';
            var port = '8080';
            
            // Trigger on state within domotics devices    
            on({id: /^javascript.0.domoticz.Devices\./ , change: "any"}, function (obj) {
            
                var apiLink = '/json.htm?type=command¶m=switchlight&idx=';
                var switchvalue;
                var device = obj.common.idx;
                var switchcmd = '&switchcmd=';
                var httpcommand = "http://" + IP  + ':' + port + apiLink + device + switchcmd ;
            
                if (obj.state.val === true || obj.state.val == '1') {
                    switchvalue = 'On';
                    RFX_Command(httpcommand,switchvalue);
                } else {
                    switchvalue = 'Off';
                    RFX_Command(httpcommand,switchvalue);
                }
            });
            
            // Send switch command by HTTP to Domoticz API, avoid double commando within 2 seconds
            var previouscommand;
            function RFX_Command(httpcommand,switchvalue){
                if (previouscommand !== httpcommand + switchvalue) {
                    try {
                        require("request")(httpcommand + switchvalue);
                    } catch (e) { console.error(e); }
                    console.log("request: " + httpcommand + switchvalue);    
                    previouscommand = httpcommand + switchvalue;
                }
                // Clean previouscommand
                timeout = setTimeout(function () {
                previouscommand = "";
                }, 2000);
            }
            
            

            –-----------------------

            Send from mobile device

            1 Reply Last reply Reply Quote 0
            • R
              rudiraz last edited by

              OK, vielen Dank.

              Ich werde mich mal an deinen Scripten probieren 🙂

              Grüße

              1 Reply Last reply Reply Quote 0
              • Dutchman
                Dutchman Developer Most Active Administrators last edited by

                @rudiraz:

                OK, vielen Dank.

                Ich werde mich mal an deinen Scripten probieren 🙂

                Grüße `

                auf gut gelingen wen es hängt melde dich bei mir läuft es bis heute so 🙂

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

                Support us

                ioBroker
                Community Adapters
                Donate

                810
                Online

                31.7k
                Users

                79.8k
                Topics

                1.3m
                Posts

                2
                6
                811
                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