Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Displays last 100 lines of logs for a given module. If --follow option is specified, realtime logs will be streamed from the device.

Restart a module

omg dev invoke <orgName>.<deviceName> <moduleName> restart

Restarts a module

Module methods

module.settings - settings object for a module.

on_settings(callback) - registers a handler for settings update. When any value have changed for a running module, a callback will be invoked.

on_method(name, callback) - registers a handler for a direct module method. When method is invoked by omg utility or the cloud, a callback will be executed, receiving parameters as a first argument. if the handler function throws an exception, a result code 500 will be returned to calling party. Otherwise a result code 200 will be returned, with a function return value as a result.

broadcast(type, payload) - broadcasts a message via message bus. The message could be received by screen application and other devices.

on_event(type, callback) - registers a handler for an incoming message. The handler receives arguments of (type, payload). Messages can be sent from screen application or other devices.

publish(topic, payload) - writes to a specified MQTT topic. NOTE: that only topics with names starting with public/ are currently accessible.

subscribe(topic, handler) - subscribes for messages on a specified MQTT topic. Wildcards are supported. NOTE: that only topics with names starting with public/ are currently accessible.