How to use custom commands

Oliver Kraitschy okraits at arcor.de
Fri Jul 1 03:36:22 EDT 2016


Hi Zaid,

sorry for the delay, i've been busy with other things and didn't have the time
to play with custom commands.

On Sat, Jun 11, 2016 at 12:05:49AM +0300, Zaid Abdulla wrote:

> There's a special preset configuration for custom commands. You need to
> use that.

Yes, i figured out that i need to use

<filename-without-extension> <functionname>

in the custom_command_age configuration.
> 
> > 4. What is the parameter path of a custom command? I got a subtree
> > InternetGatewayDevice.CustomCommand but it has zero entries. But if i
> > look in the mongodb, i see the custom command with its value,
> > associated with the device.
> 
> It's _customCommands.<command_name>.

My custom command gets executed successfully every 120 seconds, nevertheless
i don't see any entries at that path, just the subtree without any actual
entries in it.

Here is my test custom command update_firmware.js:

// get: fetches some value from outside
exports.get = function(deviceId, args, callback) {
  var err = 0;
  if (err) return callback(err);
  return callback(err, "foobar");
};

// init: is executed on device bootstrap
exports.init = function(deviceId, args, callback) {
  return exports.get(deviceId, args, callback);
};

// get: sets some value on the outside
exports.set = function(deviceId, args, callback) {
  return;
};

Why is the value not shown in the parameters list?


I want to do an automatic firmware update triggered by the ACS, with a preset.
Just adding a Software version configuration to a preset didn't trigger the
firmware update.

Can i trigger it with a custom command then? (I can push a file from the gui
so it should be doable with a custom command.) Did you already do that in the
past? If yes, can you share how you did it?

Thank you in advance.

Greetings,
Oliver


More information about the Users mailing list