Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Klaus-Anders

    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

    K
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Groups 0

    Klaus-Anders

    @Klaus-Anders

    0
    Reputation
    4
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Klaus-Anders Follow

    Latest posts made by Klaus-Anders

    • RE: Bitte um Hilfe bei MQTT zerlegen

      @paul53
      Vielen Dank, das funzt.

      posted in JavaScript
      K
      Klaus-Anders
    • Bitte um Hilfe bei MQTT zerlegen

      Hallo,
      ich habe Probleme beim zerlegen von einem Mqtt String.
      Der von hier verwendete Script zeigt keine Fehler.
      Es werden aber keine Datenpunkte angelegt.
      Ich kapier das einfach nicht, liegt wohl am Alter.

      hier mal der Script

      const JSPath = '0_userdata.0'/Example state/ // JS- Pfad
      const parsedStatesPath = JSPath + ".Pelletofen" // Pfad fuer geparste States
      const zigbee2mqttJsonPath = 'mqtt.0.service'/service/
      let IDs = [];

      $("[id=" + zigbee2mqttJsonPath + ".*]").each(function (id) {
      IDs.push(id)
      })

      on({id: IDs, change: "ne"}, function (obj) {
      let JsonObj = JSON.parse(obj.state.val)
      Object.keys(JsonObj).forEach(function(key){
      if (getState(obj.id.replace(zigbee2mqttJsonPath, parsedStatesPath)).notExist){
      createState(obj.id.replace(zigbee2mqttJsonPath, parsedStatesPath) + '.' + key, JsonObj[key], {read: true, write: true, type: typeof(JsonObj[key]), name: '' , desc: ''},function(){
      setState(obj.id.replace(zigbee2mqttJsonPath, parsedStatesPath) + '.' + key, JsonObj[key])
      })
      }else {
      setState(obj.id.replace(zigbee2mqttJsonPath, parsedStatesPath) + '.' + key, JsonObj[key])
      };
      })
      })

      1e7c0bb4-09ed-4202-b495-ddb2916ab141-grafik.png

      729b6c1c-7fd2-47b8-a763-dd8b4881d129-grafik.png

      Vilen Dank schonmal im voraus.
      Klaus

      posted in JavaScript
      K
      Klaus-Anders
    Community
    Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
    The ioBroker Community 2014-2023
    logo