ESP Tasmota + IR Sensor

Hi,

I request help from Portugal.

I made a protection with an ESP w / Tasmota + IR Sensor.
8de8b56387c2c52ed470b5a9efe0a5a51f8842b6

to do some functions with the TV control in the room, like turning off the light in the room ... But I am not able to integrate it into NODE-RED.

MQTT receives the code in NODE-RED, but I'm not able to say code x, it does the function y.
Can you help?

It would be helpful to see the MQTT message that you are trying to utilise.

1 Like

... add a debug node after the mqtt in node - set to show full msg - and show us the result of a couple of messages so we can see the different types that arrive.

1 Like

I apologize for my english, google translator.

I think this is what they asked for:


Set the mqtt output to complete msg output.

1 Like

Great - so from that debug we can see that the (useful) topic is the testeIR/tele/RESULT one - and that the reply is a JSON string... and that the really useful bit is the Data property within that.
So first we can change the MQTT node to Output - a parsed JSON object. That would change it from a string into an object... then you need a change node - set to move msg.payload.Data to msg.payload - before then feeding into a switch (as you have ) and a debug jsut so you can check it's getting the right sort of data.

1 Like

Thank you for your help. I understood the plan, but I don't know how to do it. Can it help explained with print or a Node-RED flow?

Change the mqtt node:

Change the switch node, instead of property msg.payload, change it to msg.payload.Data

2 Likes

hi, still not working. Can you help please?

{"Time":"2020-03-19T19:32:26","IrReceived":{"Protocol":"NEC","Bits":32,"Data":"0x00FDAA55"}}

what is the output from the switch ?

1 Like

There is no information at the output on the Switch.

I think @bakman2 wants to see what is comming fron the switch, Put a separate debug node on each output of the switch.

1 Like

I put Debug in the outputs of the Switch, there is no message in Debug, there is simply no message, Debug is empty.

But your object shows: payload.IrReceived.Data so that is what you should use in the switch node.

1 Like

Put another condition in the switch node and use the 'otherwise' option.
Also, in the switch node are you using 'checking all rules' or 'stopping after first match'?

Use 'stopping after first match' if you aren't trying to make an AND condition with the rules i.e.
if A and B and C go do something <== 'checking all rules'
vrs
if A go do something1
if B go do something2
if C go do something3

1 Like

is the most correct string?

Where is the rule checking for 'otherwise'???

1 Like

Thank you for your help. But can you tell me how to do it?

click the button to add a new rule then click on the condition (the ==) and scroll to the bottom

1 Like

Solved successfully. Thanks to all

1 Like