Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Selbst erstellter Datenpunkt, Problem <0 [gelöst]

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Selbst erstellter Datenpunkt, Problem <0 [gelöst]

    This topic has been deleted. Only users with topic management privileges can see it.
    • liv-in-sky
      liv-in-sky last edited by

      sehe ich da ein komma beim val wert ? - das ist keine zahl in javascript

      H 1 Reply Last reply Reply Quote 0
      • H
        hardl @liv-in-sky last edited by

        @liv-in-sky Ja, alle Werte in den Datenpunkten der Objekte sind mit Komma.

        liv-in-sky 1 Reply Last reply Reply Quote 0
        • liv-in-sky
          liv-in-sky @hardl last edited by

          @hardl zahlen nur mit punkt in javascript

          daher muss zuerst das komma in einen punkt verwandelt werden und dann das ganze wieder in eine zahl

          H 1 Reply Last reply Reply Quote 0
          • H
            hardl @liv-in-sky last edited by

            @liv-in-sky Komischerweise kommt in den Protokollen das Komma nur bei glatten Werten mit ",0", bei ,1-9 wird ein Punkt dargestellt.
            Welcher "state" wird nicht gefunden?
            Bildschirm­foto 2023-01-20 um 10.59.08.png

            Homoran Codierknecht 3 Replies Last reply Reply Quote 0
            • Homoran
              Homoran Global Moderator Administrators @hardl last edited by

              @hardl bitte keine Screenshots! als Text in code-tags posten!

              1 Reply Last reply Reply Quote 0
              • Codierknecht
                Codierknecht Developer Most Active @hardl last edited by Codierknecht

                @hardl sagte in Selbst erstellter Datenpunkt, Problem <0:

                Welcher "state" wird nicht gefunden?

                Hast Du irgendwo (hinter den anderen) vielleicht noch einen verwaisten Block rumdümpeln?
                Oder hast Du vergessen, in einem Block das "Object ID" durch einen echten DP zu ersetzen?

                H 1 Reply Last reply Reply Quote 0
                • Homoran
                  Homoran Global Moderator Administrators @hardl last edited by

                  @hardl sagte in Selbst erstellter Datenpunkt, Problem <0:

                  Komischerweise kommt in den Protokollen das Komma nur bei glatten Werten mit ",0", bei ,1-9 wird ein Punkt dargestellt.

                  wenn ich es richtig entziffern kann ist das Komma kein Dezimaltrenner, sondern als Abschluss aller Werte vorhanden

                  H 1 Reply Last reply Reply Quote 0
                  • H
                    hardl @Homoran last edited by

                    @homoran sorry,

                    
                    javascript.0
                    2023-01-20 11:31:36.766	warn	at processImmediate (node:internal/timers:466:21)
                    
                    javascript.0
                    2023-01-20 11:31:36.765	warn	at Immediate._onImmediate (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/src/lib/adapter/adapter.js:5916:56)
                    
                    javascript.0
                    2023-01-20 11:31:36.765	warn	at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:593:29)
                    
                    javascript.0
                    2023-01-20 11:31:36.765	warn	at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1244:38)
                    
                    javascript.0
                    2023-01-20 11:31:36.765	warn	at Object.<anonymous> (script.js.Poolsteuerung.Debug_Diff:6:3)
                    
                    javascript.0
                    2023-01-20 11:31:36.765	warn	at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1719:20)
                    
                    javascript.0
                    2023-01-20 11:31:36.764	warn	State "Object ID" not found
                    
                    javascript.0
                    2023-01-20 11:31:36.764	info	script.js.Poolsteuerung.Debug_Diff: getState(id=mqtt.0.ESP_Easy.Solarsensor.temperature, timerId=undefined) => {"val":20.6,"ack":true,"ts":1674210696758,"q":0,"from":"system.adapter.mqtt.0","user":"system.user.admin","lc":1674210696758}
                    
                    javascript.0
                    2023-01-20 11:31:36.763	info	script.js.Poolsteuerung.Debug_Diff: number
                    
                    javascript.0
                    2023-01-20 11:31:36.763	info	script.js.Poolsteuerung.Debug_Diff: getState(id=mqtt.0.ESP_Easy.Poolsensor.temperature, timerId=undefined) => {"val":21.1,"ack":true,"ts":1674210695846,"q":0,"from":"system.adapter.mqtt.0","user":"system.user.admin","lc":1674210472569}
                    
                    javascript.0
                    2023-01-20 11:31:36.763	info	script.js.Poolsteuerung.Debug_Diff: number
                    
                    Homoran 1 Reply Last reply Reply Quote 0
                    • Homoran
                      Homoran Global Moderator Administrators @hardl last edited by

                      @hardl

                      geht es um diese Kommas?
                      Screenshot_20230120-114449_Firefox.jpg

                      Die gehören nicht zur Zahl.

                      1 Reply Last reply Reply Quote 0
                      • H
                        hardl @Codierknecht last edited by

                        @codierknecht Nein, das Script ist neu und nichts dahinter.
                        Alle DP habe ich nochmals geprüft.

                        Homoran Codierknecht 2 Replies Last reply Reply Quote 0
                        • Homoran
                          Homoran Global Moderator Administrators @hardl last edited by

                          @hardl sagte in Selbst erstellter Datenpunkt, Problem <0:

                          @codierknecht Nein, das Script ist neu und nichts dahinter.
                          Alle DP habe ich nochmals geprüft.

                          nein!
                          bei aktualisiere fehlt die zu aktualisierende DP ID

                          H 1 Reply Last reply Reply Quote 0
                          • Codierknecht
                            Codierknecht Developer Most Active @hardl last edited by

                            @hardl sagte in Selbst erstellter Datenpunkt, Problem <0:

                            @codierknecht Nein, das Script ist neu und nichts dahinter.
                            Alle DP habe ich nochmals geprüft.

                            Schau doch mal in den JS-Code, wo da ein "Object ID" versteckt ist.
                            Das muss ja irgendwoher kommen.

                            1 Reply Last reply Reply Quote 0
                            • H
                              hardl @Homoran last edited by

                              @homoran Inzwischen habe ich gesehen, dass bei glatt 21 keine Punkte oder Kommas dargestellt werden.
                              Du hast natürlich Recht......
                              Ich habe das Object mit Ist-Diff ersetzt und der Fehler ist weg.

                              Homoran 1 Reply Last reply Reply Quote 0
                              • Homoran
                                Homoran Global Moderator Administrators @hardl last edited by Homoran

                                @hardl sagte in Selbst erstellter Datenpunkt, Problem <0:

                                Ich habe das Object mit Ist-Diff ersetzt und der Fehler ist weg.

                                heisst?

                                zeigen!

                                H 1 Reply Last reply Reply Quote 0
                                • H
                                  hardl @Homoran last edited by

                                  @homoran

                                  
                                  admin.0
                                  2023-01-20 12:05:00.946	info	<== Disconnect system.user.admin from ::ffff:192.168.178.22 javascript
                                  
                                  admin.0
                                  2023-01-20 12:05:00.946	info	<== Disconnect system.user.admin from ::ffff:192.168.178.22 javascript
                                  
                                  javascript.0
                                  2023-01-20 12:04:56.994	info	script.js.Poolsteuerung.Debug_Diff: registered 1 subscription, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
                                  
                                  javascript.0
                                  2023-01-20 12:04:56.994	info	script.js.Poolsteuerung.Debug_Diff: subscribe: {"pattern":{"id":"mqtt.0.ESP_Easy.Solarsensor.temperature","change":"ne","q":0},"name":"script.js.Poolsteuerung.Debug_Diff"}
                                  
                                  javascript.0
                                  2023-01-20 12:04:56.988	info	Start javascript script.js.Poolsteuerung.Debug_Diff
                                  
                                  

                                  Ich werde jetzt mal sehen, wie ich einen Debug Block in das normale Script einfüge, um zu sehen was passiert, wenn die Differenz <0 ist.

                                  Homoran 1 Reply Last reply Reply Quote 0
                                  • Homoran
                                    Homoran Global Moderator Administrators @hardl last edited by

                                    @hardl zeig doch bitte das jetzige Script

                                    H 1 Reply Last reply Reply Quote 0
                                    • H
                                      hardl @Homoran last edited by

                                      @homoran Bildschirm­foto 2023-01-20 um 12.14.39.png

                                      paul53 1 Reply Last reply Reply Quote 0
                                      • paul53
                                        paul53 @hardl last edited by paul53

                                        @hardl
                                        Keine Trigger innerhalb von Triggern anordnen!
                                        Vorschlag:

                                        Bild_2023-01-20_123834738.png

                                        H 1 Reply Last reply Reply Quote 0
                                        • H
                                          hardl @paul53 last edited by

                                          @paul53 @Homoran @Codierknecht, Ich habe jetzt einfach die inneren Trigger und auch die später eingefügte Zeile, damit unter 0 nicht gerechnet wird, entfernt.
                                          Es sieht so aus, als ob damit auch mein Problem erledigt ist.
                                          Der Datenpunkt nimmt jetzt problemlos negative und positive Zahlen auf.

                                          Ich danke Euch für die super gute und schnelle Hilfe und habe dabei auch Grundlagen des Debuggen gelernt.

                                          Sollte noch etwas auftauchen, melde ich mich.

                                          paul53 1 Reply Last reply Reply Quote 0
                                          • paul53
                                            paul53 @hardl last edited by

                                            @hardl sagte: die inneren Trigger und auch die später eingefügte Zeile, damit unter 0 nicht gerechnet wird, entfernt.

                                            Du liest aber nicht den Datenpunkt "Ist-Diff" gleich wieder ein, nachdem er geschrieben wurde? Das funktioniert wegen der asynchronen Ausführung von "steuere" nicht. Deshalb verwendet man Variablen.

                                            H 2 Replies Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            636
                                            Online

                                            32.0k
                                            Users

                                            80.5k
                                            Topics

                                            1.3m
                                            Posts

                                            blockly
                                            5
                                            53
                                            2322
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo