Created Custom Actor (markdown)

Manuel83
2017-06-18 23:05:06 +02:00
parent 3a20ae84b5
commit 99a0b6dba1
+38
@@ -0,0 +1,38 @@
Custom Actor Example
```
from modules import cbpi
from modules.core.props import Property
from modules.core.hardware import ActorBase
@cbpi.actor
class SampleActor(ActorBase):
#custom property
prop1 = Property.Text("Property1", True, "1")
def on(self, power=0):
'''
Code to switch on the actor
:param power: int value between 0 - 100
:return:
'''
print "SWITCH ON %s" % (self.prop1)
def off(self):
'''
Code to switch off the actor
:return:
'''
print "SWITCH OFF"
def set_power(self, power):
'''
Optional: Set the power of your actor
:param power: int value between 0 - 100
:return:
'''
pass
```