Plugins in nymea are used to expand the functionalitys and capabilitys of the nymea server. A plugin is basically a shared library, which will be loaded dynamically from 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 thouse 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.
A device in nymea can represent a real device, a gateway or even a service like weather. When you want to represent you 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.
- 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.
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