Pārlūkot izejas kodu

garden added

tags/v1.3.0
Dirk Alders 1 gadu atpakaļ
vecāks
revīzija
814e0ee1b2
5 mainītis faili ar 65 papildinājumiem un 3 dzēšanām
  1. 1
    1
      devdi
  2. 3
    0
      function/__init__.py
  3. 1
    1
      function/first_floor_east.py
  4. 59
    0
      function/garden.py
  5. 1
    1
      function/helpers.py

+ 1
- 1
devdi

@@ -1 +1 @@
1
-Subproject commit 773d0a6679810b365bbd4537156c513b0f496c5a
1
+Subproject commit 7e4f92aaf1cd1dd2626e2b3337277eddfc37578e

+ 3
- 0
function/__init__.py Parādīt failu

@@ -3,6 +3,7 @@
3 3
 #
4 4
 import config
5 5
 import devices
6
+from function.garden import garden
6 7
 from function.stairway import stairway
7 8
 from function.ground_floor_west import ground_floor_west
8 9
 from function.first_floor_west import first_floor_west
@@ -24,6 +25,8 @@ class all_functions(room_collection):
24 25
         #
25 26
         # Rooms
26 27
         #
28
+        # garden
29
+        self.gar = garden(self.mqtt_client, pd, vd)
27 30
         # stairway
28 31
         self.stw = stairway(self.mqtt_client, pd, vd)
29 32
         # ground floor west

+ 1
- 1
function/first_floor_east.py Parādīt failu

@@ -61,7 +61,7 @@ class first_floor_east_kitchen(room):
61 61
         # http://shelly1l-8CAAB5616C01
62 62
         # main light
63 63
         self.main_light_shelly = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
64
-        # http://shelly1-e89f6d85a466/
64
+        # http://shelly1-e89f6d85a466
65 65
         # circulation pump
66 66
         self.circulation_pump_shelly = pd.get(props.STG_SHE, loc, roo, props.FUN_CIR)
67 67
         # heating function

+ 59
- 0
function/garden.py Parādīt failu

@@ -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)

+ 1
- 1
function/helpers.py Parādīt failu

@@ -99,7 +99,7 @@ class day_event(day_state):
99 99
     :type time_start_of_day: int
100 100
     """
101 101
 
102
-    def __init__(self, time_start_of_day=(6, 0), time_start_of_night=(22, 0), time_offset_sunrise=30, time_offset_sunset=-30):
102
+    def __init__(self, time_start_of_day=(5, 0), time_start_of_night=(22, 0), time_offset_sunrise=30, time_offset_sunset=-30):
103 103
         super().__init__(time_start_of_day, time_start_of_night, time_offset_sunrise, time_offset_sunset)
104 104
         #
105 105
         current_day_state = self.get_state()

Notiek ielāde…
Atcelt
Saglabāt