Smarthome Functionen
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

stairway.py 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import config
  5. from devdi import topic as props
  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. loc = props.LOC_STW
  16. class stairway(room_collection):
  17. def __init__(self, mqtt_client, pd, vd):
  18. super().__init__(mqtt_client, pd, vd)
  19. self.stairway = stairway_stairway(mqtt_client, pd, vd)
  20. class stairway_stairway(room):
  21. def __init__(self, mqtt_client, pd, vd):
  22. #
  23. # Device initialisation
  24. #
  25. # http://shelly1-3494546A9364
  26. self.main_light_shelly = pd.get(props.STG_SHE, loc, props.ROO_STF, props.FUN_MAL)
  27. self.motion_sensor_ff = pd.get(props.STG_ZFE, loc, props.ROO_STF, props.FUN_MSE)
  28. self.motion_sensor_gf = pd.get(props.STG_ZGW, loc, props.ROO_STG, props.FUN_MSE)
  29. super().__init__(mqtt_client, pd, vd)
  30. #
  31. # Functionality initialisation
  32. #
  33. self.motion_sensor_light = motion_sensor_light(
  34. self.main_light_shelly, self.main_light_shelly.set_output_0,
  35. self.motion_sensor_gf, self.motion_sensor_ff,
  36. timer_value=config.USER_ON_TIME_STAIRWAYS
  37. )
  38. #
  39. # Virtual Device Interface
  40. #
  41. self.main_light_videv = videv_switching_motion(
  42. mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_VIDEV,
  43. self.main_light_shelly, self.main_light_shelly.KEY_OUTPUT_0,
  44. self.motion_sensor_light
  45. )