haben und diese noch einen Platzhalter enthält, passiert hier noch nichts.
## Implementierung des Plugins selbst
+Das Plugin wird in der Datei `controlpi_plugins/overshoot.py`implementiert,
+die zunächst einige benötigte Module, Klassen und Typen implementiert:
+```python
+"""ControlPi Plugin for Giving a State Overshoot Time."""
+import asyncio
+
+from controlpi import BasePlugin, Message, MessageTemplate
+from controlpi.baseplugin import JSONSchema
+```
+Jedes Plugin erbt von der abstrakten Klasse `controlpi.BasePlugin`:
+```python
+class Overshoot(BasePlugin):
+ """ControlPi plugin for Giving a State Overshoot Time."""
+```
+Es müssen hierbei zumindest die Konstante `CONF_SCHEMA`, die synchrone
+Methode `process_conf` und die asynchrone Methode `run` implementiert
+werden.
### Konfigurations-Schema
+Die Konstante `CONF_SCHEMA` enthält ein JSON-Schema, das definiert, wie die
+Konfiguration für dieses Plugin beschaffen ist.
+
+In unserem Fall ...
+```python
+ CONF_SCHEMA: JSONSchema = {'properties':
+ {'state': {'type': 'string'},
+ 'overshoot': {'type': 'integer',
+ 'default': 10}},
+ 'required': ['state']}
+```
-### Registrierung am Message-Bus
+### Verarbeiten der Konfiguration und Registrieren am Message-Bus
+
+```python
+ def process_conf(self) -> None:
+ """Register bus client."""
+ self._state = False
+ self.bus.register(self.name, 'Overshoot',
+ [MessageTemplate({'event':
+ {'const': 'changed'},
+ 'state':
+ {'type': 'boolean'}}),
+ MessageTemplate({'state':
+ {'type': 'boolean'}}),
+ MessageTemplate({'target':
+ {'const': self.conf['state']},
+ 'command':
+ {'const': 'set state'},
+ 'new state':
+ {'type': 'boolean'}})],
+ [([MessageTemplate({'target':
+ {'const': self.name},
+ 'command':
+ {'const': 'get state'}})],
+ self._get_state),
+ ([MessageTemplate({'target':
+ {'const': self.name},
+ 'command':
+ {'const': 'set state'},
+ 'new state':
+ {'type': 'boolean'}})],
+ self._set_state)])
+```
### Callbacks
+
+```python
+ async def _get_state(self, message) -> None:
+ await self.bus.send(Message(self.name, {'state': self._state}))
+```
+
+```python
+ async def _set_state(self, message) -> None:
+```
+
+### Haupt-Routine des Plugins
+
+```python
+ async def run(self) -> None:
+ """Do nothing."""
+ pass
+```
+
+### Beispiel-Konfiguration und Test
+
+```json
+{
+ "Debug": {
+ "plugin": "WSServer",
+ "web": {
+ "/": {
+ "module": "controlpi_plugins.wsserver",
+ "location": "Debug"
+ }
+ }
+ },
+ "Log": {
+ "plugin": "Log",
+ "filter": [{}]
+ },
+ "Light": {
+ "plugin": "State"
+ },
+ "Light-Overshoot": {
+ "plugin": "Overshoot"
+ }
+}
+```
+
+### Style- und Typ-Checks