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