Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. trying to get value of updated object id sent to telegram

    NEWS

    • Neues Video über Aliase, virtuelle Geräte und Kategorien

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    trying to get value of updated object id sent to telegram

    This topic has been deleted. Only users with topic management privileges can see it.
    • dony71
      dony71 last edited by

      Hi expert scripter
      I have problem in my blocky script
      I'm trying to get value of updated object id sent to telegram
      Blocky looks like below
      21d61185-ea7f-4abb-8b69-206b62161d85-image.png

      I have several mqtt.1 object, for ex. mqtt.1.bedroom, mqtt.1.classroom, etvc
      If there is update in value of one mqtt.1 object, for ex. mqtt.1.bedroom.MSG, I want telegram to send value of mqtt.1.bedroom.MSG
      However with this blocky, telegram only send word "Server" without value
      How to do this?

      dony71 paul53 2 Replies Last reply Reply Quote 0
      • dony71
        dony71 @dony71 last edited by

        @dony71 btw, i can understand german, so anybody can reply in german language

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

          @dony71 sagte: I want telegram to send value of mqtt.1.bedroom.MSG

          Bild_2021-08-12_214042.png

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

            @paul53 by inserting value "server", it will show all mqtt.1.* object, not only updated object
            so for ex. I have mqtt.1.bedroom.MSG and mqtt.1.classroom.MSG, then
            server = mqtt.1.bedroom.MSG,mqtt.1.classroom.MSG

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

              @dony71

              Wert (object value) shows the value of the just updated datapoint. You will find it under "Trigger".

              Bild_2021-08-12_223122.png
              If you want to send the ID (for ex. "mqtt.1.bedroom.MSG") of the updated datapoint:

              Bild_2021-08-12_223333.png

              If you want to send both (id and value):

              Bild_2021-08-12_224803.png

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

                @paul53 yeap, it works, thank you
                Now I have another problem
                I notice script will not trigger if object id not exist before
                for ex. let says object "mqtt.1.diningroom.MSG" not exist yet
                Then I publish "mosquitto_pub -t /mqtt/1/diningroom/MSG -m hallo",
                script won't trigger anything (no telegram msg being sent)
                After that even if I redo publish "mosquitto_pub -t /mqtt/1/diningroom/MSG -m world",
                script still won't trigger anything.
                Is there anything I should do to fix this?

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

                  @dony71 sagte: After that even if I redo publish "mosquitto_pub -t /mqtt/1/diningroom/MSG -m world", script still won't trigger anything.
                  Is there anything I should do to fix this?

                  It's a problem of the buffer inside the javascript instance: Restart the javascript instance.

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

                    @paul53 Restart java script won't help. I have to restart blocky script. This means each time mosquitto_pub publish new object instance, I have to restart the script then re-publish this new object then trigger works.
                    How could it be? Maybe I'm missing some setting?

                    FYI below my updated blocky script
                    2ae8ce43-4031-4512-8b0f-836b762a0508-image.png

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

                      @dony71
                      Try replacing $Selector with RegExp.

                      Blockly_temp.JPG

                      The $Selector does not recognise new data points because it uses the buffer of the Javascript instance. A subscription with RegExp captures new data points.

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

                        @paul53 thanks .... it's working well
                        you're really the expert

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        780
                        Online

                        32.0k
                        Users

                        80.5k
                        Topics

                        1.3m
                        Posts

                        2
                        10
                        607
                        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