actor methods added

This commit is contained in:
Manuel Fritsch 2021-02-06 00:41:50 +01:00
parent 4fe47d5a31
commit fbccd11c9e

View file

@ -1,6 +1,7 @@
from abc import ABCMeta
import asyncio
from cbpi.api.extension import CBPiExtension
from cbpi.api.config import ConfigType
__all__ = ["CBPiActor"]
@ -40,6 +41,18 @@ class CBPiActor(metaclass=ABCMeta):
async def stop(self):
self.running = False
def get_static_config_value(self,name,default):
return self.cbpi.static_config.get(name, default)
def get_config_value(self,name,default):
return self.cbpi.config.get(name, default=default)
async def set_config_value(self,name,value):
return await self.cbpi.config.set(name,value)
async def add_config_value(self, name, value, type: ConfigType, description, options=None):
await self.cbpi.add(name, value, type, description, options=None)
async def on(self, power):
'''
Code to switch the actor on. Power is provided as integer value