Getting Started
Plugins in nymea are used to expand the functionality and capabilities of the nymea server. A plugin is basically a shared library, which will be loaded dynamically by the nymea server during the start up process. Each plugin has a name, a uuid and a list of supported vendors which will be visible in the system once the plugin is loaded. Each of those Vendors contains a list of supported DeviceClasses. A DeviceClass describes how the supported Device looks like, how it will be created (CreateMethod), how the setup (SetupMethod) looks like and what you can do with the Device.
Devices
A device in nymea can represent a real device, a gateway or a online service (for example a weather service API). When you want to add support for your own device / service in nymea, you should try to abstract that device and think in terms like:
- ParamTypes → A Device can have Params, which will be needed to set up the device (like IP addresses or device identification) and give information needed for setup and load a device. The ParamType represents the description of an actual Param. Params will be set when a device is configured initially and can only be changed by a complete reconfiguration of the given device.
- SettingsTypes → A Device can have settings. They are like params, with the exception that the user (and also the plugin developer) can change them at runtime. Settings should be used to change the behabior of a device at runtime. An example would the the refresh interval when polling a web server.
- StateTypes → A Device can have States, which basically represent a value of a Device like current temperature or ON/OFF. The StateType represents the description of an actual State.
- EventTypes → A Device can emit Events, which basically represent a signal. An example of an Event could be: Button pressed. An Event can have Params to give the possibility to pass information with the signal. The EventType represents the description of an actual Event.
- ActionTypes → A Device can execute Actions, which represent basically a method for the Device which the user can execute. An example of an Action could be: Set temperature. An Action can have Params to give the possibility to parameterize the action. The ActionType represents the description of an actual Action.
The DeviceClass represents the description of an actual Device.
Hardware resources
The libnymea provides a list of HardwareResources, which can be used in every plugin. When sou start writing a plugin, you need to know which resource you will need. Each resource provides it's own interface for a DevicePlugin. In the plugin you don't have to take care about the resource.
Getting started with a plugin