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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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, room_collection
  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_collection):
  16. def __init__(self, mqtt_client):
  17. super().__init__(mqtt_client)
  18. self.stairway = stairway_stairway(mqtt_client)
  19. class stairway_stairway(room):
  20. def __init__(self, mqtt_client):
  21. #
  22. # Device initialisation
  23. #
  24. # http://shelly1-3494546A9364
  25. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_SHELLY)
  26. self.motion_sensor_gf = devices.silvercrest_motion_sensor(mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_MOTION_SENSOR_GF)
  27. self.motion_sensor_ff = devices.silvercrest_motion_sensor(mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_MOTION_SENSOR_FF)
  28. super().__init__(mqtt_client)
  29. #
  30. # Functionality initialisation
  31. #
  32. self.motion_sensor_light = motion_sensor_light(
  33. self.main_light_shelly, self.main_light_shelly.set_output_0,
  34. self.motion_sensor_gf, self.motion_sensor_ff,
  35. timer_value=config.USER_ON_TIME_STAIRWAYS
  36. )
  37. #
  38. # Virtual Device Interface
  39. #
  40. self.main_light_videv = videv_switching_motion(
  41. mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_VIDEV,
  42. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  43. self.motion_sensor_light
  44. )