Apologies for a perhaps dump question (still very limited in knowledge about homey sdk and java scripting), but the here’s something I can’t get to work.
I am using the 433mhz example from the SDK pages, and got it working to receive a signal. However what I would like to do is upon receiving the signal, setting the device capability to on or off,
So in my device.js is the following;
mySignal.on("payload", function (payload, first) {
console.log("Signal received")
this.setCapabilityValue('onoff', false).catch(MyDevice.error);
});
and produces the following error:
Signal received
[HomeyClient] homey:manager:rf.onEvent Listener Error: TypeError: this.setCapabilityValue is not a function
at Signal433.<anonymous> (/app/drivers/test/device.js:81:16)
at Signal433.emit (node:events:525:35)
at ManagerRF._onEvent (/node_modules/@athombv/homey-apps-sdk-v3/manager/rf.js:39:24)
at /node_modules/@athombv/homey-apps-sdk-v3/lib/HomeyClient.js:111:13
at Array.forEach (<anonymous>)
at HomeyClient._onMessage (/node_modules/@athombv/homey-apps-sdk-v3/lib/HomeyClient.js:109:19)
at EventEmitter.emit (node:events:513:28)
at /homey-app-runner/lib/App.js:157:26
at new Promise (<anonymous>)
at /homey-app-runner/lib/App.js:156:18
How would it be possible to access the setDeviceCapability
in that function?