craftbeerpi4-pione/core/api/actor.py

48 lines
800 B
Python
Raw Normal View History

2018-12-13 21:45:33 +01:00
from abc import ABCMeta
2018-11-16 20:35:59 +01:00
__all__ = ["CBPiActor"]
2018-11-01 19:50:04 +01:00
2018-11-01 21:25:42 +01:00
import logging
2018-11-01 19:50:04 +01:00
2018-11-01 21:25:42 +01:00
from core.api.extension import CBPiExtension
2018-11-18 15:40:10 +01:00
2018-11-01 21:25:42 +01:00
logger = logging.getLogger(__file__)
2018-11-01 19:50:04 +01:00
2018-12-13 21:45:33 +01:00
class CBPiActor(CBPiExtension, metaclass=ABCMeta):
def init(self):
pass
def stop(self):
pass
2018-11-01 21:25:42 +01:00
2018-11-01 19:50:04 +01:00
def on(self, power):
2018-12-08 14:21:00 +01:00
'''
Code to switch the actor on. Power is provided as integer value
:param power: power value between 0 and 100
:return: None
'''
2018-11-01 19:50:04 +01:00
pass
def off(self):
2018-12-08 14:21:00 +01:00
'''
Code to switch the actor off
:return: None
'''
2018-11-01 19:50:04 +01:00
pass
def state(self):
2018-12-08 14:21:00 +01:00
'''
Return the current actor state
:return:
'''
2018-12-13 21:45:33 +01:00
pass
def reprJSON(self):
return dict(state=True)