vinodsr / node-red-contrib-tuya-smart-device

a node-red module for managing tuya smart devices
https://flows.nodered.org/node/node-red-contrib-tuya-smart-device
MIT License
43 stars 15 forks source link

Incoming message Outgoing message #82

Closed hannoverRed closed 2 years ago

hannoverRed commented 2 years ago

Hello everyone,

could you get the function that if you send a message to the node, it doesn't output a message. but only a message output if no input value came before?

lg

msillano commented 2 years ago

This cannot be a general rule: many DPs change on their own under various circumstances.

But it is easy do it for some DPs, if required, using 2 more nodes. Example:

  1. device output: Strore in the flow the reponse msg, e.g. in 'last-data': flow.set("last-data", msg);
  2. device input: Test 'last-data' before to send any message: if (env.get('last-data' ) === undefined) send(message).

So the message is sent to device one and only one time.

Enjoy

hannoverRed commented 2 years ago

do you have an example flow?

msillano commented 2 years ago

Immagine 2022-04-10 110339 Code function node 'check':

if (flow.get("last data"))
    return null;
return msg;

Code function node 'store'

//example:  only for DP 5
if(msg.payload.data.dps[5])
   flow.set("last-data", msg);
return msg;

enjoy m.s.

hannoverRed commented 2 years ago

Hi, thanks for the tip. but that doesn't change the value. True False

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

Auto closing the issue