How to use the mqtt.topic function in mqtt

To help you get started, we’ve selected a few mqtt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github owagner / hm2mqtt / hm2mqtt-addon / addon / www / index.html View on Github external
for (var param in params) {
        if (param == 'hm.host') continue;
        var $this = $('[id="' + param + '"]');
        if ($this.attr('type') == 'checkbox') {
          if (params[param]) {
            $this.attr('checked', true);
          } else {
            $this.removeAttr('checked');
          }
        } else {
          $this.val(params[param]);
        }
      }

      if (!params['mqtt.topic']) $('[id="mqtt.topic"]').val('hm/');

      var hmhost = params['hm.host'].split(',');

      if (hmhost.indexOf('127.0.0.1:2000') !== -1) {
        $('#hs485d').attr('checked', true);
        ifaces.hs485d = true;
      } else {
        $('#hs485d').removeAttr('checked');
        ifaces.hs485d = false;
      }

      if (hmhost.indexOf('127.0.0.1:2001') !== -1) {
        $('#rfd').attr('checked', true);
        ifaces.rfd = true;
      } else {
        $('#rfd').removeAttr('checked');