platypush/platypush/plugins/switch/__init__.py
Fabio Manganiello 66d78c8615 [#61] Plugins actions refactoring
- Using `@action` annotation to indicate methods that are allowed to be
executed as actions

- The output and errors of an action are automatically wrapped into a
`Response` object without any response build required on the plugin side
2018-07-06 02:08:38 +02:00

33 lines
705 B
Python

from platypush.plugins import Plugin, action
class SwitchPlugin(Plugin):
"""
Abstract class for interacting with switch devices
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@action
def on(self, args):
""" Turn the device on """
raise NotImplementedError()
@action
def off(self, args):
""" Turn the device off """
raise NotImplementedError()
@action
def toggle(self, args):
""" Toggle the device status (on/off) """
raise NotImplementedError()
@action
def status(self):
""" Get the device state """
raise NotImplementedError()
# vim:sw=4:ts=4:et: