2021-09-16 17:53:40 +02:00
|
|
|
from abc import ABC, abstractmethod
|
2017-11-03 20:08:17 +01:00
|
|
|
|
2021-02-19 02:54:12 +01:00
|
|
|
from platypush.plugins import action
|
|
|
|
from platypush.plugins.switch import SwitchPlugin
|
2020-10-28 23:19:16 +01:00
|
|
|
|
2021-02-19 02:54:12 +01:00
|
|
|
|
|
|
|
class LightPlugin(SwitchPlugin, ABC):
|
2018-06-25 00:49:45 +02:00
|
|
|
"""
|
|
|
|
Abstract plugin to interface your logic with lights/bulbs.
|
|
|
|
"""
|
|
|
|
|
2018-07-06 02:08:38 +02:00
|
|
|
@action
|
2021-09-16 17:53:40 +02:00
|
|
|
@abstractmethod
|
2017-11-03 20:08:17 +01:00
|
|
|
def on(self):
|
2018-06-25 00:49:45 +02:00
|
|
|
""" Turn the light on """
|
2017-11-03 20:08:17 +01:00
|
|
|
raise NotImplementedError()
|
|
|
|
|
2018-07-06 02:08:38 +02:00
|
|
|
@action
|
2021-09-16 17:53:40 +02:00
|
|
|
@abstractmethod
|
2017-11-03 20:08:17 +01:00
|
|
|
def off(self):
|
2018-06-25 00:49:45 +02:00
|
|
|
""" Turn the light off """
|
2017-11-03 20:08:17 +01:00
|
|
|
raise NotImplementedError()
|
|
|
|
|
2018-07-06 02:08:38 +02:00
|
|
|
@action
|
2021-09-16 17:53:40 +02:00
|
|
|
@abstractmethod
|
2017-11-03 20:08:17 +01:00
|
|
|
def toggle(self):
|
2018-06-25 00:49:45 +02:00
|
|
|
""" Toggle the light status (on/off) """
|
2017-11-03 20:08:17 +01:00
|
|
|
raise NotImplementedError()
|
|
|
|
|
|
|
|
|
|
|
|
# vim:sw=4:ts=4:et:
|