mabunixda / node-red-contrib-nuki

node for nuki
MIT License
6 stars 9 forks source link

Sending Topic to Bridge #26

Closed ebnerjoh closed 3 years ago

ebnerjoh commented 3 years ago

Hello, I need a simple help. Sending a Topic (e.g. Info) to a bridge is done via "Inject", is this correct?

If yes, what exactly do I have to send?

mabunixda commented 3 years ago

yeah you are right. you must set topic and payload:

to lock:

msg= {topic: "lockAction", payload : "LOCK"};

to unlock:

msg= {topic: "lockAction", payload : "UNLOCK"};

or query the current status:

msg = { topic: "lockStatus" };

You can use inject, but can also use e.g. HTTP in node make the calls available from "outside" of nodered.

i hope to get the functionality implemented that the status is update automatically and must not be queried anymore

ebnerjoh commented 3 years ago

Hi,

I am still fighting. Can I achieve this via an "injection" or do I need a "change" node or something else?

E.g.: I wanted to query the lockStatus:

[image: image.png]

this is not working.

Then I tested with a Change Node:

[image: image.png]

Also this is not working.

I get the following error message:

"ReferenceError: payload is not defined"

Br, Johannes

Am Fr., 20. Aug. 2021 um 09:03 Uhr schrieb Martin Buchleitner < @.***>:

year your are right. you must set topic and payload:

to lock:

msg= {topic: "lockAction", payload : "LOCK"};

to unlock:

msg= {topic: "lockAction", payload : "UNLOCK"};

or query the current status:

msg = { topic: "lockStatus" };

i hope to get the functionality implemented that the status is update automatically and must not be queried anymore

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mabunixda/node-red-contrib-nuki/issues/26#issuecomment-902480385, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALEUALHL6MLJAOTNDS5TFYTT5X425ANCNFSM5COATN5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

mabunixda commented 3 years ago

Please set this screenshots on github. I also works with just inject nodes when setting topic and payload

ebnerjoh commented 3 years ago

Hi,

This is the example with lockStatus for "control in".

image

Br, Johannes

mabunixda commented 3 years ago

yeah that should be fine.. or for lockAction nodered-nuki-inject

What is the output of the nuki "control in" node? or the node-red console output?

ebnerjoh commented 3 years ago

The Output of "control in" is " ReferenceError: payload is not defined"

Tested with your settings.

But API Access is working, I can see the Smart Lock in the "control in".

Am Fr., 20. Aug. 2021 um 12:11 Uhr schrieb Martin Buchleitner < @.***>:

yeah that should be fine.. or for lockAction [image: nodered-nuki-inject] https://user-images.githubusercontent.com/1193145/130218135-7062ed47-af7d-4ac6-b142-abaec190d594.png

What is the output of the nuki "control in" node? or the node-red console output?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mabunixda/node-red-contrib-nuki/issues/26#issuecomment-902588121, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALEUALA452QEC7GMLAKCNSTT5YS6FANCNFSM5COATN5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

ebnerjoh commented 3 years ago

I tested now a manual request from the API:

http://**IP**:8080/list?token=**TOKEN**

and I got response. So basically the Bridge API is working.

mabunixda commented 3 years ago

yeah when you get a list of smart lock(s), then the API connection is working already. Did you select the lock in the node?

ebnerjoh commented 3 years ago

It looks like the following:

image

ebnerjoh commented 3 years ago

[{"id":"265e3d80.b66f62","type":"nuki-lock-control","z":"253be448.e51e8c","name":"","nuki":"682241085","bridge":"d468a05e.2b165","x":520,"y":580,"wires":[[]]},{"id":"53cfa276.7aa63c","type":"inject","z":"253be448.e51e8c","name":"Lock","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"lockAction","payload":"LOCK","payloadType":"str","x":250,"y":580,"wires":[["265e3d80.b66f62"]]},{"id":"d468a05e.2b165","type":"nuki-bridge","host":"IP","port":"8080"}]

mabunixda commented 3 years ago

Your flow works out of the box when I update it to my bridge and select nuki and get this response:

{"topic":"lockAction","nuki":"Outdoor","nukiId":237252569,"payload":true,"_msgid":"dfff695d.302b08"}

Are you able to see any output on the node-red application output? there should be logs from the nuki nodes

ebnerjoh commented 3 years ago
23 Aug 09:54:02 - [info] [nuki-bridge:d468a05e.2b165] Nuki Payload: {"_msgid":"d6853d25.c289f","payload":"LOCK","topic":"lockAction"}
23 Aug 09:54:02 - [error] [nuki-lock-control:265e3d80.b66f62] ReferenceError: payload is not defined
mabunixda commented 3 years ago

Can you downgrade to version 1.0.0 - there is a bug in 1.0.1

ebnerjoh commented 3 years ago

I am too stupid to downgrade or install the older version.

I cannot do it on NodeRed directly, correct?

I have uninsallted the 1.0.1 and then I was running the following command on the command line:

npm i node-red-contrib-nuki@1.0.0

pi@pivpn:~ $ npm i node-red-contrib-nuki@1.0.0
npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN pi No description
npm WARN pi No repository field.
npm WARN pi No README data
npm WARN pi No license field.

+ node-red-contrib-nuki@1.0.0
updated 1 package and audited 150 packages in 9.136s

7 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

But I do not see the nodes in Node Red

ebnerjoh commented 3 years ago

my mistake, have to run it in the home directory of node red...

ebnerjoh commented 3 years ago

Ok, tested with 1.0.0 and with the brand new 1.0.2

Many Thanks!

mabunixda commented 3 years ago

no problem - i already published 1.0.2 with fixxes the problem!