-
Notifications
You must be signed in to change notification settings - Fork 0
Developing custom plugins
sceeter89 edited this page Jun 8, 2015
·
2 revisions
To develop custom sensor or motor you need to create a yapsy-plugin, which basically means:
- Copy template from
plugin/templatesdirectory, and give it appropriate name, .yapsy-plugin file must have name matching directory name. - Update information in yapsy-plugin file
- Mandatory fields are in
Coresection: 1. Name - plugin's name, that will be logged if something noticeable happens to plugin 1. Module - name of plugin's directory, or file name if it's single file plugin 1. Key - short-hand, unique name, that will be used to clearly identify plugin. Only one plugin with given name will be loaded. This is also string that motors will use to access some concrete sensor from system state. It also means, that you cannot enter key that matches built-in sensor name. Keys are case-insensitive. 1. Last chance - this parameter is valid only for motor plugins. If you set this parameter toTruethen this motor will be executed during last loop when application is terminated. This might be useful for motors to shutdown corresponding devices or send notification that system is shutting down.
Generally command_center will "swallow" all exceptions thrown in sensor/motor, log them and eventually disable plugin
if it does not work properly. There are two exceptions:
- If you press Ctrl+C, then
command_centerwill shutdown gracefully, so you may kill it from console. - If, for some reason, you really want application to stop (probably due to some hardware failure, or alert) you can
throw
TerminateApplicationerror which will force application to stop.
Shutdown procedure is as follows:
- Finish current loop
- Set
terminationbuilt-in sensor - Execute final loop only for motors declared as last chance. When you declare such a motor please notice, that in last loop state will only contain built-in sensors, so be prepared for missing custom sensors state.
- Terminate application
Sensors, then motors, if too much fails then disabled and logged information about all exceptions. Conditions when disabled.
About sensors.
About motors.
- Home
- [Writing own plugins](Developing custom plugins)
- Built-in sensors
- Built-in motors