gar changed to new devdi concept

This commit is contained in:
Dirk Alders 2025-08-26 21:12:45 +02:00
parent 820fb707c9
commit 158c41ef0e
5 changed files with 16 additions and 51 deletions

2
devdi

@ -1 +1 @@
Subproject commit 31c00259ded5a8a1204b73b48010b7766989e615 Subproject commit f13cdfdcb7dcc543d3a882351bd817fa2da5fe01

View File

@ -48,6 +48,7 @@ from function.videv import videv_switch_brightness as videv_sw_br
from function.videv import videv_switch_brightness_color_temp as videv_sw_br_ct from function.videv import videv_switch_brightness_color_temp as videv_sw_br_ct
from function.videv import videv_switching_timer as videv_sw_tm from function.videv import videv_switching_timer as videv_sw_tm
from function.videv import videv_heating as videv_hea from function.videv import videv_heating as videv_hea
from function.videv import videv_pure_switch
from function.videv import videv_multistate from function.videv import videv_multistate
try: try:

View File

@ -30,7 +30,7 @@ class all_functions(room_collection):
# Rooms # Rooms
# #
# garden # garden
self.gar = garden(self.mqtt_client, pd) self.gar = garden(self.mqtt_client)
# stairway # stairway
self.stw = stairway(self.mqtt_client, pd) self.stw = stairway(self.mqtt_client, pd)
# ground floor west # ground floor west

View File

@ -2,11 +2,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
import config from devdi import rooms
import devdi.topic as props
from function.helpers import day_event from function.helpers import day_event
from function.rooms import room, room_collection from function.rooms import room, room_collection
from function.videv import videv_switching, videv_pure_switch
import logging import logging
try: try:
@ -15,56 +13,28 @@ except ImportError:
ROOT_LOGGER_NAME = 'root' ROOT_LOGGER_NAME = 'root'
logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__) logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
loc = props.LOC_GAR
class garden(room_collection): class garden(room_collection):
def __init__(self, mqtt_client, pd): def __init__(self, mqtt_client):
super().__init__(mqtt_client) super().__init__(mqtt_client)
self.garden = garden_garden(mqtt_client, pd) self.garden = garden_garden(mqtt_client)
class garden_garden(room): class garden_garden(rooms.gar_garden, room):
def __init__(self, mqtt_client, pd): def __init__(self, mqtt_client):
roo = props.ROO_GAR super().__init__(mqtt_client)
# room.__init__(self, mqtt_client)
# Device initialisation
# #
self.day_events = day_event((6, 0), (22, 0), 30, -30) self.day_events = day_event((6, 0), (22, 0), 30, -30)
# garden powerplugs
self.garland_powerplug = pd.get(props.STG_ZGW, loc, roo, props.FUN_GAR)
# repeater
self.repeater = pd.get(props.STG_ZGW, loc, roo, props.FUN_REP)
super().__init__(mqtt_client)
#
# Functionality initialisation
#
self.day_events.add_callback(None, True, self.__day_events__, True) self.day_events.add_callback(None, True, self.__day_events__, True)
# # xxx <-> videv
# Virtual Device Interface self.videv_garland_light.connect_sw_device(self.switch_garland_light, self.switch_garland_light.KEY_OUTPUT_0)
# self.videv_repeater.connect_sw_device(self.switch_repeater, self.switch_repeater.KEY_OUTPUT_0)
# mode
self.mode_videv = videv_pure_switch(
mqtt_client, config.TOPIC_GAR_GARDEN_MODE_VIDEV
)
# garland
self.garland_videv = videv_switching(
mqtt_client, config.TOPIC_GAR_GARDEN_GARLAND_VIDEV,
self.garland_powerplug, self.garland_powerplug.KEY_OUTPUT_0
)
# repeater
self.repeater_videv = videv_switching(
mqtt_client, config.TOPIC_GAR_GARDEN_REPEATER_VIDEV,
self.repeater, self.repeater.KEY_OUTPUT_0
)
def __day_events__(self, device, key, data): def __day_events__(self, device, key, data):
if self.mode_videv.get(self.mode_videv.KEY_STATE): if self.videv_mode.get(self.videv_mode.KEY_STATE):
if key in (self.day_events.KEY_SUNSET, self.day_events.KEY_START_OF_DAY): if key in (self.day_events.KEY_SUNSET, self.day_events.KEY_START_OF_DAY):
self.garland_powerplug.set_output_0(True) self.switch_garland_light.set_output_0(True)
elif key in (self.day_events.KEY_START_OF_NIGHT, self.day_events.KEY_SUNRISE): elif key in (self.day_events.KEY_START_OF_NIGHT, self.day_events.KEY_SUNRISE):
self.garland_powerplug.set_output_0(False) self.switch_garland_light.set_output_0(False)

View File

@ -12,12 +12,6 @@ Targets:
from base import videv_base from base import videv_base
from function.rooms import room, room_collection from function.rooms import room, room_collection
import time
try:
from config import APP_NAME as ROOT_LOGGER_NAME
except ImportError:
ROOT_LOGGER_NAME = 'root'
class videv_pure_switch(videv_base): class videv_pure_switch(videv_base):