Smarthome Functionen
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

garden.py 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import config
  5. import devdi.topic as props
  6. from devices import group
  7. from function.db import get_radiator_data, set_radiator_data
  8. from function.helpers import day_event
  9. from function.modules import brightness_choose_n_action, timer_on_activation, heating_function
  10. from function.rooms import room, room_collection
  11. from function.videv import videv_switching, videv_switch_brightness, videv_switching_timer, videv_switch_brightness_color_temp, videv_heating, videv_multistate
  12. import logging
  13. try:
  14. from config import APP_NAME as ROOT_LOGGER_NAME
  15. except ImportError:
  16. ROOT_LOGGER_NAME = 'root'
  17. logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
  18. loc = props.LOC_GAR
  19. class garden(room_collection):
  20. def __init__(self, mqtt_client, pd, vd):
  21. super().__init__(mqtt_client, pd, vd)
  22. self.garden = garden_garden(mqtt_client, pd, vd)
  23. class garden_garden(room):
  24. def __init__(self, mqtt_client, pd, vd):
  25. roo = props.ROO_GAR
  26. #
  27. # Device initialisation
  28. #
  29. self.day_events = day_event((6, 0), (22, 0), 30, -30)
  30. self.garland_powerplug = pd.get(props.STG_ZGW, loc, roo, props.FUN_GAR)
  31. super().__init__(mqtt_client, pd, vd)
  32. #
  33. # Functionality initialisation
  34. #
  35. self.day_events.add_callback(None, True, self.__day_events__, True)
  36. #
  37. # Virtual Device Interface
  38. #
  39. # garland
  40. self.garland_videv = videv_switching(
  41. mqtt_client, config.TOPIC_GAR_GARDEN_GARLAND_VIDEV,
  42. self.garland_powerplug, self.garland_powerplug.KEY_OUTPUT_0
  43. )
  44. def __day_events__(self, device, key, data):
  45. if key in (self.day_events.KEY_SUNSET, self.day_events.KEY_START_OF_DAY):
  46. self.garland_powerplug.set_output_0(True)
  47. elif key in (self.day_events.KEY_START_OF_NIGHT, self.day_events.KEY_SUNRISE):
  48. self.garland_powerplug.set_output_0(False)