I would do it like this, no need for global variables.
[{"id":"3e4a4081.cbe08","type":"debug","z":"514a90a5.c7bae8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":578,"y":495,"wires":[]},{"id":"9c19a1a9.a2da9","type":"inject","z":"514a90a5.c7bae8","name":"","topic":"topic1","payload":"BIENVENIDO","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":132.5,"y":449,"wires":[["9ec7b65f.640f38"]]},{"id":"bec7f206.3dbca8","type":"inject","z":"514a90a5.c7bae8","name":"","topic":"temperature","payload":"24","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":124.5,"y":589,"wires":[["9ec7b65f.640f38"]]},{"id":"81be4b83.6170b","type":"inject","z":"514a90a5.c7bae8","name":"","topic":"temperature","payload":"22","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":121,"y":624,"wires":[["9ec7b65f.640f38"]]},{"id":"14efe62d.28395a","type":"inject","z":"514a90a5.c7bae8","name":"","topic":"topic1","payload":"Something Else","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":139,"y":482,"wires":[["9ec7b65f.640f38"]]},{"id":"9ec7b65f.640f38","type":"join","z":"514a90a5.c7bae8","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":391.5,"y":575,"wires":[["6addbc3c.268eec"]]},{"id":"6addbc3c.268eec","type":"function","z":"514a90a5.c7bae8","name":"Test","func":"if (msg.payload.topic1 === \"BIENVENIDO\" && msg.payload.temperature <= 23 ) {\n msg.payload = \"ON\";\n} else {\n msg.payload = \"OFF\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":529.5,"y":574,"wires":[["3e4a4081.cbe08"]]}]