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. ioBroker Allgemein
  4. Iobroker <> Domoticz

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    16
    1
    1.9k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    916

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.2k

Iobroker <> Domoticz

Scheduled Pinned Locked Moved ioBroker Allgemein
5 Posts 2 Posters 4.2k 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.
  • E Offline
    E Offline
    elRedeo
    wrote on last edited by
    #1

    2742_2017.05.21-22.01.55.png Hallo liebe Gemeinde,

    gestartet vor einem Jhr mit Domoticz, hat sich hier inzwischen ein tolles Sammelsurium an ESP's, 433MHz, z-Wave und diversen spezialteilen mit http-Interface angesammelt.

    Das klappt auch alles ganz gut, möchte aber jetzt, nachdem ich bei einem Freund ioBorker sah, auf diesen softmigrieren. Soweit der Wunsch…..

    Ich habe mir also das mqtt-Servermodul auf den iobroker gezogen und domoticz sendet nun seine Stati dahin.

    ch kann auch gut verfolgen wie alle messages ankommen , hier im Bild mit Domoticz out.

    iobroker legt dafür aber keine Devices an, da mache doch garantiert ich was total falsch, kann mir bitte jemand einen Tip geben?

    Danke

    elRedeo

    1 Reply Last reply
    0
    • DutchmanD Offline
      DutchmanD Offline
      Dutchman
      Developer Most Active Administrators
      wrote on last edited by
      #2

      @elRedeo:

      2017.05.21-22.01.55.pngHallo liebe Gemeinde,

      gestartet vor einem Jhr mit Domoticz, hat sich hier inzwischen ein tolles Sammelsurium an ESP's, 433MHz, z-Wave und diversen spezialteilen mit http-Interface angesammelt.

      Das klappt auch alles ganz gut, möchte aber jetzt, nachdem ich bei einem Freund ioBorker sah, auf diesen softmigrieren. Soweit der Wunsch…..

      Ich habe mir also das mqtt-Servermodul auf den iobroker gezogen und domoticz sendet nun seine Stati dahin.

      ch kann auch gut verfolgen wie alle messages ankommen , hier im Bild mit Domoticz out.

      iobroker legt dafür aber keine Devices an, da mache doch garantiert ich was total falsch, kann mir bitte jemand einen Tip geben?

      Danke

      elRedeo `

      So einfach geht das nicht, MQTT ist nur ein reader/message broker.

      Ich habe für domoticz ein script geschrieben in kombination von MQTT & Javascript, das kann ich demnäst posten um weiter zu helfen.

      Mein script erstellt die werten en schiest änderungen der werte per URL (domoticz API) zurück nach domoticz.

      Greetzz,

      Dutch

      1 Reply Last reply
      0
      • E Offline
        E Offline
        elRedeo
        wrote on last edited by
        #3

        Hallo Dutch,

        ja, das wäre toll wenn Du das mal posten könntest, ich bin im Bereich MQTT sehr unerfahren und taste mich gerade rest langsam ran.

        Gruß

        elRedeo

        1 Reply Last reply
        0
        • DutchmanD Offline
          DutchmanD Offline
          Dutchman
          Developer Most Active Administrators
          wrote on last edited by
          #4

          @elRedeo:

          Hallo Dutch,

          ja, das wäre toll wenn Du das mal posten könntest, ich bin im Bereich MQTT sehr unerfahren und taste mich gerade rest langsam ran.

          Gruß

          elRedeo `

          Na dan probiern wiers mal :), das script hat nog so einige schoenheitsfehler und ist mehr "bastler" arbeit aber es geht :mrgreen:

          Als erste erstellen wir uns die objecte, dazu per script die API auslesen von domoticz. Im script IP adress aendern, es werde nicht alle geraete ausgelesen.

          Siehe commentar "// Only create states for supported switchtypes ", den filter kannst du ausschalten oder erweitern.

          `var objekt, results, count_import;
          // Connect to Domoticz API interface and list all devices
          try {
              require("request")('http://xxx.xxx.x.xxx:8080/json.htm?type=devices', function (error, response, results) {
              objekt = JSON.parse(results);
          
              log ("ServerTime:"+ objekt.ServerTime);
              log ("Reading Domoticz device list : " + objekt.status);
              log("Total amount of Devices found: " + objekt.result.length);
          
              var i,j;
              for (i = 0; i < objekt.result.length; i++) {
                  // If received value is On/Off translate to boolean, otherwise use received value
                  if ( objekt.result[i].Data == 'On') {
                      state = true;
                  } else if ( objekt.result[i].Data == 'Off' ) {
                      state = false;
                  } else {
                      state = objekt.result[i].Data;
                  }
              // Only create states for supported switchtypes 
              if(objekt.result[i].SwitchType == "Push On Button" || objekt.result[i].SwitchType == "Doorbell" || objekt.result[i].SwitchType == "On/Off"){
          
                  //Create States for each device
                  createState("domoticz.Devices." + objekt.result[i].Name + '.STATE', {
                      name: objekt.result[i].Name,
                      type: 'boolean',
                      role: 'switch',
                      def: 'false',
                      idx: objekt.result[i].idx,
                      SwitchType: objekt.result[i].SwitchType
                  });
              } else {
                  // Error logging for unsupported devices
                  log("Device creation failed not supported yet! DeviceName : " + objekt.result[i].Name + " | SwitchType : " + objekt.result[i].SwitchType
                      + " | Subtype : " + objekt.result[i].SubType);
              }
          }});
          } catch (e) { console.error(e); }` 
          
          Damit sind die objecte erstellt und koennen die states abgefragt werden, dazu muss man aber immer das script neu starten das ist bloed.
          
          Aenderungen auf domitcz hohle ich mir per MQTT ein. Dazu iObroker als MQTT server einrichten und domoticz mit iObroker verbinden.
          
          {habe keine andere loesung gefunden um updates zu ueberwachen....}
          
          Dieses script uerbwacht den MQTT kanal von domoticz. Die daten kommen in JSON format, werden ausgelesen und objecte (vorher mit anderem script ersellt) 
          
          kriegen ihre updates:
          
          `~~[code]~~on({id: 'mqtt.0.domoticz.out', change: "any"}, function (obj) {
              try {
                  obj = JSON.parse(getState('mqtt.0.domoticz.out').val);
                  } catch (e) {
                      console.error('Cannot parse: ' + getState('mqtt.0.domoticz.out').val);
                      return;
                  }
                  var state = obj.nvalue;
                  // Translate number to boolean
                  if ( obj.nvalue == '1' ) {
                  state = true;
                  } else if ( obj.nvalue == '0' ) {
                      state = false;
                  }
                  setState('domoticz.Devices.' + obj.name + '.STATE', state);
                  log('Device : "' + obj.name + '" value updated to : ' + state );
              }
          );
          [/code]`
          
          Damit haben wir domticz > Iobroker fertig, jetzt noch iObroker > Domoticz  8-) 
          
          Dieses script ueberwacht alle domoticz states, bei aenderungen schikt er diese per HTTP API zu domoticz.
          
          Im moment aber nur TRUE/FALSE kommandos, fuer dimmer muesste dies noch angepasst werden. Ich wollte dazu den type afragen um damit das richtige commando zu erstellen aber durch OpenHab adapter brauch ich dieses script nicht mehr :)
          
          Eine function verhindert das ein update per MQTT (weil domoticz schaltet) den befehl nochmal schikt (loop protection), diese ist auf 2 sekunden eingestellt:
          
          `~~[code]~~//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);
          }
          
          [/code]`
          
          Das ist meine loesung zur Domoticz integration, read all devices, get updates, sent updates.
          
          Ist zwar noch ne baustelle und nicht optimal, aber bin ja auch kein pro hauptsache es laeuft  :mrgreen:  :mrgreen:  :mrgreen: 
          
          ~Dutch[/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i]
          
          1 Reply Last reply
          0
          • E Offline
            E Offline
            elRedeo
            wrote on last edited by
            #5

            Hi dutch,

            klasse, das ist ein Ansatz an dem ich mich entlang hangeln kann.

            Vielen Dank dafür

            elRedeo

            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
            FAQ Cloud / IOT
            HowTo: Node.js-Update
            HowTo: Backup/Restore
            Downloads
            BLOG

            302

            Online

            32.6k

            Users

            82.2k

            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