25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.0KB

  1. # -*- coding: utf-8 -*-
  2. from modules.core.basetypes import Actor, Sensor
  3. from modules.core.core import cbpi
  4. from modules.core.proptypes import Property
  5. import random
  6. print "INit SENSOR"
  7. @cbpi.addon.sensor.type("Dummy Sensor")
  8. class Dummy(Sensor):
  9. text = Property.Text(label="Text", required=True, description="This is a parameter", configurable=True)
  10. p = Property.Select(label="hallo",options=[1,2,3])
  11. def init(self):
  12. if self.api.get_config_parameter("unit","C") == "C":
  13. self.unit = "°C"
  14. else:
  15. self.unit = "°F"
  16. @cbpi.addon.sensor.action("WOHOO")
  17. def myaction(self):
  18. print self.text
  19. print "SENSOR ACTION HALLO!!!"
  20. def execute(self):
  21. while True:
  22. try:
  23. self.update_value(int(self.text))
  24. except:
  25. pass
  26. self.api.sleep(1)
  27. @cbpi.addon.core.action(key="clear", label="Clear all Logs")
  28. def woohoo(cbpi):
  29. print "COOL"
  30. cbpi.notify(headline="HELLO WORLD",message="")