Smarthome Functionen
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import config
  5. import devices
  6. import logging
  7. from function.modules import motion_sensor_light
  8. from function.rooms import room
  9. from function.videv import videv_switching_motion
  10. try:
  11. from config import APP_NAME as ROOT_LOGGER_NAME
  12. except ImportError:
  13. ROOT_LOGGER_NAME = 'root'
  14. logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
  15. class stairway(room):
  16. def __init__(self, mqtt_client):
  17. #
  18. # Device initialisation
  19. #
  20. # http://shelly1-3494546A9364
  21. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_SHELLY)
  22. self.motion_sensor_gf = devices.silvercrest_motion_sensor(mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_MOTION_SENSOR_GF)
  23. self.motion_sensor_ff = devices.silvercrest_motion_sensor(mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_MOTION_SENSOR_FF)
  24. super().__init__(mqtt_client)
  25. #
  26. # Functionality initialisation
  27. #
  28. self.motion_sensor_light = motion_sensor_light(
  29. self.main_light_shelly, self.main_light_shelly.set_output_0,
  30. self.motion_sensor_gf, self.motion_sensor_ff,
  31. timer_value=config.USER_ON_TIME_STAIRWAYS
  32. )
  33. #
  34. # Virtual Device Interface
  35. #
  36. self.main_light_videv = videv_switching_motion(
  37. mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_VIDEV,
  38. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  39. self.motion_sensor_light
  40. )