Nodes global variables

Hi all!

I want to compare the 1st value with the 2nd value and do something with that (nevermind that now), the main doubt is how to work with those values.

  • Global variables?
  • Is there any node which can resolve that now?.

This is what i want to do.

The 1st value is a String so the same the 2nd one. The 2nd value is slight different because it has another characters (tasmota). So i don't know how to manage that.

Regards!!

One way is to join the data from the two messages so they are both available for comparison. See this article in the cookbook for an example of how to join messages into one object.

UHm, ok...the join node i don't think it will be useful because i have several values, the example on the website you send me is useful but it has separated values and pre-formatted.

You need to combine the values before you can compare. The join node can do that. After that, a function node to clean up the strings & compare them.

Try to get both payload into 1 message first, then worry about how to do the string comparison.

Using join node...

function to clean up and compare

var s1 = msg.payload.website_data[6]
var s2 = msg.payload.myDevice.version;
var s2Cleaned = s2.split("(")[0]; //split on "(" then take first element [0]
var match = s1 == s2Cleaned; //compare them
msg.payload = {
    s1: s1,
    s2: s2Cleaned,
    match: match,

}
return msg;

demo flow...

[{"id":"7a08e7b3.a1e9e8","type":"inject","z":"59f3e1c6.409f8","name":"fake data 1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"website_data","payload":"[\"blah blah\",\"blah blah\",\"blah blah\",\"blah blah\",\"blah blah\",\"blah blah\",\"9.7.6\"]","payloadType":"json","x":1320,"y":160,"wires":[["98c0ac13.58e","aae064b4.c44f08"]]},{"id":"742cc82.3855538","type":"inject","z":"59f3e1c6.409f8","name":"fake data 2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"myDevice","payload":"{\"name\":\"fake\",\"ipAddress\":\"1.2.3.4\",\"version\":\"8.2.3(blah blah)\"}","payloadType":"json","x":1320,"y":200,"wires":[["1085798d.690af6","aae064b4.c44f08"]]},{"id":"2deec0c8.8f05f","type":"function","z":"59f3e1c6.409f8","name":"","func":"var s1 = msg.payload.website_data[6]\nvar s2 = msg.payload.myDevice.version;\nvar s2Cleaned = s2.split(\"(\")[0]; //split on \"(\" then take first element [0]\nvar match = s1 == s2Cleaned;\nmsg.payload = {\n    s1: s1,\n    s2: s2Cleaned,\n    match: match,\n\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1670,"y":180,"wires":[["89a75a0a.8f8898"]]},{"id":"89a75a0a.8f8898","type":"debug","z":"59f3e1c6.409f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload.match","statusType":"msg","x":1750,"y":240,"wires":[]},{"id":"d2cc7c89.1b0e4","type":"debug","z":"59f3e1c6.409f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1530,"y":240,"wires":[]},{"id":"98c0ac13.58e","type":"debug","z":"59f3e1c6.409f8","name":"fake1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1330,"y":120,"wires":[]},{"id":"1085798d.690af6","type":"debug","z":"59f3e1c6.409f8","name":"fake2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1330,"y":240,"wires":[]},{"id":"aae064b4.c44f08","type":"join","z":"59f3e1c6.409f8","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1500,"y":180,"wires":[["2deec0c8.8f05f","d2cc7c89.1b0e4"]]}]

Ok...i could have an approach with your great example but i think something missing on the way.

I have this outputs now and i still can't compare the web values with the hardware values. The objetive is to have one final message that tells me what device is outadated compared with the web version.

Code:

[{"id":"2fb8e118.b3cace","type":"comment","z":"13e3e683.083059","name":"Check Tasmota Web Version","info":"","x":160,"y":600,"wires":[]},{"id":"afd9b191.eb6af","type":"comment","z":"13e3e683.083059","name":"Check Sonoff versions","info":"","x":140,"y":780,"wires":[]},{"id":"78f70367.0d9074","type":"inject","z":"13e3e683.083059","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":840,"wires":[["da30c2f2.db772"]]},{"id":"da30c2f2.db772","type":"function","z":"13e3e683.083059","name":"hosts","func":"const tasmotas = [\"192.168.1.40\",\"192.168.1.180\"]\nconst status= \"/cm?cmnd=Status%200\"\nfor(let x=0;x<tasmotas.length;x++){\n \n node.send({url:\"http://\"+tasmotas[x]+status})\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":250,"y":840,"wires":[["f4d416e1.f85e98"]]},{"id":"2cf16dc2.081e4a","type":"debug","z":"13e3e683.083059","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":900,"wires":[]},{"id":"f4d416e1.f85e98","type":"http request","z":"13e3e683.083059","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":390,"y":840,"wires":[["b210a677.3baaf8"]]},{"id":"5bfe3e09.1d8c88","type":"join","z":"13e3e683.083059","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":650,"y":840,"wires":[["2cf16dc2.081e4a","96e34734.d82e1"]]},{"id":"96e34734.d82e1","type":"change","z":"13e3e683.083059","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.{ \"name\":**.Hostname, \"ipAddress\":**.IPAddress, \"version\":**.Version }","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":840,"wires":[["63f37354.f04534","5ae1d994.c2f198"]]},{"id":"63f37354.f04534","type":"debug","z":"13e3e683.083059","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1030,"y":840,"wires":[]},{"id":"cb317c2a.650ed","type":"comment","z":"13e3e683.083059","name":"NOTA","info":"Al agregar mas sonoff hay que dar de alta la ip en el nodo \"hosts\" y en el nodo \"batch\" hay que sumar la cantidad de mensajes, osea, 2 mensajes 2 sonoffs, 3 mensajes 3 sonoffs...","x":290,"y":780,"wires":[]},{"id":"3b5babc1.a63754","type":"inject","z":"13e3e683.083059","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":660,"wires":[["3f9fa0bd.3c963"]]},{"id":"3f9fa0bd.3c963","type":"http request","z":"13e3e683.083059","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://ota.tasmota.com/tasmota/release/","tls":"","persist":false,"proxy":"","authType":"","x":270,"y":660,"wires":[["1e52ea36.0f7356"]]},{"id":"1e52ea36.0f7356","type":"html","z":"13e3e683.083059","name":"","property":"payload","outproperty":"payload","tag":"tr","ret":"html","as":"multi","x":410,"y":660,"wires":[["54759709.b0cf28"]]},{"id":"54759709.b0cf28","type":"html","z":"13e3e683.083059","name":"","property":"payload","outproperty":"payload","tag":"td","ret":"html","as":"single","x":530,"y":660,"wires":[["bb6e79ef.6cb5b8"]]},{"id":"bb6e79ef.6cb5b8","type":"switch","z":"13e3e683.083059","name":"","property":"payload[0]","propertyType":"msg","rules":[{"t":"cont","v":"tasmota.bin","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":660,"wires":[["173689e5.8d7376"]]},{"id":"404fa40e.36d8fc","type":"function","z":"13e3e683.083059","d":true,"name":"Nueva version tasmota","func":"msg.payload = {}\nmsg.payload.chatId = 587232739;\nmsg.payload.type = 'message';\nmsg.payload.content = 'ALARMA TASMOTA: Hay una nueva version de Tasmota!'\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":920,"y":660,"wires":[["236c15d.5dd1cea"]]},{"id":"173689e5.8d7376","type":"switch","z":"13e3e683.083059","name":"","property":"payload[6]","propertyType":"msg","rules":[{"t":"gte","v":"9.2.0","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":700,"wires":[["404fa40e.36d8fc","e1ac0c78.293eb","5ae1d994.c2f198"]]},{"id":"e1ac0c78.293eb","type":"debug","z":"13e3e683.083059","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":870,"y":620,"wires":[]},{"id":"5ae1d994.c2f198","type":"join","z":"13e3e683.083059","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"payload","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":890,"y":740,"wires":[["95d6b8a9.0a1958"]]},{"id":"95d6b8a9.0a1958","type":"function","z":"13e3e683.083059","name":"compare tasmota web version with tasmota version","func":"var s1 = msg.payload[6];\nvar s2 = payload[0].version; \nvar s3 = payload[1].version;\n\nvar s2Cleaned = s2.split(\"(\")[2]; //split on \"(\" then take first element [0]\nvar s3cleaned = s3.split(\"(\")[2];\n\nvar match = s1 == s2Cleaned && s3Cleaned;\n\nmsg.payload = {\n s1: s1,\n s2: s2Cleaned,\n match: match,\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1150,"y":740,"wires":[["a8c8ecfc.c3822"]]},{"id":"a8c8ecfc.c3822","type":"debug","z":"13e3e683.083059","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1250,"y":700,"wires":[]},{"id":"b210a677.3baaf8","type":"batch","z":"13e3e683.083059","name":"","mode":"count","count":"2","overlap":0,"interval":10,"allowEmptySequence":false,"topics":[],"x":530,"y":840,"wires":[["5bfe3e09.1d8c88"]]}]

Several issues...

  1. error payload is not set is because you cant just access payload in a function, it must be msg.payload
  2. you didnt set a topic for the 2 streams going into the join node
  3. the function needs to loop through the device array to process all results.

As I dont have a copy of your data or access to devices, I threwtogether what i think might work (or at least be close enough for you to fix up)

[{"id":"2fb8e118.b3cace","type":"comment","z":"2f9b53f3.e89e4c","name":"Check Tasmota Web Version","info":"","x":152,"y":480,"wires":[]},{"id":"afd9b191.eb6af","type":"comment","z":"2f9b53f3.e89e4c","name":"Check Sonoff versions","info":"","x":132,"y":660,"wires":[]},{"id":"78f70367.0d9074","type":"inject","z":"2f9b53f3.e89e4c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":112,"y":720,"wires":[["da30c2f2.db772"]]},{"id":"da30c2f2.db772","type":"function","z":"2f9b53f3.e89e4c","name":"hosts","func":"const tasmotas = [\"192.168.1.40\",\"192.168.1.180\"]\nconst status= \"/cm?cmnd=Status%200\"\nfor(let x=0;x<tasmotas.length;x++){\n \n node.send({url:\"http://\"+tasmotas[x]+status})\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":242,"y":720,"wires":[["f4d416e1.f85e98"]]},{"id":"2cf16dc2.081e4a","type":"debug","z":"2f9b53f3.e89e4c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":662,"y":780,"wires":[]},{"id":"f4d416e1.f85e98","type":"http request","z":"2f9b53f3.e89e4c","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":382,"y":720,"wires":[["b210a677.3baaf8"]]},{"id":"5bfe3e09.1d8c88","type":"join","z":"2f9b53f3.e89e4c","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":642,"y":720,"wires":[["2cf16dc2.081e4a","96e34734.d82e1"]]},{"id":"96e34734.d82e1","type":"change","z":"2f9b53f3.e89e4c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.{ \"name\":**.Hostname, \"ipAddress\":**.IPAddress, \"version\":**.Version }","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"deviceData","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":792,"y":720,"wires":[["63f37354.f04534","5ae1d994.c2f198"]]},{"id":"63f37354.f04534","type":"debug","z":"2f9b53f3.e89e4c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1022,"y":720,"wires":[]},{"id":"cb317c2a.650ed","type":"comment","z":"2f9b53f3.e89e4c","name":"NOTA","info":"Al agregar mas sonoff hay que dar de alta la ip en el nodo \"hosts\" y en el nodo \"batch\" hay que sumar la cantidad de mensajes, osea, 2 mensajes 2 sonoffs, 3 mensajes 3 sonoffs...","x":282,"y":660,"wires":[]},{"id":"3b5babc1.a63754","type":"inject","z":"2f9b53f3.e89e4c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":112,"y":540,"wires":[["3f9fa0bd.3c963"]]},{"id":"3f9fa0bd.3c963","type":"http request","z":"2f9b53f3.e89e4c","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://ota.tasmota.com/tasmota/release/","tls":"","persist":false,"proxy":"","authType":"","x":262,"y":540,"wires":[["1e52ea36.0f7356"]]},{"id":"1e52ea36.0f7356","type":"html","z":"2f9b53f3.e89e4c","name":"","property":"payload","outproperty":"payload","tag":"tr","ret":"html","as":"multi","x":402,"y":540,"wires":[["54759709.b0cf28"]]},{"id":"54759709.b0cf28","type":"html","z":"2f9b53f3.e89e4c","name":"","property":"payload","outproperty":"payload","tag":"td","ret":"html","as":"single","x":522,"y":540,"wires":[["bb6e79ef.6cb5b8"]]},{"id":"bb6e79ef.6cb5b8","type":"switch","z":"2f9b53f3.e89e4c","name":"","property":"payload[0]","propertyType":"msg","rules":[{"t":"cont","v":"tasmota.bin","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":682,"y":540,"wires":[["173689e5.8d7376"]]},{"id":"404fa40e.36d8fc","type":"function","z":"2f9b53f3.e89e4c","d":true,"name":"Nueva version tasmota","func":"msg.payload = {}\nmsg.payload.chatId = 587232739;\nmsg.payload.type = 'message';\nmsg.payload.content = 'ALARMA TASMOTA: Hay una nueva version de Tasmota!'\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":912,"y":540,"wires":[[]]},{"id":"173689e5.8d7376","type":"switch","z":"2f9b53f3.e89e4c","name":"","property":"payload[6]","propertyType":"msg","rules":[{"t":"gte","v":"9.2.0","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":682,"y":580,"wires":[["404fa40e.36d8fc","e1ac0c78.293eb","ece974cc.8934a8"]]},{"id":"e1ac0c78.293eb","type":"debug","z":"2f9b53f3.e89e4c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":862,"y":500,"wires":[]},{"id":"5ae1d994.c2f198","type":"join","z":"2f9b53f3.e89e4c","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"payload","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":882,"y":620,"wires":[["95d6b8a9.0a1958"]]},{"id":"95d6b8a9.0a1958","type":"function","z":"2f9b53f3.e89e4c","name":"compare tasmota web version with tasmota version","func":"var webVersion = msg.payload.webData[6]; //get web version\nvar deviceData = msg.payload.deviceData; //get array of devices\nvar NGdevices = [];//where results will go\nvar OKdevices = [];\n//loop through each device\nfor (let i = 0; i < deviceData.length; i++) {\n    let device = deviceData[i]; //get this device\n    var v = device.version; //get device version\n    device.version = v.split(\"(\")[0]; //split on \"(\" then take first element [0]\n    device.match = (device.version == webVersion); //compare device version to webVersion\n    if(device.match) {\n        OKdevices.push(device); //add result\n    } else {\n        NGdevices.push(device); //add result\n    }\n}\n\nmsg.payload = {\n    NGdevices: NGdevices,\n    OKdevices: OKdevices\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1142,"y":620,"wires":[["a8c8ecfc.c3822"]]},{"id":"a8c8ecfc.c3822","type":"debug","z":"2f9b53f3.e89e4c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1242,"y":580,"wires":[]},{"id":"b210a677.3baaf8","type":"batch","z":"2f9b53f3.e89e4c","name":"","mode":"count","count":"2","overlap":0,"interval":10,"allowEmptySequence":false,"topics":[],"x":522,"y":720,"wires":[["5bfe3e09.1d8c88"]]},{"id":"ece974cc.8934a8","type":"change","z":"2f9b53f3.e89e4c","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"webData","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":694,"y":624,"wires":[["5ae1d994.c2f198"]]}]

PS, when pasting code, please surround it with triple backticks

```
code goes between three backticks
```

Wow, thank you so much for all that!.

Copy your flow brings me this error on the function node.

Regards!

Put a debug here
image
what do you see in debug panel?

There...

That payload is different to your earlier code (on which i built the solution)

You have changed / broke something (or the source web page has changed)

Your earlier screenshot...

... If you fix the output of the top leg (in blue rectangle) to output the array as before, it should work.

PS - to help you understand why it is currently failing, the first line of the function expects to access array element [6] for the web firmware version.

1 Like

Capture the output of these 2 debugs...

image

By pressing the copy button on the debug panel
image

Paste them in a reply

```
paste like this
```

for both debug nodes.

Ok, i've deleted my unused nodes...i think that action doesn't broke anything...

These are the debugs nodes output...

image

payload["<a href=\"tasmota.bin.gz">tasmota.bin.gz</a>,http://ota.tasmota.com/tasmota/release/tasmota.bin.gz,419k,<a href="tasmota.bin">tasmota.bin</a>,http://ota.tasmota.com/tasmota/release/tasmota.bin,587k,9.2.0,20201221 15:04"]

image

payload[0]
payload[1]

I meant the "copy value" button (those pasted values are un-usable to me)

image

The thing is that i cannot get the Payload value...

I have this two output...

and this one...

i dunno how to get the value you want.

Dont you see a "Copy Value" button when you hover over the payload?

image

ok, i see it but i dont know what exactly values you need. I mean, what key/values you need.

From the 2 debug nodes highlighted, copy the payload. I need the payloads of them to simulate your data so I can help you solve the current issue.

Hover over the debug output of those and press copy.

1 Like

Ok, tell me if this helps...

image

{"name":"luz_prueba-6101","ipAddress":"192.168.1.40","version":"9.2.0(tasmota)"}
{"name":"luz_escritorio_garaje","ipAddress":"192.168.1.180","version":"8.5.0(tasmota)"}

image

{"Status":{"Module":1,"DeviceName":"luz_prueba","FriendlyName":["luz_prueba"],"Topic":"luz_prueba","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0},"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota/release/tasmota.bin","RestartReason":"Power On","Uptime":"14T20:22:27","StartupUTC":"2021-01-05T21:28:02","Sleep":50,"CfgHolder":4617,"BootCount":304,"BCResetTime":"2020-06-12T04:30:48","SaveCount":3440,"SaveAddress":"F9000"},"StatusFWR":{"Version":"9.2.0(tasmota)","BuildDateTime":"2020-12-21T15:03:40","Boot":7,"Core":"2_7_4_9","SDK":"2.2.2-dev(38a443e)","CpuFrequency":80,"Hardware":"ESP8285","CR":"404/699"},"StatusLOG":{"SerialLog":2,"WebLog":2,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["BellVille2.4ghz",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["002A8009","2805C8000100060000005A00000000000000","00000228","00006000","00000000"]},"StatusMEM":{"ProgramSize":586,"Free":416,"Heap":23,"ProgramFlashSize":1024,"FlashSize":1024,"FlashChipId":"144051","FlashFrequency":40,"FlashMode":3,"Features":["00000809","8FDAC787","04368001","000000CF","010013C0","C000F981","00004004","00001000"],"Drivers":"1,2,3,4,5,6,7,8,9,10,12,16,18,19,20,21,22,24,26,27,29,30,35,37,45","Sensors":"1,2,3,4,5,6"},"StatusNET":{"Hostname":"luz_prueba-6101","IPAddress":"192.168.1.40","Gateway":"192.168.1.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.1.1","Mac":"60:01:94:CA:37:D5","Webserver":2,"WifiConfig":4,"WifiPower":17},"StatusMQT":{"MqttHost":"192.168.1.8","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_CA37D5","MqttUser":"mosquitto","MqttCount":4,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30},"StatusTIM":{"UTC":"2021-01-20T17:50:29","Local":"2021-01-20T18:50:29","StartDST":"2021-03-28T02:00:00","EndDST":"2021-10-31T03:00:00","Timezone":"+01:00","Sunrise":"08:34","Sunset":"17:28"},"StatusSNS":{"Time":"2021-01-20T18:50:29"},"StatusSTS":{"Time":"2021-01-20T18:50:29","Uptime":"14T20:22:27","UptimeSec":1282947,"Heap":23,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":4,"POWER":"OFF","Wifi":{"AP":1,"SSId":"BellVille2.4ghz","BSSId":"C8:D7:19:52:9D:27","Channel":10,"RSSI":100,"Signal":-40,"LinkCount":4,"Downtime":"0T00:09:52"}}}
{"Status":{"Module":1,"DeviceName":"luz_escritorio_garaje","FriendlyName":["luz_escritorio_garaje"],"Topic":"luz_escritorio_garaje","ButtonTopic":"0","Power":1,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0},"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"sonoffs","OtaUrl":"http://thehackbox.org/tasmota/release/tasmota.bin","RestartReason":"Software/System restart","Uptime":"0T23:52:49","StartupUTC":"2021-01-19T17:57:41","Sleep":50,"CfgHolder":4617,"BootCount":488,"BCResetTime":"2020-04-15T00:57:39","SaveCount":6301,"SaveAddress":"F7000"},"StatusFWR":{"Version":"8.5.0(tasmota)","BuildDateTime":"2020-09-09T11:41:02","Boot":7,"Core":"2_7_4_1","SDK":"2.2.2-dev(38a443e)","CpuFrequency":80,"Hardware":"ESP8285","CR":"430/699"},"StatusLOG":{"SerialLog":2,"WebLog":2,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["BellVille2.4ghz",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["002A8109","2805C8000100060000005AFF000000000000","00000200","00006000","00000000"]},"StatusMEM":{"ProgramSize":595,"Free":408,"Heap":23,"ProgramFlashSize":1024,"FlashSize":1024,"FlashChipId":"144051","FlashFrequency":40,"FlashMode":3,"Features":["00000809","8FDAE797","04368001","000000CD","010013C0","C000F981","00004004","00000000"],"Drivers":"1,2,3,4,5,6,7,8,9,10,12,16,18,19,20,21,22,24,26,27,29,30,35,37","Sensors":"1,2,3,4,5,6"},"StatusNET":{"Hostname":"luz_escritorio_garaje","IPAddress":"192.168.1.180","Gateway":"192.168.1.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.1.1","Mac":"DC:4F:22:F9:7D:69","Webserver":2,"WifiConfig":2,"WifiPower":17},"StatusMQT":{"MqttHost":"192.168.1.8","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_F97D69","MqttUser":"mosquitto","MqttCount":1,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30},"StatusTIM":{"UTC":"2021-01-20T17:50:30","Local":"2021-01-20T18:50:30","StartDST":"2021-03-28T02:00:00","EndDST":"2021-10-31T03:00:00","Timezone":"+01:00","Sunrise":"08:34","Sunset":"17:28"},"StatusSNS":{"Time":"2021-01-20T18:50:30"},"StatusSTS":{"Time":"2021-01-20T18:50:30","Uptime":"0T23:52:49","UptimeSec":85969,"Heap":23,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"ON","Wifi":{"AP":1,"SSId":"BellVille2.4ghz","BSSId":"C8:D7:19:52:9D:27","Channel":10,"RSSI":94,"Signal":-53,"LinkCount":1,"Downtime":"0T00:00:06"}}}```

[{"id":"1c91208.fec35df","type":"html","z":"f22589c6.40ba28","name":"","property":"payload","outproperty":"payload","tag":"tr","ret":"html","as":"multi","x":594,"y":416,"wires":[["24ff0fa2.0bd78"]]},{"id":"24ff0fa2.0bd78","type":"html","z":"f22589c6.40ba28","name":"","property":"payload","outproperty":"payload","tag":"td","ret":"html","as":"single","x":714,"y":416,"wires":[["dd64a4c0.568c58"]]},{"id":"99820d79.ce827","type":"http request","z":"f22589c6.40ba28","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://ota.tasmota.com/tasmota/release/","tls":"","persist":false,"proxy":"","authType":"","x":454,"y":416,"wires":[["1c91208.fec35df"]]},{"id":"dd64a4c0.568c58","type":"switch","z":"f22589c6.40ba28","name":"","property":"payload[0]","propertyType":"msg","rules":[{"t":"cont","v":"tasmota.bin","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":594,"y":464,"wires":[["f16ce907.a37a88"]]},{"id":"3fc09af7.0c6176","type":"inject","z":"f22589c6.40ba28","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":304,"y":416,"wires":[["99820d79.ce827"]]},{"id":"f16ce907.a37a88","type":"change","z":"f22589c6.40ba28","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"availableVersion","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload[6]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":768,"y":464,"wires":[["a7dbed0c.cc957","9b06e128.2a5fe"]]},{"id":"a7dbed0c.cc957","type":"join","z":"f22589c6.40ba28","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":962,"y":496,"wires":[["d3fe8df0.e1e6e","88eaf502.bf6ce8"]]},{"id":"d3fe8df0.e1e6e","type":"function","z":"f22589c6.40ba28","name":"compare tasmota web version with tasmota version","func":"var webVersion = msg.payload.availableVersion; //get web version\nvar deviceData = msg.payload.deviceData; //get array of devices\nvar current = [];//where results will go\nvar old = [];\n//loop through each device\nfor (let i = 0; i < deviceData.length; i++) {\n    let device = deviceData[i]; //get this device\n    var v = device.version; //get device version\n    device.version = v.split(\"(\")[0]; //split on \"(\" then take first element [0]\n    device.webVersion = webVersion; //optional\n    device.match = (device.version == device.webVersion); //compare device version to webVersion\n    if(device.match) {\n        current.push(device); //add result\n    } else {\n        old.push(device); //add result\n    }\n}\n\nmsg.payload = {\n    current: current,\n    old: old\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1294,"y":496,"wires":[["88f9688.fd3c198"]]},{"id":"7aa173f.df7f18c","type":"debug","z":"f22589c6.40ba28","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":982,"y":544,"wires":[]},{"id":"88f9688.fd3c198","type":"debug","z":"f22589c6.40ba28","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1398,"y":544,"wires":[]},{"id":"f8eb8e72.964b3","type":"function","z":"f22589c6.40ba28","name":"hosts","func":"const tasmotas = [\"192.168.1.40\",\"192.168.1.180\"]\nconst status= \"/cm?cmnd=Status%200\"\nfor(let x=0;x<tasmotas.length;x++){\n    node.send({\n        url:\"http://\"+tasmotas[x]+status,\n        ip: tasmotas[x]\n    })\n}\nmsg.complete = true;\nmsg.payload = null;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":434,"y":592,"wires":[["bb624e81.2c073"]]},{"id":"19318c4c.785cc4","type":"inject","z":"f22589c6.40ba28","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":300,"y":592,"wires":[["f8eb8e72.964b3"]]},{"id":"24ca6b8a.fb6844","type":"comment","z":"f22589c6.40ba28","name":"NOTA","info":"Al agregar mas sonoff hay que dar de alta la ip en el nodo \"hosts\" y en el nodo \"batch\" hay que sumar la cantidad de mensajes, osea, 2 mensajes 2 sonoffs, 3 mensajes 3 sonoffs...","x":274,"y":640,"wires":[]},{"id":"8828e76c.1e13c8","type":"comment","z":"f22589c6.40ba28","name":"Check Sonoff versions","info":"","x":324,"y":536,"wires":[]},{"id":"5c4cede2.0021b4","type":"comment","z":"f22589c6.40ba28","name":"Check Tasmota Web Version","info":"","x":344,"y":356,"wires":[]},{"id":"bb624e81.2c073","type":"function","z":"f22589c6.40ba28","name":"fake device requests","func":"var fake_httprequests = {\n    \"192.168.1.40\": {\"Status\":{\"Module\":1,\"DeviceName\":\"luz_prueba\",\"FriendlyName\":[\"luz_prueba\"],\"Topic\":\"luz_prueba\",\"ButtonTopic\":\"0\",\"Power\":0,\"PowerOnState\":3,\"LedState\":1,\"LedMask\":\"FFFF\",\"SaveData\":1,\"SaveState\":1,\"SwitchTopic\":\"0\",\"SwitchMode\":[0,0,0,0,0,0,0,0],\"ButtonRetain\":0,\"SwitchRetain\":0,\"SensorRetain\":0,\"PowerRetain\":0},\"StatusPRM\":{\"Baudrate\":115200,\"SerialConfig\":\"8N1\",\"GroupTopic\":\"tasmotas\",\"OtaUrl\":\"http://ota.tasmota.com/tasmota/release/tasmota.bin\",\"RestartReason\":\"Power On\",\"Uptime\":\"14T20:22:27\",\"StartupUTC\":\"2021-01-05T21:28:02\",\"Sleep\":50,\"CfgHolder\":4617,\"BootCount\":304,\"BCResetTime\":\"2020-06-12T04:30:48\",\"SaveCount\":3440,\"SaveAddress\":\"F9000\"},\"StatusFWR\":{\"Version\":\"9.2.0(tasmota)\",\"BuildDateTime\":\"2020-12-21T15:03:40\",\"Boot\":7,\"Core\":\"2_7_4_9\",\"SDK\":\"2.2.2-dev(38a443e)\",\"CpuFrequency\":80,\"Hardware\":\"ESP8285\",\"CR\":\"404/699\"},\"StatusLOG\":{\"SerialLog\":2,\"WebLog\":2,\"MqttLog\":0,\"SysLog\":0,\"LogHost\":\"\",\"LogPort\":514,\"SSId\":[\"BellVille2.4ghz\",\"\"],\"TelePeriod\":300,\"Resolution\":\"558180C0\",\"SetOption\":[\"002A8009\",\"2805C8000100060000005A00000000000000\",\"00000228\",\"00006000\",\"00000000\"]},\"StatusMEM\":{\"ProgramSize\":586,\"Free\":416,\"Heap\":23,\"ProgramFlashSize\":1024,\"FlashSize\":1024,\"FlashChipId\":\"144051\",\"FlashFrequency\":40,\"FlashMode\":3,\"Features\":[\"00000809\",\"8FDAC787\",\"04368001\",\"000000CF\",\"010013C0\",\"C000F981\",\"00004004\",\"00001000\"],\"Drivers\":\"1,2,3,4,5,6,7,8,9,10,12,16,18,19,20,21,22,24,26,27,29,30,35,37,45\",\"Sensors\":\"1,2,3,4,5,6\"},\"StatusNET\":{\"Hostname\":\"luz_prueba-6101\",\"IPAddress\":\"192.168.1.40\",\"Gateway\":\"192.168.1.1\",\"Subnetmask\":\"255.255.255.0\",\"DNSServer\":\"192.168.1.1\",\"Mac\":\"60:01:94:CA:37:D5\",\"Webserver\":2,\"WifiConfig\":4,\"WifiPower\":17},\"StatusMQT\":{\"MqttHost\":\"192.168.1.8\",\"MqttPort\":1883,\"MqttClientMask\":\"DVES_%06X\",\"MqttClient\":\"DVES_CA37D5\",\"MqttUser\":\"mosquitto\",\"MqttCount\":4,\"MAX_PACKET_SIZE\":1200,\"KEEPALIVE\":30},\"StatusTIM\":{\"UTC\":\"2021-01-20T17:50:29\",\"Local\":\"2021-01-20T18:50:29\",\"StartDST\":\"2021-03-28T02:00:00\",\"EndDST\":\"2021-10-31T03:00:00\",\"Timezone\":\"+01:00\",\"Sunrise\":\"08:34\",\"Sunset\":\"17:28\"},\"StatusSNS\":{\"Time\":\"2021-01-20T18:50:29\"},\"StatusSTS\":{\"Time\":\"2021-01-20T18:50:29\",\"Uptime\":\"14T20:22:27\",\"UptimeSec\":1282947,\"Heap\":23,\"SleepMode\":\"Dynamic\",\"Sleep\":50,\"LoadAvg\":19,\"MqttCount\":4,\"POWER\":\"OFF\",\"Wifi\":{\"AP\":1,\"SSId\":\"BellVille2.4ghz\",\"BSSId\":\"C8:D7:19:52:9D:27\",\"Channel\":10,\"RSSI\":100,\"Signal\":-40,\"LinkCount\":4,\"Downtime\":\"0T00:09:52\"}}},\n    \"192.168.1.180\": {\"Status\":{\"Module\":1,\"DeviceName\":\"luz_escritorio_garaje\",\"FriendlyName\":[\"luz_escritorio_garaje\"],\"Topic\":\"luz_escritorio_garaje\",\"ButtonTopic\":\"0\",\"Power\":1,\"PowerOnState\":3,\"LedState\":1,\"LedMask\":\"FFFF\",\"SaveData\":1,\"SaveState\":1,\"SwitchTopic\":\"0\",\"SwitchMode\":[0,0,0,0,0,0,0,0],\"ButtonRetain\":0,\"SwitchRetain\":0,\"SensorRetain\":0,\"PowerRetain\":0},\"StatusPRM\":{\"Baudrate\":115200,\"SerialConfig\":\"8N1\",\"GroupTopic\":\"sonoffs\",\"OtaUrl\":\"http://thehackbox.org/tasmota/release/tasmota.bin\",\"RestartReason\":\"Software/System restart\",\"Uptime\":\"0T23:52:49\",\"StartupUTC\":\"2021-01-19T17:57:41\",\"Sleep\":50,\"CfgHolder\":4617,\"BootCount\":488,\"BCResetTime\":\"2020-04-15T00:57:39\",\"SaveCount\":6301,\"SaveAddress\":\"F7000\"},\"StatusFWR\":{\"Version\":\"8.5.0(tasmota)\",\"BuildDateTime\":\"2020-09-09T11:41:02\",\"Boot\":7,\"Core\":\"2_7_4_1\",\"SDK\":\"2.2.2-dev(38a443e)\",\"CpuFrequency\":80,\"Hardware\":\"ESP8285\",\"CR\":\"430/699\"},\"StatusLOG\":{\"SerialLog\":2,\"WebLog\":2,\"MqttLog\":0,\"SysLog\":0,\"LogHost\":\"\",\"LogPort\":514,\"SSId\":[\"BellVille2.4ghz\",\"\"],\"TelePeriod\":300,\"Resolution\":\"558180C0\",\"SetOption\":[\"002A8109\",\"2805C8000100060000005AFF000000000000\",\"00000200\",\"00006000\",\"00000000\"]},\"StatusMEM\":{\"ProgramSize\":595,\"Free\":408,\"Heap\":23,\"ProgramFlashSize\":1024,\"FlashSize\":1024,\"FlashChipId\":\"144051\",\"FlashFrequency\":40,\"FlashMode\":3,\"Features\":[\"00000809\",\"8FDAE797\",\"04368001\",\"000000CD\",\"010013C0\",\"C000F981\",\"00004004\",\"00000000\"],\"Drivers\":\"1,2,3,4,5,6,7,8,9,10,12,16,18,19,20,21,22,24,26,27,29,30,35,37\",\"Sensors\":\"1,2,3,4,5,6\"},\"StatusNET\":{\"Hostname\":\"luz_escritorio_garaje\",\"IPAddress\":\"192.168.1.180\",\"Gateway\":\"192.168.1.1\",\"Subnetmask\":\"255.255.255.0\",\"DNSServer\":\"192.168.1.1\",\"Mac\":\"DC:4F:22:F9:7D:69\",\"Webserver\":2,\"WifiConfig\":2,\"WifiPower\":17},\"StatusMQT\":{\"MqttHost\":\"192.168.1.8\",\"MqttPort\":1883,\"MqttClientMask\":\"DVES_%06X\",\"MqttClient\":\"DVES_F97D69\",\"MqttUser\":\"mosquitto\",\"MqttCount\":1,\"MAX_PACKET_SIZE\":1200,\"KEEPALIVE\":30},\"StatusTIM\":{\"UTC\":\"2021-01-20T17:50:30\",\"Local\":\"2021-01-20T18:50:30\",\"StartDST\":\"2021-03-28T02:00:00\",\"EndDST\":\"2021-10-31T03:00:00\",\"Timezone\":\"+01:00\",\"Sunrise\":\"08:34\",\"Sunset\":\"17:28\"},\"StatusSNS\":{\"Time\":\"2021-01-20T18:50:30\"},\"StatusSTS\":{\"Time\":\"2021-01-20T18:50:30\",\"Uptime\":\"0T23:52:49\",\"UptimeSec\":85969,\"Heap\":23,\"SleepMode\":\"Dynamic\",\"Sleep\":50,\"LoadAvg\":19,\"MqttCount\":1,\"POWER\":\"ON\",\"Wifi\":{\"AP\":1,\"SSId\":\"BellVille2.4ghz\",\"BSSId\":\"C8:D7:19:52:9D:27\",\"Channel\":10,\"RSSI\":94,\"Signal\":-53,\"LinkCount\":1,\"Downtime\":\"0T00:00:06\"}}},\n}\n\nmsg.payload = fake_httprequests[msg.ip]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":612,"y":592,"wires":[["ec9d2b2e.071af8"]]},{"id":"ec9d2b2e.071af8","type":"join","z":"f22589c6.40ba28","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":594,"y":544,"wires":[["17b0f4da.d1640b"]]},{"id":"17b0f4da.d1640b","type":"change","z":"f22589c6.40ba28","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.{ \"name\":**.Hostname, \"ipAddress\":**.IPAddress, \"version\":**.Version }","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"deviceData","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":768,"y":544,"wires":[["7aa173f.df7f18c","a7dbed0c.cc957"]]},{"id":"9b06e128.2a5fe","type":"debug","z":"f22589c6.40ba28","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":982,"y":448,"wires":[]},{"id":"88eaf502.bf6ce8","type":"debug","z":"f22589c6.40ba28","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1190,"y":544,"wires":[]}]