Hi Guys, right now I´m working node-red to integrate with amazon Echo (Alexa) and I have success to integrate Switches but I have doubts how to do it well with door lock.
I seen that the Alex Home node sending a command GetLockStateRequest and than I formatted a GetLockStateResponse with payload (Locked or unlocked) synchronous with global variable that represents the state of door lock trought Alexa home resp node. Since Alexa home node received message the Alexa App waiting a response and than show the error: "Door lock is not responding".
The function that changes lock state can be seen bellow:
var Doorlockfeedback = global.get("DoorLockFeedback");
if (Doorlockfeedback.LockCurrentState === 0) {
console.log(`Door lockState :)` +Doorlockfeedback.LockCurrentState);
var status = {payload :{lockState: "LOCKED"}};
msg.paylaod = status;
return msg;
} else if (Doorlockfeedback.LockCurrentState === 1) {
console.log(`Door lockState :)` +Doorlockfeedback.LockCurrentState);
var status = {payload :{lockState: "UNLOCKED"}};
msg.paylaod = status;
return msg;
}
The Msgs (Request and Response) on node-red debug can be seen bellow:
Please, can Somebody help me to solve this?