@PeteKnight was and still is my best teacher
@Blynk_Coeur you can take a look HERE how I learned it, there is nice examples
@PeteKnight was and still is my best teacher
@Blynk_Coeur you can take a look HERE how I learned it, there is nice examples
List of the 7 Available Commands used with âAlexaâ Responses:
Command : " Alexa, turn ON Nest "
Alexa answer : " OK "
Command : " Alexa, turn OFF Nest "
Alexa answer : " OK "
Command : " Alexa, SET Nest to 24 Degree "
Alexa answer : " The A/C is set to 24 "
Command : " Alexa, Make Nest WARMER "
Alexa answer : " Nest is set to 25 "
Command : " Alexa, Make Nest COOLER "
Alexa answer : " Nest is set to 23 "
Command : " Alexa, GET Nest TEMPERATURE "
Alexa answer : " The Nest TEMPERATURE is 24.2 Degrees "
Command : " Alexa, What is Nest Set To ? "
Alexa answer : " The A/C is Set to 23.5 "
Alexa Flow (edited)
[
{
"id": "d9ae9514.3264b8",
"type": "alexa-home",
"z": "185dd456.efb2bc",
"conf": "bdafea05.cb4e28",
"device": "63915",
"acknoledge": false,
"name": "NEST",
"topic": "",
"x": 90,
"y": 840,
"wires": [
[
"b3805687.4f1a68",
"90037f05.85407",
"3724bb10.216a24"
]
]
},
{
"id": "bfb19e30.88851",
"type": "function",
"z": "185dd456.efb2bc",
"name": "Echo ON/OFF",
"func": "if (msg.command == \"TurnOnRequest\" ){\n node.status({fill:\"green\",shape:\"dot\",text: \"Echo => ON\"}); \n msg.topic = \"YORK/power\";\n msg.payload = \"on\";\n return msg;\n}\n\nif (msg.command == \"TurnOffRequest\"){\n node.status({fill:\"grey\",shape:\"ring\",text: \"Echo => OFF\"}); \n msg.topic = \"YORK/power\";\n msg.payload = \"off\";\n return msg;\n}\n",
"outputs": 1,
"noerr": 0,
"x": 340,
"y": 920,
"wires": [
[
"e18942df.cfc0e"
]
]
},
{
"id": "b3805687.4f1a68",
"type": "function",
"z": "185dd456.efb2bc",
"name": "Process Alexa responses",
"func": "if (msg.command === \"TurnOnRequest\"){\n msg.payload = true;\n flow.set('away', false);\n return msg;\n}\n\nif (msg.command === \"TurnOffRequest\"){\n msg.payload = true;\n flow.set('away', true);\n return msg;\n}\n\nif (msg.command === \"SetTargetTemperatureRequest\"){\n if (msg.payload < 10 || msg.payload > 30) {\n var range = {\n min: 10.0,\n max: 30.0\n }\n msg.payload = false;\n msg.extra = range;\n } \n else {\n\t msg.extra = {\n\t\t targetTemperature: {\n\t\t\t value: msg.payload\n },\n temperatureMode: {\n value: \"COOL\",\n freindlyName: \"YORK\"\n }\n } \n msg.payload = true;\n }\n return msg;\n}\n\nif (msg.command === \"IncrementTargetTemperatureRequest\"){\n T = flow.get('TempTarget');\n t = parseFloat(T);\n T = flow.set('TempTarget', t + 1);\n msg.extra = {\n targetTemperature: {\n \"value\": t + 1\n }\n };\n msg.payload = true;\n return msg; \n}\n \nif (msg.command === \"DecrementTargetTemperatureRequest\"){\n T = flow.get('TempTarget');\n t = parseFloat(T);\n T = flow.set('TempTarget', t - 1);\n msg.extra = {\n targetTemperature: {\n \"value\": t - 1\n }\n };\n msg.payload = true;\n return msg; \n}\n \nif (msg.command === \"GetTemperatureReadingRequest\"){\n x =flow.get('TempAmbient');\n msg.extra = {\n \"temperatureReading\": {\n \"value\": x},\n \"applianceResponseTimestamp\": new Date().toISOString()\n };\n msg.payload = true;\n return msg;\n}\n\nif (msg.command === \"GetTargetTemperatureRequest\"){\n y =flow.get('TempTarget');\n msg.extra = {\n targetTemperature: {\n value: y\n },\n temperatureMode: {\n value: \"COOL\"\n }\n }; \n msg.payload = true;\n return msg;\n}\n",
"outputs": 1,
"noerr": 0,
"x": 330,
"y": 840,
"wires": [
[
"c4205d08.3d25a"
]
]
},
{
"id": "c4205d08.3d25a",
"type": "alexa-home-resp",
"z": "185dd456.efb2bc",
"x": 600,
"y": 840,
"wires": []
},
{
"id": "41deb4ea.4805ec",
"type": "comment",
"z": "185dd456.efb2bc",
"name": "Alexa",
"info": "",
"x": 90,
"y": 780,
"wires": []
},
{
"id": "90037f05.85407",
"type": "switch",
"z": "185dd456.efb2bc",
"name": "Commands",
"property": "command",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "TurnOnRequest",
"vt": "str"
},
{
"t": "eq",
"v": "TurnOffRequest",
"vt": "str"
},
{
"t": "eq",
"v": "IncrementTargetTemperatureRequest",
"vt": "str"
},
{
"t": "eq",
"v": "DecrementTargetTemperatureRequest",
"vt": "str"
},
{
"t": "eq",
"v": "SetTargetTemperatureRequest",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 5,
"x": 130,
"y": 940,
"wires": [
[
"bfb19e30.88851"
],
[
"bfb19e30.88851"
],
[
"e8690250.9ff22"
],
[
"e8690250.9ff22"
],
[
"e4179f69.3219e"
]
]
},
{
"id": "e8690250.9ff22",
"type": "function",
"z": "185dd456.efb2bc",
"name": "Echo +/-",
"func": "if (msg.command == \"IncrementTargetTemperatureRequest\" ){\n node.status({fill:\"red\",shape:\"ring\",text: \"Echo => +1°C\"}); \n\n T = flow.get('TempTarget');\n t = parseFloat(T);\n msg.payload = t ;\n return msg;\n \n}\n\n \nif (msg.command == \"DecrementTargetTemperatureRequest\"){\n node.status({fill:\"blue\",shape:\"ring\",text: \"Echo => -1°C\"}); \n\n T = flow.get('TempTarget');\n t = parseFloat(T);\n msg.payload = t ;\n return msg;\n \n}\n\n",
"outputs": 1,
"noerr": 0,
"x": 320,
"y": 980,
"wires": [
[
"e4179f69.3219e"
]
]
},
{
"id": "3724bb10.216a24",
"type": "debug",
"z": "185dd456.efb2bc",
"name": "Nest",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 270,
"y": 780,
"wires": []
},
{
"id": "bdafea05.cb4e28",
"type": "alexa-home-conf",
"z": "",
"username": "your name"
}
]
I never tried to actually capture the return request value. I just use it for âAlexa, whatâs the living room temperatureâ and hear what Alexa has to say in reply.
Pete.
I found the missing command #7 (âGetTargetTemperatureRequestâ)
Command : " Alexa, What is Nest Set To ? "
Alexa answer : " The A/C is Set to 23.5 "
here is the âProcess Alexa Responsesâ function ⊠you can try it.
if (msg.command === "TurnOnRequest"){
msg.payload = true;
flow.set('away', false);
return msg;
}
if (msg.command === "TurnOffRequest"){
msg.payload = true;
flow.set('away', true);
return msg;
}
if (msg.command === "SetTargetTemperatureRequest"){
if (msg.payload < 10 || msg.payload > 30) {
var range = {
min: 10.0,
max: 30.0
}
msg.payload = false;
msg.extra = range;
}
else {
msg.extra = {
targetTemperature: {
value: msg.payload
},
temperatureMode: {
value: "COOL",
freindlyName: "YORK"
}
}
msg.payload = true;
}
return msg;
}
if (msg.command === "IncrementTargetTemperatureRequest"){
T = flow.get('TempTarget');
t = parseFloat(T);
T = flow.set('TempTarget', t + 1);
msg.extra = {
targetTemperature: {
"value": t + 1
}
};
msg.payload = true;
return msg;
}
if (msg.command === "DecrementTargetTemperatureRequest"){
T = flow.get('TempTarget');
t = parseFloat(T);
T = flow.set('TempTarget', t - 1);
msg.extra = {
targetTemperature: {
"value": t - 1
}
};
msg.payload = true;
return msg;
}
if (msg.command === "GetTemperatureReadingRequest"){
x =flow.get('TempAmbient');
msg.extra = {
"temperatureReading": {
"value": x},
"applianceResponseTimestamp": new Date().toISOString()
};
msg.payload = true;
return msg;
}
if (msg.command === "GetTargetTemperatureRequest"){
y =flow.get('TempTarget');
msg.extra = {
targetTemperature: {
value: y
},
temperatureMode: {
value: "COOL"
}
};
msg.payload = true;
return msg;
}
To the ones I respect @PeteKnight
NORA â> NOde Red home Automation (Set of nodes for google home integration)
Values used to represent the modes: off, heat, cool, on, auto, fan-only, purifier, eco, dry
Command : " Hey Google, Set NEST to automatic mode "
Google answer : " You got it, changing NEST to heatcool. "
Command : " Hey Google, Set NEST to 24.5 degrees "
Google answer : " Sure, setting NEST to 24.5 degrees "
Command : " Hey Google, what mode is NEST in? "
Google answer : " NEST is set to heatcool. "
Command : " Hey Google, what is NEST set to? "
Google answer : " Cooling is set to 24.5 degrees. "
Command : " Hey Google, how warm is it in {room name}? "
Google answer : " Heating is set to 21, with a current temperature of 19 "
Command : " Hey Google, whatâs the humidity at NEST ? "
Google answer : " Sorry, I canât reach Nest right now please try again "
âNEST has a current humidity reading of 57%â
Command : " Hey Google, whatâs the living room humidity? "
Google answer : " Sorry, I canât reach Nest right now please try again "
Command : " Hey Google, Make it warmer "
Google answer : " Sure, warming NEST up "
Command : " Hey Google, Make it cooler "
Google answer : " Ok, cooling NEST down "
Command : " Hey Google, Raise the Temperature "
Google answer : " You got it, warming NEST up "
Command : " Hey Google, lower the Temperature "
Google answer : " You got it, cooling NEST down "
Command : " Hey Google, Raise the Temperature by 4 degrees "
Google answer : " Ok, warming up NEST "
Command : " Hey Google, lower the Temperature by 2 degrees "
Google answer : " You got it, cooling down NEST "
Command : " Hey Google, Set the temperature to 23.5 degrees "
Google answer : " You got it, setting NEST to 23.5 degrees "
Command : " Hey Google, How warm is it in here? "
Google answer : " Cooling is set to 23.5, with a current temperature of 24 "
Command : " Hey Google, what is the room temperature? "
Google answer : " Cooling is set to 23.5, with a current temperature of 24 "
Safety Rules for My Smart Thermostat (Tasmota Console)
Rule1
if any problem arise with the temperature Sensor, HVAC will shut down [power3],
only one Fan speed is accepted at a time [power4 , power5, power6],
also mode relays âHeating & Coolingâ cannot be On at the same time [power1, power2] .
Rule1
on tele-SI7021#temperature=null do backlog Power1 off; Power2 off; Power3 off; Power4 off; Power5 off; Power6 off endon
on Power3#state=0 do backlog Power1 off; Power2 off; Power4 off; Power5 off; Power6 off endon
on power4#state=1 do backlog power5 off; power6 off endon
on power5#state=1 do backlog power4 off; power6 off endon
on power6#state=1 do backlog power4 off; power5 off endon
on power1#state=1 do power2 off endon
on power2#state=1 do power1 off endon
Rule2
if the SI7021 temperature sensor is faulty then publish an MQTT message to turn the power OFF.
Rule2
on tele-SI7021#temperature=null do publish YORK/power off endon
WLED_RGB_ALEXA_EFFECTS: this uses the ânode-red-contrib-alexa-localâ Alexa-Local node to communicate to Alexa. NO extra Alexa Skills required and NO account linking required to use this node. How this work is you place the Alexa-Local in your flow and give it a name, then tell alexa to search for new devices. once she finds them they are treated as lights. then you just say âAlexa Preset 1 onâ or âAlexa turn on Preset 1â. The first 3 nodes in this flow also have extra nodes called âSolidâ, âHalloweenâ, and âChristmasâ. I have set the presets in WLED to be the 3 previously named presets and so you can then say âAlexa Christmas Lights onâ or âAlexa Turn on Solid Lightsâ or âAlexa Solid Lights onâ. you can change them all to named devices or leave them at âPreset 1â and so on.
the Flow
[{"id":"bf702d4a.3e365","type":"tab","label":"WLED Alexa Effects","disabled":false,"info":""},{"id":"9dc9f61b.9ad078","type":"mqtt out","z":"bf702d4a.3e365","name":"","topic":"wled/deck/api","qos":"0","retain":"","broker":"7572a9bd.a18bc8","x":940,"y":400,"wires":[]},{"id":"431e1d49.1bff74","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=1","output":"str","x":710,"y":80,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"ea56ce69.183db","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=2","output":"str","x":710,"y":120,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"25283519.9c3d0a","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=3","output":"str","x":710,"y":160,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"76f79373.9b27cc","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=4","output":"str","x":710,"y":200,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"14dfe68e.ebf239","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=5","output":"str","x":710,"y":240,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"ad9da59f.be2538","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=6","output":"str","x":710,"y":280,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"7f21458d.4792dc","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=7","output":"str","x":710,"y":320,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"d5050e0f.9e09a","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=8","output":"str","x":710,"y":360,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"22904b12.461b14","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=9","output":"str","x":710,"y":400,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"d8e8125f.2170f","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=10","output":"str","x":710,"y":440,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"d1b48e57.c79f9","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=11","output":"str","x":710,"y":480,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"85b46b1a.4c32a8","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=12","output":"str","x":710,"y":520,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"76270044.d9775","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=13","output":"str","x":710,"y":560,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"d0082c47.66756","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=14","output":"str","x":710,"y":600,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"1863837d.81952d","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=15","output":"str","x":710,"y":640,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"38adbbe2.543414","type":"template","z":"bf702d4a.3e365","name":"Preset","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PL=16","output":"str","x":710,"y":680,"wires":[["9dc9f61b.9ad078","bec9c10.f923d4"]]},{"id":"bec9c10.f923d4","type":"debug","z":"bf702d4a.3e365","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":930,"y":300,"wires":[]},{"id":"89739884.3a3b08","type":"amazon-echo-hub","z":"bf702d4a.3e365","port":"80","processinput":0,"x":170,"y":360,"wires":[["9b469ece.ab23a","cf0faae1.f916c8","8a36f82b.8b5fb8","cdcc9342.b9c6a","221dbf07.a89c5","3b606b4b.352e44","62c9b666.a540a8","cab73385.dc2b2","a8aab16d.00352","c646520b.85434","e0b14dd0.ee1c3","effdef83.c9928","b73c4571.2a8528","8f67dfc1.e1e0f","c29ca52a.6e1368","f41dfd73.d924a","8efa6fe9.14484","b81ad5bd.234078","22bbc0e5.09f5b"]]},{"id":"9b469ece.ab23a","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 1","topic":"","x":580,"y":80,"wires":[["431e1d49.1bff74"]]},{"id":"cf0faae1.f916c8","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 2","topic":"","x":580,"y":120,"wires":[["ea56ce69.183db"]]},{"id":"8a36f82b.8b5fb8","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 3","topic":"","x":580,"y":160,"wires":[["25283519.9c3d0a"]]},{"id":"cdcc9342.b9c6a","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 4","topic":"","x":580,"y":200,"wires":[["76f79373.9b27cc"]]},{"id":"221dbf07.a89c5","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 5","topic":"","x":580,"y":240,"wires":[["14dfe68e.ebf239"]]},{"id":"3b606b4b.352e44","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 6","topic":"","x":580,"y":280,"wires":[["ad9da59f.be2538"]]},{"id":"62c9b666.a540a8","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 7","topic":"","x":580,"y":320,"wires":[["7f21458d.4792dc"]]},{"id":"cab73385.dc2b2","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 8","topic":"","x":580,"y":360,"wires":[["d5050e0f.9e09a"]]},{"id":"a8aab16d.00352","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 9","topic":"","x":580,"y":400,"wires":[["22904b12.461b14"]]},{"id":"c646520b.85434","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 10","topic":"","x":580,"y":440,"wires":[["d8e8125f.2170f"]]},{"id":"e0b14dd0.ee1c3","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 11","topic":"","x":580,"y":480,"wires":[["d1b48e57.c79f9"]]},{"id":"effdef83.c9928","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 12","topic":"","x":580,"y":520,"wires":[["85b46b1a.4c32a8"]]},{"id":"b73c4571.2a8528","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 13","topic":"","x":580,"y":560,"wires":[["76270044.d9775"]]},{"id":"8f67dfc1.e1e0f","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 14","topic":"","x":580,"y":600,"wires":[["d0082c47.66756"]]},{"id":"c29ca52a.6e1368","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 15","topic":"","x":580,"y":640,"wires":[["1863837d.81952d"]]},{"id":"f41dfd73.d924a","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Preset 16","topic":"","x":580,"y":680,"wires":[["38adbbe2.543414"]]},{"id":"b81ad5bd.234078","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Solid Color","topic":"","x":370,"y":60,"wires":[["431e1d49.1bff74"]]},{"id":"8efa6fe9.14484","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Halloween lights","topic":"","x":360,"y":100,"wires":[["ea56ce69.183db"]]},{"id":"22bbc0e5.09f5b","type":"amazon-echo-device","z":"bf702d4a.3e365","name":"Christmas lights","topic":"","x":360,"y":140,"wires":[["25283519.9c3d0a"]]},{"id":"7572a9bd.a18bc8","type":"mqtt-broker","z":"","name":"MQTT","broker":"192.168.110.10 ","port":"1883","clientid":"Node-Red","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
My flow with more presets
Bon travail !
Il va vraiment falloir que jâapprenne a programmer avec Node-Red
ĂĂ mâa lâair bien compliquĂ©
@Blynk_Coeur
non ce nâest pas complique. mois jâai 65 ans et jâ apprends toujours.
DrZzs est un (Dr.) Anesthesiste avec 6 enfants et malgre ca il apprend H.A. et lâelectronique.
Un peu de volonte et ca marchera.
jâamerais aussi que tu prennes un coup dâoeil sur âHome Assistantâ Paradis Artificiels
excuse-moi mon KB est anglais
Itâs not that complicated, just a little bit different.
Itâs actually very easy to get started, just drag some nodes onto the screen ad join them up with bits of spaghetti and youâll get some instant results.
But, itâs a bit like Blynk where you very quickly start delving a bit deeper and writing functions - but the language is very similar to C++ so easy to figure out.
For me, Node-Red is a sort of integration layer that makes it very easy for lots of things to talk to each other. all my devices talk to Node-Red using MQTT messages and Node-Red talks to Blynk, Alexa and anything else I want using plug-ins that have already been developed.
You should give it a try.
Pete.
GĂ©nial ce site !! merci !
if you are using ALEXA or GOOGLE Home , Here is the Flow
the Functions
if (msg.payload.state == "off") {msg.payload = 0}
if (msg.payload.state == "on") {msg.payload = 1}
return msg;
if (msg.payload.params.switch == 'off' ) {
msg.payload = 0 ;
}
else if (msg.payload.params.switch == 'on') {
msg.payload = 1 ;
}
return msg;
Can I get this code?