RF433: Unknown Command

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.

If you have this definition:

"cmds" : {
  "toggle" : [ 0, 1, 1, 0, ... ]
}

You should use this call:

await mySignal.cmd("toggle");

If you don’t define static commands, use await mySignal.tx([ 0, 1, 1, 0, ... ])

1 Like

many thanks!
it does not produce an error now, but the receiver is not receiving the signal or Homey is not transmitting the signal.
I am activating the signal via the on/off capability of the local Homey driver

Do you happen to have any method to troubleshoot?
The console didn’t log a ‘on received command’ event.

Homey will not listen to the commands it sends itself.

Have you tried using .tx() instead of a predefined command? Homey lacks proper debugging utilities for this, so other than something external (like an SDR or possibly an oscilloscope) your options are limited.