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. [Vorlage] Wechselseitige Aktualisierung und Bedienung von Datenpunkten

NEWS

  • Neuer ioBroker-Blog online: Monatsrückblick März/April 2026
    BluefoxB
    Bluefox
    6
    1
    231

  • Verwendung von KI bitte immer deutlich kennzeichnen
    HomoranH
    Homoran
    9
    1
    227

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    18
    1
    896

[Vorlage] Wechselseitige Aktualisierung und Bedienung von Datenpunkten

Scheduled Pinned Locked Moved Skripten / Logik
javascriptblocklytemplate
3 Posts 3 Posters 1.5k Views 5 Watching
  • 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.
  • paul53P Offline
    paul53P Offline
    paul53
    wrote on last edited by paul53
    #1

    In Fällen, in denen der Wert von einem Gerät auf ein anderes Gerät (und umgekehrt) übertragen werden soll, muss man ein endloses Hin- und Her vermeiden. Damit ein Triggern auf das setState() verhindert wird, kann im Trigger die Quelle (from) ausgewertet werden.

    // Wechselseitige Aktualisierung von Datenpunkten
    const id1 = '...'; // Datenpunkt-ID vom Gerät 1
    const id2 = '...'; // Datenpunkt-ID vom Gerät 2
    const js = 'system.adapter.javascript.' + instance;
    
    on({id: id1, change: 'ne', fromNe: js}, function(dp) {
       setState(id2, dp.state.val);
    });
    
    on({id: id2, change: 'ne', fromNe: js}, function(dp) {
       setState(id1, dp.state.val);
    });
    
    

    In Blockly muss die aktuelle JS-Instanz fest eingetragen werden.

    493_blockly_wechsseitige_aktualisierung.jpg

    Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
    Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

    H 1 Reply Last reply
    6
    • paul53P paul53

      In Fällen, in denen der Wert von einem Gerät auf ein anderes Gerät (und umgekehrt) übertragen werden soll, muss man ein endloses Hin- und Her vermeiden. Damit ein Triggern auf das setState() verhindert wird, kann im Trigger die Quelle (from) ausgewertet werden.

      // Wechselseitige Aktualisierung von Datenpunkten
      const id1 = '...'; // Datenpunkt-ID vom Gerät 1
      const id2 = '...'; // Datenpunkt-ID vom Gerät 2
      const js = 'system.adapter.javascript.' + instance;
      
      on({id: id1, change: 'ne', fromNe: js}, function(dp) {
         setState(id2, dp.state.val);
      });
      
      on({id: id2, change: 'ne', fromNe: js}, function(dp) {
         setState(id1, dp.state.val);
      });
      
      

      In Blockly muss die aktuelle JS-Instanz fest eingetragen werden.

      493_blockly_wechsseitige_aktualisierung.jpg

      H Offline
      H Offline
      HeliosFan
      wrote on last edited by
      #2

      @paul53

      Bitte mehr davon.

      1 Reply Last reply
      1
      • G Offline
        G Offline
        g.polat
        wrote on last edited by
        #3

        klasse, genau sowas habe ich benötigt👍

        1 Reply Last reply
        1

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        Support us

        ioBroker
        Community Adapters
        Donate

        652

        Online

        32.8k

        Users

        82.8k

        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