<snapdata remixID="13494131"><project name="MQTT test" app="Snap! 9.0, https://snap.berkeley.edu" version="2"><notes>a test with mqtt</notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAAAAXNSR0IArs4c6QAAEX5JREFUeF7tnQtUVVUax//gFXmpKIIhBBKYAioiD6lGli0fs1yuppnSDItUMKeZctZMaQ+zlNRe1tQ0s2ZN2tiDClMzTSTN9wPz7YhkKsZbFBQF5CXPWd+mczqHA5eH99x9Oe69lusuF/fs/e1v/+7/+/Y+++xj19TU1ARRhAc4ecBOAMjJ86JZ5gEBoACBqwdUAF66dAmlpaXw8vLialRbjdfV1SE3NxcRERE2aZ8wqvMekAHMy8tDYWEhBgwY0Pla2rniZlEWsjesQFNdbZfr9ot5CM6jprDrs7OzMXHixC7XJS60HQ/IAO7evRt33HGHLpaZfkzBzbRPUPvQP9D/zkDk5ORg94IFcDp2zGx7fiY7TIj1hJOXA5pc3FEw7Uv5+zR3Cg4O1sVeUan1PCADuGbNGnlAjynAGDRoECg004A7OTmhurqaWefv78+UyNHREampqYiJiUF0dDR27NjBlNTBwQEmkwlTp06FS+Y2lNT1hHvkA3LPKJSWjx+PoUlJOBUXBw8AQxYvxo7ERAwDcBGALwB7kx0Gx3rCMcAL2X/4VL6+pKQE999/v/U8JVrSxQMygElJSQgKCmKNnDhxApGRkdi4cSOGDh2KK1euwNPTE9evX2efGRkZePTRR5GcnIyoqCgcOnSIwRYYGIjGxkZkZmaivLwcc+fORVVVFfrl7sbmvB544HcPyp0oLi7GuXvvxfglS9B4991oOH8e1SYT/B56CGXXr6O/ry9y4uNRvn07PFc8hwGVO3Fuyir5+rKyMowfP14Xp4hKrecBGcDVq1erABwyZAhOnjyJYcOGwdnZmSlafX09+ySF9PDwQH5+PoPu2rVrOHv2LFOkPXv2YMKECUw1w8PDmWJ6Fh5AwblT8JmeKPfs+40bETp/PtzGjcMVe3v0b2yEydsbl/Lz4RMUhCaTCVXffgu3v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oinE8oAHQwcGB9Y4GmiYhFYGT2G4UgiI4OJidot8yF6R3udHTajRbjYiIQFpaGttXWF9fj9DQUJSVlaGiooIt8dCbJ8PDw9mzvq3llNTOvn37EBYWhsLkhXIIlmwSABoHPs0khBRQApDU5uSb03DefyqioqIYNPv372/1VaXnzp3D0aNH2bvUFi1ahKSkJPaAO8FEAG7atAnR0dGgl/zRv8DAQPlhc6U7JfhiYmKYAvodeReeT69hOaAA0FjgSb3RPJYp/YGUpu7dGOwY/BQc3AbCw8ODvcCZlK6lcpEq0uyZ3q1LpbKyEocOHcK0adMYcMXFxezoX1I/mkzQ++goPCvrIfgI8LFjx7LPAc4mTD6zFEVzd+PChQusXkoDhg4dasyRuE17pQKQoKADiggoCcCbzp7I8H0YvX2GoZeL+r25evjsZuUN3Cg4i+F5XyPQdA2Xn9wlKyDlkhMmTNCjWVEnJw+oACQb1q5dyyYO9nZAZH0GXHuZOJkGNDY24ohTJKqqqthb0+kl0aIYywMaAKl7R44cYQ+oS4vSPLvc0NDAngueOHEiTzNE2zp5oFUAdWpLVCs8oPGAAFBAwdUDAkCu7heNCwAFA1w9IADk6n7RuABQMMDVAwJAru4XjQsABQNcPSAA5Op+0bgAUDDA1QP/B2Ur8CDDjlY2AAAAAElFTkSuQmCC</thumbnail><scenes select="1"><scene name="MQTT test"><notes>a test with mqtt</notes><palette><category name="MQTT" color="143,0,100,1"/></palette><hidden></hidden><headers></headers><code></code><blocks><block-definition s="$cloudOutline MQTT connect to %&apos;broker&apos; $nl $options-1-192-192-192 %&apos;options&apos;" type="command" category="MQTT"><comment x="0" y="0" w="416.6666666666666" collapsed="false">Connect to a broker&#xD;&#xD;The options are not required but can be filled if needed&#xD;&#xD;1. username (some brokers need this)&#xD;2. password (some brokers need this)&#xD;3. keepalive (default time is 60 seconds but some brokers need a shorter time)&#xD;4. connection callback (ringed set of scripts to be run when connection is made or remade)&#xD;&#xD;Note: The connection callback doesn&apos;&apos;t have to be the 4th option - it just has to be the last (or only) option.&#xD;&#xD;ADVANCED: The brokers offered in the menu are accessed using default ports and  basepaths (if needed).  If accessing other brokers, the complete urls should be formed like this:&#xD;&#xD;siteURL:port/basepath &#xD;e.g mqtt.eclipseprojects.io:443/mqtt&#xD;&#xD;It is possible to have more than one connection to the same broker, for instance, using two different user/pass accounts simultaneously. To do this, add a connection id at the end of the broker:&#xD;&#xD;e.g mqtt.eclipseprojects.io:443/mqtt|1&#xD;</comment><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%mult%s"></input></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqtt.js</l></list></block><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqttExtension.js</l></list></block><block s="doIf"><block s="reportNot"><block s="reportJoinWords"><block var="options"/></block></block><script><block s="doSetVar"><l>options</l><block s="reportNewList"><list></list></block></block></script><list></list></block><block s="doDeclareVariables"><list><l>connection status</l><l>callback</l></list></block><block s="doSetVar"><l>connection status</l><l>connecting</l></block><block s="doSetVar"><l>callback</l><l></l></block><block s="doIf"><block s="reportIsA"><block s="reportListItem"><l><option>last</option></l><block var="options"/></block><l><option>command</option></l></block><script><block s="doSetVar"><l>callback</l><block s="reportListItem"><l><option>last</option></l><block var="options"/></block></block><block s="doDeleteFromList"><l><option>last</option></l><block var="options"/></block></script><list></list></block><block s="doSetVar"><l>options</l><block s="reportListAttribute"><l><option>json</option></l><block s="reportNewList"><list><block s="reportNewList"><list><l>username</l><block s="reportListItem"><l>1</l><block var="options"/></block></list></block><block s="reportNewList"><list><l>password</l><block s="reportListItem"><l>2</l><block var="options"/></block></list></block><block s="reportNewList"><list><l>keepalive</l><block s="reportListItem"><l>3</l><block var="options"/></block></list></block></list></block></block></block><block s="doApplyExtension"><l>mqt_connect(broker,callback,options)</l><list><block var="broker"/><block var="callback"/><block var="options"/></list></block><block s="doWaitUntil"><block s="reportNot"><block s="reportVariadicEquals"><list><block var="connection status"/><l>connecting</l></list></block></block></block><block s="doIf"><block s="reportNot"><block s="reportVariadicEquals"><list><block var="connection status"/><l>connected</l></list></block></block><script><block s="doApplyExtension"><l>err_error(msg)</l><list><block var="connection status"/></list></block></script><list></list></block></script></block-definition><block-definition s="$cloudOutline MQTT subscribe to %&apos;broker&apos; topic %&apos;topic&apos; $nl on each message run %&apos;callback&apos; $nl $options-1-192-192-192 %&apos;options&apos;" type="command" category="MQTT"><comment x="0" y="0" w="239.99999999999977" collapsed="false">Subscribe to a topic on a broker&#xD;&#xD;Make sure you have already run an MQTT connect block before using this one&#xD;&#xD;You should add a script to be run inside he grey ring.&#xD;&#xD;It will be run each time a message is received&#xD;&#xD;If you click on the arrow on the grey ring twice, you can use #1 and #2 inside your script.&#xD;&#xD;#1 will contain the received payload&#xD;&#xD;#2 will contain the received topic name&#xD;&#xD;The options are not required but can be filled if needed&#xD;&#xD;There is only 1 option at present&#xD;1. Buffer mode (boolean) Default (false) - payload is returned as text&#xD;&#xD;If true, payload returned as single column list of values in the range of 0 to 255..  </comment><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%s">name</input><input type="%cmdRing"></input><input type="%mult%s"></input></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqtt.js</l></list></block><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqttExtension.js</l></list></block><block s="doIf"><block s="reportNot"><block s="reportJoinWords"><block var="options"/></block></block><script><block s="doSetVar"><l>options</l><block s="reportNewList"><list></list></block></block></script><list></list></block><block s="doSetVar"><l>options</l><block s="reportListAttribute"><l><option>json</option></l><block s="reportNewList"><list><block s="reportNewList"><list><l>mode</l><block s="reportListItem"><l>1</l><block var="options"/></block></list></block></list></block></block></block><block s="doApplyExtension"><l>mqt_sub(broker,topic,callback,options)</l><list><block var="broker"/><block var="topic"/><block var="callback"/><block var="options"/></list></block></script></block-definition><block-definition s="$cloudOutline MQTT publish to %&apos;broker&apos; topic %&apos;topic&apos; payload %&apos;payload&apos; $nl $options-1-192-192-192 %&apos;options&apos;" type="command" category="MQTT"><comment x="0" y="0" w="310" collapsed="false">Publish a message to an MQTT broker&#xD;&#xD;The options are not required but can be filled if needed&#xD;&#xD;1. qos (quality of service 0,1 or 2)&#xD;&#xD;2. retain flag (boolean)&#xD;&#xD;3. Buffer mode (boolean).    Default (false) - the payload is published as text&#xD;&#xD;If set to true then payload is expected to be a single column list of values in the 0 to 255 range and is published to the broker as a buffer of bytes.&#xD;&#xD;Note:  If the payload is a list and you don&apos;t set the buffer mode option, it will be automatically be converted into JSON and sent as text.&#xD;&#xD;</comment><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%s">name</input><input type="%mlt">hello</input><input type="%mult%s"></input></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqtt.js</l></list></block><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqttExtension.js</l></list></block><block s="doIf"><block s="reportNot"><block s="reportJoinWords"><block var="options"/></block></block><script><block s="doSetVar"><l>options</l><block s="reportNewList"><list></list></block></block></script><list></list></block><block s="doSetVar"><l>options</l><block s="reportListAttribute"><l><option>json</option></l><block s="reportNewList"><list><block s="reportNewList"><list><l>qos</l><block s="reportListItem"><l>1</l><block var="options"/></block></list></block><block s="reportNewList"><list><l>retain</l><block s="reportListItem"><l>2</l><block var="options"/></block></list></block><block s="reportNewList"><list><l>mode</l><block s="reportListItem"><l>3</l><block var="options"/></block></list></block></list></block></block></block><block s="doIf"><block s="reportNot"><block s="reportListItem"><l>2</l><block s="reportListItem"><l>3</l><block s="reportTextSplit"><block var="options"/><l><option>json</option></l></block></block></block></block><script><block s="doIf"><block s="reportIsA"><block var="payload"/><l><option>list</option></l></block><script><block s="doSetVar"><l>payload</l><block s="reportListAttribute"><l><option>json</option></l><block var="payload"/></block></block></script><list></list></block><block s="doIf"><block s="reportIsA"><block var="payload"/><l><option>number</option></l></block><script><block s="doSetVar"><l>payload</l><block s="reportJoinWords"><list><block var="payload"/></list></block></block></script><list></list></block></script><list></list></block><block s="doApplyExtension"><l>mqt_pub(broker,topic,payload,options)</l><list><block var="broker"/><block var="topic"/><block var="payload"/><block var="options"/></list></block></script></block-definition><block-definition s="$cloudOutline MQTT unsubscribe from %&apos;broker&apos; topic %&apos;topic&apos;" type="command" category="MQTT"><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%s">name</input></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqtt.js</l></list></block><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqttExtension.js</l></list></block><block s="doApplyExtension"><l>mqt_unsub(broker,topic)</l><list><block var="broker"/><block var="topic"/></list></block></script></block-definition><block-definition s="$cloudOutline MQTT disconnect from %&apos;broker&apos;" type="command" category="MQTT"><header></header><code></code><translations></translations><inputs><input type="%s">all<options>all&#xD;broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqtt.js</l></list></block><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqttExtension.js</l></list></block><block s="doApplyExtension"><l>mqt_disconnect(broker)</l><list><block var="broker"/></list></block></script></block-definition><block-definition s="$cloudOutline MQTT response %&apos;broker&apos; topic %&apos;topic&apos; $nl reply %&apos;reply&apos; $nl $options-1-192-192-192 %&apos;$options&apos;" type="command" category="MQTT"><comment x="0" y="0" w="292.22207031250036" collapsed="false">1. Subscribe buffer mode (boolean) Default (false) - received payload is returned as text. &#xD;&#xD;If true, subscribed, received payload returned as single column list of values in the range of 0 to 255..  Default (false) - it is returned as text&#xD;&#xD;2.  Published buffer mode (boolean).  Default (false) - the payload is published as text.&#xD;&#xD;If set to true then published payload is expected to be a single column list of values in the 0 to 255 range and is published to the broker as a buffer of bytes.&#xD;&#xD;Note:  If the payload is a list and you don&apos;t set the buffer mode option, it will be automatically be converted into JSON and sent as text</comment><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%s">name/#</input><input type="%repRing"></input><input type="%mult%s"></input></inputs><script><block s="doDeclareVariables"><list><l>resp</l><l>callbackTopic</l><l>error</l></list></block><custom-block s="$cloudOutline MQTT subscribe to %s topic %s %br on each message run %cmdRing %br $options-1-192-192-192 %mult%s"><block var="broker"/><block var="topic"/><block s="reifyScript"><script><block s="doIf"><block s="reportVariadicGreaterThan"><list><block s="reportApplyExtension"><l>txt_indexof(sub, txt)</l><list><l>/@</l><block var="received topic"/></list></block><l>0</l></list></block><script><block s="doApplyExtension"><l>err_try(cmd, catch, err)</l><list><block s="reifyScript"><script><block s="doSetVar"><l>resp</l><block s="evaluate"><block var="reply"/><list><block var="received payload"/><block var="received topic"/></list></block></block></script><list></list></block><block s="reifyScript"><script><block s="doSetVar"><l>resp</l><block s="evaluate"><block var="reply"/><list></list></block></block></script><list></list></block><block var="error"/></list></block><block s="doApplyExtension"><l>err_reset</l><list></list></block><block s="doSetVar"><l>callbackTopic</l><block s="reportListItem"><l><option>last</option></l><block s="reportTextSplit"><block var="received topic"/><l>@</l></block></block></block><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><block var="broker"/><block var="callbackTopic"/><block var="resp"/><list><l></l><l></l><block s="reportListItem"><l>2</l><block var="$options"/></block></list></custom-block></script><list></list></block></script><list><l>received payload</l><l>received topic</l></list></block><list><block s="reportListItem"><l>1</l><block var="$options"/></block></list></custom-block></script></block-definition><block-definition s="$cloudOutline MQTT request %&apos;broker&apos; topic %&apos;topic&apos; $nl response topic %&apos;rtopic&apos; payload %&apos;payload&apos; $nl on response run %&apos;callback&apos; $nl $options-1-192-192-192 %&apos;options&apos;" type="command" category="MQTT"><comment x="0" y="0" w="243" collapsed="false">The options are not required but can be filled if needed.&#xD;&#xD;1. Subscribe buffer mode (boolean) Default (false) - received payload is returned as text. &#xD;&#xD;If true, subscribed, received payload returned as single column list of values in the range of 0 to 255..  &#xD;&#xD;2. Inform response topic (boolean): If true, the response topic is added at the end of the call topic after @ sign. The default condition (true) response topic is added.&#xD;&#xD;3.  Published buffer mode (boolean).  Default (false) - the payload is published as text.&#xD;&#xD;If set to true then published payload is expected to be a single column list of values in the 0 to 255 range and is published to the broker as a buffer of bytes.&#xD;&#xD;Note:  If the payload is a list and you don&apos;t set the buffer mode option, it will be automatically be converted into JSON and sent as text</comment><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%s">name</input><input type="%s">name2</input><input type="%mlt">hello</input><input type="%cmdRing"></input><input type="%mult%s"></input></inputs><script><block s="doDeclareVariables"><list><l>error</l><l>informTopic</l><l>topicCall</l></list></block><block s="doSetVar"><l>informTopic</l><block s="reportIfElse"><block s="reportIsA"><block s="reportListItem"><l>2</l><block var="options"/></block><l><option>Boolean</option></l></block><block s="reportListItem"><l>2</l><block var="options"/></block><block s="reportBoolean"><l><bool>true</bool></l></block></block></block><custom-block s="$cloudOutline MQTT subscribe to %s topic %s %br on each message run %cmdRing %br $options-1-192-192-192 %mult%s"><block var="broker"/><block s="reportJoinWords"><list><block var="rtopic"/></list></block><block s="reifyScript"><script><block s="doApplyExtension"><l>err_try(cmd, catch, err)</l><list><block s="reifyScript"><script><block s="doRun"><block var="callback"/><list><block var="received payload"/><block var="received topic"/></list></block></script><list></list></block><block s="reifyScript"><script><block s="doRun"><block var="callback"/><list></list></block></script><list></list></block><block var="error"/></list></block></script><list><l>received payload</l><l>received topic</l></list></block><list><block s="reportListItem"><l>1</l><block var="options"/></block></list></custom-block><block s="doIfElse"><block var="informTopic"/><script><block s="doSetVar"><l>topicCall</l><block s="reportJoinWords"><list><block var="topic"/><l>/</l><block s="reportJoinWords"><list><l>@</l><block var="rtopic"/></list></block></list></block></block></script><script><block s="doSetVar"><l>topicCall</l><block var="topic"/></block></script></block><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><block var="broker"/><block var="topicCall"/><block var="payload"/><list><l></l><l></l><block s="reportListItem"><l>3</l><block var="options"/></block></list></custom-block></script></block-definition><block-definition s="$cloudOutline MQTT example response reporter payload %&apos;payload&apos; topic %&apos;topic&apos;" type="reporter" category="MQTT"><comment x="0" y="0" w="90" collapsed="false">This is a simple echo example.&#xD;Topic can be used to filter the response.</comment><header></header><code></code><translations></translations><inputs><input type="%mlt">hello</input><input type="%txt">name</input></inputs><script><block s="doReport"><block var="payload"/></block></script></block-definition><block-definition s="$cloudOutline MQTT request %&apos;broker&apos; topic %&apos;topic&apos; $nl response topic %&apos;rtopic&apos; payload %&apos;payload&apos; $nl $options-1-192-192-192 %&apos;options&apos;" type="reporter" category="MQTT"><comment x="0" y="0" w="343" collapsed="false">The response topic should be a unique value for each call e.g. use timer&#xD;&#xD;The options are not required but can be filled if needed&#xD;&#xD;1.  Timeout value - default is 3 seconds&#xD;&#xD;2. Subscribe buffer mode (boolean) Default (false) - received payload is returned as text. &#xD;&#xD;If true, subscribed, received payload returned as single column list of values in the range of 0 to 255..  Default (false) - it is returned as text&#xD;&#xD;3.  Inform response topic (boolean): If true, the response topic is added at the end of the call topic after @ sign. The default condition (true) response topic is added.&#xD;&#xD;4.  Published buffer mode (boolean).  Default (false) - the payload is published as text.&#xD;&#xD;If set to true then published payload is expected to be a single column list of values in the 0 to 255 range and is published to the broker as a buffer of bytes.&#xD;&#xD;Note:  If the payload is a list and you don&apos;t set the buffer mode option, it will be automatically be converted into JSON and sent as text</comment><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%s">name</input><input type="%s">name2</input><input type="%mlt">hello</input><input type="%mult%s"></input></inputs><script><block s="doDeclareVariables"><list><l>resp</l><l>semaphore</l><l>timer0</l><l>timeout</l><l>informTopic</l><l>topicCall</l></list></block><block s="doSetVar"><l>semaphore</l><l>0</l></block><block s="doSetVar"><l>timeout</l><block s="reportIfElse"><block s="reportIsA"><block s="reportListItem"><l>1</l><block var="options"/></block><l><option>number</option></l></block><block s="reportListItem"><l>1</l><block var="options"/></block><l>3</l></block></block><block s="doSetVar"><l>informTopic</l><block s="reportIfElse"><block s="reportIsA"><block s="reportListItem"><l>3</l><block var="options"/></block><l><option>Boolean</option></l></block><block s="reportListItem"><l>3</l><block var="options"/></block><block s="reportBoolean"><l><bool>true</bool></l></block></block></block><block s="doSetVar"><l>resp</l><l>timeout</l></block><custom-block s="$cloudOutline MQTT subscribe to %s topic %s %br on each message run %cmdRing %br $options-1-192-192-192 %mult%s"><block var="broker"/><block s="reportJoinWords"><list><block var="rtopic"/></list></block><block s="reifyScript"><script><block s="doSetVar"><l>resp</l><block var="received payload"/></block><block s="doSetVar"><l>semaphore</l><l>1</l></block></script><list><l>received payload</l><l>received topic</l></list></block><list><block s="reportListItem"><l>2</l><block var="options"/></block></list></custom-block><block s="doIfElse"><block var="informTopic"/><script><block s="doSetVar"><l>topicCall</l><block s="reportJoinWords"><list><block var="topic"/><l>/</l><block s="reportJoinWords"><list><l>@</l><block var="rtopic"/></list></block></list></block></block></script><script><block s="doSetVar"><l>topicCall</l><block var="topic"/></block></script></block><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><block var="broker"/><block var="topicCall"/><block var="payload"/><list><l></l><l></l><block s="reportListItem"><l>4</l><block var="options"/></block></list></custom-block><block s="doSetVar"><l>timer0</l><block s="reportDate"><l><option>time in milliseconds</option></l></block></block><block s="doWaitUntil"><block s="reportVariadicOr"><list><block s="reportVariadicEquals"><list><block var="semaphore"/><l>1</l></list></block><block s="reportVariadicGreaterThan"><list><block s="reportDifference"><block s="reportDate"><l><option>time in milliseconds</option></l></block><block var="timer0"/></block><block s="reportVariadicProduct"><list><block var="timeout"/><l>1000</l></list></block></list></block></list></block></block><custom-block s="$cloudOutline MQTT unsubscribe from %s topic %s"><block var="broker"/><block s="reportJoinWords"><list><block var="rtopic"/></list></block></custom-block><block s="doReport"><block var="resp"/></block></script></block-definition><block-definition s="MQTT Extension Examples" type="command" category="MQTT"><comment x="0" y="0" w="277" collapsed="false">Open (edit) this block to look at examples how to use the MQTT Extension blocks&#xD;&#xD;Background documentation:&#xD;https://github.com/pixavier/mqtt4snap&#xD;&#xD;Last source code version (mqtt.xml and mqttExtension.js):&#xD;https://gitlab.com/cymplecy/Snap/-/tree/master/libraries</comment><header></header><code></code><translations></translations><inputs></inputs><scripts><script x="24.333333333333485" y="371.8666666666658"><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name</l><l>hello</l><list><l></l></list></custom-block></script><script x="22.333333333333485" y="271.19999999999976"><custom-block s="$cloudOutline MQTT subscribe to %s topic %s %br on each message run %cmdRing %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name</l><block s="reifyScript"><script><block s="doSayFor"><block var="payload"/><l>2</l></block></script><list><l>payload</l><l>topic</l></list></block><list><l></l></list></custom-block></script><comment x="525.9999999999995" y="140.2" w="191" collapsed="false">To execute the examples, single click on blocks, following the corresponding steps.</comment><script x="28" y="1315.0333333333292"><custom-block s="$cloudOutline MQTT request %s topic %s %br response topic %s payload %mlt %br on response run %cmdRing %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name</l><block s="getTimer"></block><l>hello</l><block s="reifyScript"><script><block s="doSayFor"><block var="payload"/><l>2</l></block></script><list><l>payload</l><l>topic</l></list></block><list><l></l></list></custom-block></script><script x="24.333333333333485" y="1013.2000000000016"><custom-block s="$cloudOutline MQTT response %s topic %s %br reply %repRing %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name/#</l><block s="reifyReporter"><autolambda><custom-block s="$cloudOutline MQTT example response reporter payload %mlt topic %txt"><block var="payload"/><block var="topic"/></custom-block></autolambda><list><l>payload</l><l>topic</l></list></block><list><l></l></list></custom-block></script><script x="28" y="498.6999999999993"><custom-block s="$cloudOutline MQTT subscribe to %s topic %s %br on each message run %cmdRing %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name1</l><block s="reifyScript"><script><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name2</l><block var="payload"/><list><l></l></list></custom-block></script><list><l>payload</l><l>topic</l></list></block><list><l></l></list></custom-block></script><script x="30" y="633.0333333333344"><block s="doSayFor"><custom-block s="$cloudOutline MQTT request %s topic %s %br response topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name1</l><l>name2</l><l>hello</l><list><l></l><l></l><block s="reportBoolean"><l><bool>false</bool></l></block></list></custom-block><l>2</l></block></script><comment x="487.99999999999955" y="1311.6999999999966" w="224" collapsed="false">Step 2 bis: Send a request (timer acts as idCall) and do not wait for the answer</comment><comment x="487.99999999999955" y="1013.7000000000012" w="220" collapsed="false">Step 1: Activate the responder</comment><comment x="483.66666666666697" y="805.3666666666666" w="224" collapsed="false">Step 2 bis: Send a request and do not wait for the answer</comment><comment x="487" y="495.6999999999983" w="220" collapsed="false">Step 1: Activate the responder as a simple subscription</comment><comment x="484.99999999999955" y="374.1999999999991" w="222" collapsed="false">Step 2: Publish a message</comment><comment x="485.99999999999955" y="293.1999999999993" w="222" collapsed="false">Step 1: Subscribe to a topic</comment><comment x="482.99999999999955" y="215.2" w="223" collapsed="false">Step 0: Connect to the broker</comment><comment x="485" y="635.6999999999996" w="220" collapsed="false">Step 2: Send a request and wait the answer.</comment><script x="24.333333333333485" y="209.2"><custom-block s="$cloudOutline MQTT connect to %s %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><list><l></l></list></custom-block></script><comment x="24.333333333333485" y="152.2000000000001" w="239.99999999999997" collapsed="false">PubSub Hello World!</comment><script x="26.333333333333485" y="1139.1999999999978"><block s="doSayFor"><custom-block s="$cloudOutline MQTT request %s topic %s %br response topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name</l><block s="getTimer"></block><l>hello</l><list><l></l></list></custom-block><l>2</l></block></script><comment x="486.99999999999955" y="1138.6999999999982" w="219.00000000000023" collapsed="false">Step 2: Send a request (timer acts as idCall) and wait for the answer</comment><script x="27" y="803.0333333333335"><custom-block s="$cloudOutline MQTT request %s topic %s %br response topic %s payload %mlt %br on response run %cmdRing %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name1</l><l>name2</l><l>hello</l><block s="reifyScript"><script><block s="doSayFor"><block var="payload"/><l>2</l></block></script><list><l>payload</l><l>topic</l></list></block><list><l></l><block s="reportBoolean"><l><bool>false</bool></l></block></list></custom-block></script><comment x="29" y="736.6999999999998" w="372.0000000000004" collapsed="false">Asynchronous client-server Hello World! with static response topic (name2)</comment><comment x="25.333333333333485" y="935.2000000000012" w="356.99999999999994" collapsed="false">Synchronous client-server Hello World! with dynamic response topic (timer)</comment><comment x="28" y="431.36666666666673" w="361.99999999999994" collapsed="false">Synchronous client-server Hello World! with static response topic (name2)</comment><comment x="27" y="1243.6999999999966" w="352.0000000000003" collapsed="false">Asynchronous client-server Hello World! with dynamic response topic (timer)</comment></scripts></block-definition><block-definition s="safely try %&apos;action&apos; then if %&apos;error&apos; %&apos;handler&apos;" type="command" category="control"><comment x="0" y="0" w="276" collapsed="false">Catch errors.&#xD;&#xD;Runs the first script.  If it succeeds, nothing else happens.&#xD;But if it has an error (something that would otherwise result&#xD;in a red halo around the block), then the second script is run,&#xD;with the text of the error message that would have been shown in the variable ERROR.</comment><header></header><code></code><translations>pt:tenta executar _ e, em caso de erro _ , executa _&#xD;ca:prova de forma segura _ i si _ _&#xD;</translations><inputs><input type="%cs"></input><input type="%upvar"></input><input type="%cs"></input></inputs><script><block s="doApplyExtension"><l>err_try(cmd, catch, err)</l><list><block var="action"/><block var="handler"/><block var="error"/></list></block><block s="doApplyExtension"><l>err_reset</l><list></list></block></script></block-definition><block-definition s="error %&apos;msg&apos;" type="command" category="control"><comment x="0" y="0" w="268.6666666666667" collapsed="false">Throw an error.&#xD;&#xD;Makes a red halo appear around the script that runs it,&#xD;with the input text shown in a speech balloon next to&#xD;the script, just like any Snap! error.&#xD;&#xD;This is useful to put in the second script of SAFELY TRY&#xD;after some other instructions to undo the partial work of&#xD;the first script.</comment><header></header><code></code><translations>pt:lança o erro _&#xD;</translations><inputs><input type="%txt"></input></inputs><script><block s="doApplyExtension"><l>err_error(msg)</l><list><block var="msg"/></list></block></script></block-definition><block-definition s="safely try reporting %&apos;this&apos; then if %&apos;error&apos; report %&apos;that&apos;" type="reporter" category="control"><comment x="0" y="0" w="316.6666666666667" collapsed="false">Catch errors in a reporter.&#xD;&#xD;Evaluates its first input.  If that expression successfully reports a value, this block reports that value.  If the expression causes a Snap! error,&#xD;then the final input slot is evaluated with the text of what would have&#xD;been the error message in variable ERROR.  SAFELY TRY then reports the value of that final expression.&#xD;&#xD;Sometimes you&apos;ll want to throw an error in the final expression.  You&#xD;can put an ERROR block inside a CALL block to do that.</comment><header></header><code></code><translations>ca:prova de forma segura reportant _ i si _ reportant _&#xD;</translations><inputs><input type="%anyUE"></input><input type="%upvar"></input><input type="%anyUE"></input></inputs><script><block s="doDeclareVariables"><list><l>value</l></list></block><custom-block s="safely try %cs then if %upvar %cs"><script><block s="doSetVar"><l>value</l><block s="evaluate"><block var="this"/><list></list></block></block></script><l>err</l><script><block s="doSetVar"><l>error</l><block var="err"/></block><block s="doSetVar"><l>value</l><block s="evaluate"><block var="that"/><list></list></block></block></script></custom-block><block s="doReport"><block var="value"/></block></script></block-definition></blocks><stage name="Stage" width="480" height="360" costume="0" color="255,255,255,1" tempo="60" threadsafe="false" penlog="false" volume="100" pan="0" lines="round" ternary="false" hyperops="true" codify="false" inheritance="true" sublistIDs="false" id="902"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAAAAXNSR0IArs4c6QAADoVJREFUeF7t1cEJAAAIxDDdf2m3sJ+4wEEQuuMIECBAgACBd4F9XzRIgAABAgQIjAB7AgIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECg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IBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECByxcQFpoRMBzwAAAABJRU5ErkJggg==</pentrails><costumes><list struct="atomic" id="903"></list></costumes><sounds><list struct="atomic" id="904"></list></sounds><variables></variables><blocks></blocks><scripts></scripts><sprites select="1"><sprite name="Sprite" idx="1" x="0" y="0" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="80,80,80,1" pen="tip" id="909"><costumes><list struct="atomic" id="910"></list></costumes><sounds><list struct="atomic" id="911"></list></sounds><blocks></blocks><variables></variables><scripts><script x="20" y="20"><block s="receiveGo"></block><block s="doSetVar"><l>ID</l><block s="reportRandom"><l>1</l><l>100000</l></block></block><block s="doSetVar"><l>list</l><block s="reportNewList"><list></list></block></block><custom-block s="safely try %cs then if %upvar %cs"><script><block s="doSetVar"><l>connected?</l><block s="reportBoolean"><l><bool>false</bool></l></block></block><custom-block s="$cloudOutline MQTT connect to %s %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><list><l></l></list></custom-block><block s="doSetVar"><l>connected?</l><block s="reportBoolean"><l><bool>true</bool></l></block></block><block s="doUntil"><block s="reportNot"><block var="connected?"/></block><script><custom-block s="$cloudOutline MQTT subscribe to %s topic %s %br on each message run %cmdRing %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>MQTTest</l><block s="reifyScript"><script><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>response</l><block s="reportNewList"><list><block var="ID"/><block var="connected?"/></list></block><list><l></l></list></custom-block></script><list></list></block><list><l></l></list></custom-block><block s="doAddToList"><custom-block s="$cloudOutline MQTT request %s topic %s %br response topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>MQTTest</l><l>response</l><block s="reportNewList"><list><block var="ID"/><block var="connected?"/></list></block><list><l></l><l></l><block s="reportBoolean"><l><bool>false</bool></l></block></list></custom-block><block var="list"/></block><block s="doWait"><l>10</l></block></script></block></script><l>error</l><script><block s="doSetVar"><l>connected?</l><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></custom-block></script><script x="20" y="510"><block s="receiveGo"></block><block s="doForever"><script><block s="doIf"><block s="reportVariadicGreaterThan"><list><block s="reportListAttribute"><l><option>length</option></l><block var="list"/></block><l>25</l></list></block><script><block s="doDeleteFromList"><l><option>all</option></l><block var="list"/></block></script><list></list></block></script></block></script><script x="20" y="657.4166666666666"><block s="receiveGo"></block><block s="doForever"><script><block s="doSetVar"><l>list</l><block s="reportListAttribute"><l><option>uniques</option></l><block var="list"/></block></block></script></block></script><script x="20" y="763.25"><block s="receiveInteraction"><l><option>stopped</option></l></block><block s="doSetVar"><l>connected?</l><block s="reportBoolean"><l><bool>false</bool></l></block></block><block s="doSetVar"><l>ID</l><l>0</l></block></script></scripts></sprite><watcher var="ID" style="normal" x="10" y="52.00000399999999" color="243,118,29" hidden="true"/><watcher var="connected?" style="normal" x="6" y="10.000001999999995" color="243,118,29"/><watcher var="list" style="normal" x="11" y="44" color="243,118,29" extX="95" extY="262"/></sprites></stage><variables><variable name="list"><list struct="atomic" id="1051">&quot;[&#xD;    77059,&#xD;    true&#xD;]&quot;</list></variable><variable name="connected?"><bool>false</bool></variable><variable name="ID"><l>0</l></variable></variables></scene></scenes></project><media name="MQTT test" app="Snap! 9.0, https://snap.berkeley.edu" version="2"></media></snapdata>