NEWS
trying to get value of updated object id sent to telegram
-
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
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 btw, i can understand german, so anybody can reply in german language
-
@dony71 sagte: I want telegram to send value of mqtt.1.bedroom.MSG
-
@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 -
Wert (object value) shows the value of the just updated datapoint. You will find it under "Trigger".
If you want to send the ID (for ex. "mqtt.1.bedroom.MSG") of the updated datapoint:If you want to send both (id and value):
-
@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? -
@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.
-
@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
-
@dony71
Try replacing $Selector with RegExp.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.
-
@paul53 thanks .... it's working well
you're really the expert