platypush/platypush/plugins/light/__init__.py

42 lines
855 B
Python
Raw Normal View History

from abc import ABC, abstractmethod
2017-11-03 20:08:17 +01:00
from platypush.entities import manages
from platypush.entities.lights import Light
from platypush.plugins import Plugin, action
@manages(Light)
class LightPlugin(Plugin, ABC):
2018-06-25 00:49:45 +02:00
"""
Abstract plugin to interface your logic with lights/bulbs.
"""
@action
@abstractmethod
2017-11-03 20:08:17 +01:00
def on(self):
"""Turn the light on"""
2017-11-03 20:08:17 +01:00
raise NotImplementedError()
@action
@abstractmethod
2017-11-03 20:08:17 +01:00
def off(self):
"""Turn the light off"""
2017-11-03 20:08:17 +01:00
raise NotImplementedError()
@action
@abstractmethod
2017-11-03 20:08:17 +01:00
def toggle(self):
"""Toggle the light status (on/off)"""
raise NotImplementedError()
@action
@abstractmethod
def status(self):
"""
Get the current status of the lights.
"""
2017-11-03 20:08:17 +01:00
raise NotImplementedError()
# vim:sw=4:ts=4:et: