garden added

This commit is contained in:
Dirk Alders 2023-12-23 07:38:14 +01:00
parent e565dd717b
commit 814e0ee1b2
5 changed files with 65 additions and 3 deletions

2
devdi

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

View File

@ -3,6 +3,7 @@
#
import config
import devices
from function.garden import garden
from function.stairway import stairway
from function.ground_floor_west import ground_floor_west
from function.first_floor_west import first_floor_west
@ -24,6 +25,8 @@ class all_functions(room_collection):
#
# Rooms
#
# garden
self.gar = garden(self.mqtt_client, pd, vd)
# stairway
self.stw = stairway(self.mqtt_client, pd, vd)
# ground floor west

View File

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

59
function/garden.py Normal file
View File

@ -0,0 +1,59 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import config
import devdi.props as props
from devices import group
from function.db import get_radiator_data, set_radiator_data
from function.helpers import day_event
from function.modules import brightness_choose_n_action, timer_on_activation, heating_function
from function.rooms import room, room_collection
from function.videv import videv_switching, videv_switch_brightness, videv_switching_timer, videv_switch_brightness_color_temp, videv_heating, videv_multistate
import logging
try:
from config import APP_NAME as ROOT_LOGGER_NAME
except ImportError:
ROOT_LOGGER_NAME = 'root'
logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
loc = props.LOC_GAR
class garden(room_collection):
def __init__(self, mqtt_client, pd, vd):
super().__init__(mqtt_client, pd, vd)
self.garden = garden_garden(mqtt_client, pd, vd)
class garden_garden(room):
def __init__(self, mqtt_client, pd, vd):
roo = props.ROO_GAR
#
# Device initialisation
#
self.day_events = day_event((6, 0), (22, 0), 30, -30)
self.garland_powerplug = pd.get(props.STG_ZGW, loc, roo, props.FUN_GAR)
super().__init__(mqtt_client, pd, vd)
#
# Functionality initialisation
#
self.day_events.add_callback(None, True, self.__day_events__, True)
#
# Virtual Device Interface
#
# garland
self.garland_videv = videv_switching(
mqtt_client, config.TOPIC_GAR_GARDEN_GARLAND_VIDEV,
self.garland_powerplug, self.garland_powerplug.KEY_OUTPUT_0
)
def __day_events__(self, device, key, data):
if key in (self.day_events.KEY_SUNSET, self.day_events.KEY_START_OF_DAY):
self.garland_powerplug.set_output_0(True)
elif key in (self.day_events.KEY_START_OF_NIGHT, self.day_events.KEY_SUNRISE):
self.garland_powerplug.set_output_0(False)

View File

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