Smarthome Functionen
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.

first_floor_dining.py 836B

123456789101112131415161718192021222324
  1. import devices
  2. import logging
  3. try:
  4. from config import APP_NAME as ROOT_LOGGER_NAME
  5. except ImportError:
  6. ROOT_LOGGER_NAME = 'root'
  7. logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
  8. class room_function(object):
  9. def __init__(self, device_collection):
  10. self.main_light_shelly = device_collection.shellies.dinigroom
  11. self.floorlamp_powerplug = device_collection.powerplugs.dining_floorlamp
  12. #
  13. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.main_light_shelly_callback)
  14. #
  15. self.main_light_shelly_last = None
  16. def main_light_shelly_callback(self, device, key, data):
  17. if data != self.main_light_shelly_last:
  18. logger.info("Test")
  19. self.floorlamp_powerplug.set_output_0(data)
  20. self.main_light_shelly_last