Trying my first app.. error initialising driver

I am trying to create an app for my Aflamo fire place, it has IR control, and managed to catch the codes for it. I used the example found here on the community (IR Device) but it fails to run. I can install the app, add a devices, but it gets stuck with a spinning circle in the device icon.

When I use the CLI run command, it shows the following error.

2023-07-24T11:36:52.415Z [log] [MyApp] MyApp has been initialized
2023-07-24T11:36:52.423Z [err] [ManagerDrivers] Error Initializing Driver aflamo: /app/drivers/aflamo/signal.js:2

SyntaxError: Invalid or unexpected token
    at Object.compileFunction (node:vm:360:18)
    at wrapSafe (node:internal/modules/cjs/loader:1124:15)
    at Module._compile (node:internal/modules/cjs/loader:1160:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
    at Module.load (node:internal/modules/cjs/loader:1074:32)
    at Function.Module._load (node:internal/modules/cjs/loader:909:12)
    at Module.require (node:internal/modules/cjs/loader:1098:19)
    at Module.homeyRequire [as require] (/node_modules/@athombv/homey-apps-sdk-v3/index.js:12:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at Object.<anonymous> (/app/drivers/aflamo/driver.js:2:18)

signal.js

const { RFSignal } = require('homey-rfdriver');
​
class MySignal extends RFSignal {
  static FREQUENCY = 'ir';
  static ID = 'aflamo';
}
​
module.exports = MySignal;

driver.js

const { RFDriver } = require('homey-rfdriver');
const MySignal = require('./signal.js');

class MyDriver extends RFDriver {
  static SIGNAL = MySignal;
}

module.exports = MyDriver;

This is my first go with making an app for Homey pro 2023, not much experience with node/java, any help would be welcome :slight_smile:

The file signal.js contains a few zero width space characters which shouldn’t be there:


(lines 2 and 7)

Javascript isn’t Java :wink:

Many thanks Robert,

Guess it was from the copy and paste… and of course javascript :wink:

Seems to work now.

Is it possible to explain in short how to add an Action Flow card to an app? It does not need any trigger, I would just like to control the device as “Then”, ie turn it on.

Looked for some examples but still little complicated for me, and as there is no other logic involved, except for custom cababilities (change the color/speed etc of the fire), I am not sure how to do this.