Skip to content
  • 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
Logo
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Benötige Hilfe bei der Script Erstellung

NEWS

  • Wartung am 15.11. – Forum ab 22:00 Uhr nicht erreichbar
    BluefoxB
    Bluefox
    11
    2
    208

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    7.9k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    1.7k

Benötige Hilfe bei der Script Erstellung

Benötige Hilfe bei der Script Erstellung

Scheduled Pinned Locked Moved Skripten / Logik
3 Posts 2 Posters 373 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.
  • 2 Offline
    2 Offline
    2hot4you
    wrote on last edited by
    #1

    Hallo Zusammen,

    da meine Programmier Kenntnisse noch in den Anfängen stecken brauche ich etwas Hilfe.

    Ich möchte meinen Wasserstand errechen. 😉

    Ich habe bekomme von einem NodeMCU einen Wert übergeben "sonoff.0.nodeMCU_10.SR04_Distance"

    Wie kann ich eine Variable mit dem errechneten Wert füllen ?

    Variable = 1000 * (1- ( 1,20,8 sonoff.0.nodeMCU_10.SR04_Distance ))

    ?????

    1 Reply Last reply
    0
    • paul53P Offline
      paul53P Offline
      paul53
      wrote on last edited by
      #2

      @2hot4you:

      Wie kann ich eine Variable mit dem errechneten Wert füllen ? `
      Meinst Du damit eine Skriptvariable oder einen Datenpunkt ? Mit Datenpunkt:

      const idSrc = "sonoff.0.nodeMCU_10.SR04_Distance";
      const idDst = "Wasserstand";
      
      // Datenpunkt erzeugen
      createState(idDst, 1000 * (1 - 0.96 * getState(idSrc).val), {type: 'number', unit: 'mm'}); 
      
      on(idSrc, function(dp) { // Triggern bei Wertänderung
         setState(idDst, 1000 * (1 - 0.96 * dp.state.val), true);
      });
      

      https://github.com/ioBroker/ioBroker.javascript/blob/master/doc/en/javascript.md

      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

      1 Reply Last reply
      0
      • 2 Offline
        2 Offline
        2hot4you
        wrote on last edited by
        #3

        @paul53:

        @2hot4you:

        Wie kann ich eine Variable mit dem errechneten Wert füllen ? `
        Meinst Du damit eine Skriptvariable oder einen Datenpunkt ? Mit Datenpunkt:

        const idSrc = "sonoff.0.nodeMCU_10.SR04_Distance";
        const idDst = "Wasserstand";
        
        // Datenpunkt erzeugen
        createState(idDst, 1000 * (1 - 0.96 * getState(idSrc).val), {type: 'number', unit: 'mm'}); 
        
        on(idSrc, function(dp) { // Triggern bei Wertänderung
           setState(idDst, 1000 * (1 - 0.96 * dp.state.val), true);
        });
        

        https://github.com/ioBroker/ioBroker.javascript/blob/master/doc/en/javascript.md `

        Danke, klappt super !!! 😄 😄 jetzt muss es nur noch Regnen !

        4872_regen.png

        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

        110

        Online

        32.4k

        Users

        81.3k

        Topics

        1.3m

        Posts
        Community
        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
        ioBroker Community 2014-2025
        logo
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Recent
        • Tags
        • Unread 0
        • Categories
        • Unreplied
        • Popular
        • GitHub
        • Docu
        • Hilfe