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_switching_timer as videv_sw_tm
from function.videv import videv_heating as videv_hea
from function.videv import videv_pure_switch
from function.videv import videv_multistate
try:

View File

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

View File

@ -2,11 +2,9 @@
# -*- coding: utf-8 -*-
#
import config
import devdi.topic as props
from devdi import rooms
from function.helpers import day_event
from function.rooms import room, room_collection
from function.videv import videv_switching, videv_pure_switch
import logging
try:
@ -15,56 +13,28 @@ 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):
def __init__(self, mqtt_client):
super().__init__(mqtt_client)
self.garden = garden_garden(mqtt_client, pd)
self.garden = garden_garden(mqtt_client)
class garden_garden(room):
def __init__(self, mqtt_client, pd):
roo = props.ROO_GAR
#
# Device initialisation
class garden_garden(rooms.gar_garden, room):
def __init__(self, mqtt_client):
super().__init__(mqtt_client)
room.__init__(self, mqtt_client)
#
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)
#
# Virtual Device Interface
#
# 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
)
# xxx <-> videv
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)
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):
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):
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 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):