You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.0KB

  1. from modules.core.baseapi import Buzzer
  2. from modules.core.basetypes import Actor, KettleController, FermenterController
  3. from modules.core.core import cbpi
  4. @cbpi.addon.actor.type("Dummy Actor")
  5. class Dummy(Actor):
  6. @cbpi.addon.actor.action("WOHOO")
  7. def myaction(self):
  8. print "HALLO!!!"
  9. def on(self, power=100):
  10. '''
  11. Code to switch on the actor
  12. :param power: int value between 0 - 100
  13. :return:
  14. '''
  15. print "ON"
  16. def off(self):
  17. print "OFF"
  18. @cbpi.addon.kettle.controller()
  19. class MyController(KettleController):
  20. def run(self):
  21. while self.is_running():
  22. print "HALLO"
  23. self.sleep(1)
  24. @cbpi.addon.fermenter.controller()
  25. class MyController2(FermenterController):
  26. def run(self):
  27. while self.is_running():
  28. print "HALLO"
  29. self.sleep(1)
  30. @cbpi.addon.core.initializer(order=200)
  31. def init(cbpi):
  32. class MyBuzzer(Buzzer):
  33. def beep(self):
  34. print "BEEEEEEP"
  35. cbpi.buzzer = MyBuzzer()