Newbie developer attempting to write an app for RF-433
Followed the Homey dev videos to create an app and add a device/driver.
Used SDK3 to read about the Homey SDK script for RF433.
The signal is one signal for a simple on/off.
The receiver detects this signal and toggles ON/OFF.
433 signal - contents removed to make the post shorter
{
"sof": [XX],
"eof": [XX],
"words": [[XX1],[XX2]],
"interval": 10000,
"sensitivity": 0.5,
"repetitions": 20,
"minimalLength": XX,
"maximalLength": XX,
"cmds": {"toggle": []}
}
Is the cmds array required?
device.js code - mostly from the dev tutorial video and SDK3
this.registerCapabilityListener('onoff', async (value) => {
this.log('Turned On/Off:', value)
// create & register a signal using the id from signal manifest
const mySignal = this.homey.rf.getSignal433("light433")
// start listening to data by enabling receive
await mySignal.enableRX();
// on a payload event
mySignal.on("payload", function (payload, first) {
console.log(`received data: ${payload} isRepetition ${!first}`);
});
// on a command event
mySignal.on("cmd", function (cmdId, first) {
console.log(`received command: ${cmdId} isRepetition: ${!first}`);
});
// stop listening to data by disabling receive
// await mySignal.disableRX();
// transmit the bits
// await mySignal.tx(
// [0,0,0,1,1,1]
// );
// Transmit predefined command
await mySignal.cmd(value);
})
Additional information:
"category": ["lights"],
"permissions": ["homey:wireless:433"],
"class": "light",
"capabilities": ["onoff"],
"platforms": ["local"],
"connectivity": ["rf433"]
When i run the app, the on/off capability seems to work fine.
I get a unknown_cmd error.
I have tried various forms of the cmdID string in
await mySignal.cmd(value)
including light433, âlight433â, toggle, âtoggleâ to try to get the code to look at the signal cmds.
Please advice what is wrong with my code. Where is Homey looking for the commands?
Also, is there another way to send this RF433 signal to toggle on/off?
Thank you.