Reworked devdi to support rooms, which supports command extention in the editor

This commit is contained in:
Dirk Alders 2025-08-25 18:48:52 +02:00
parent 3c554ee090
commit d7eceb30ce
7 changed files with 282 additions and 749 deletions

2
devdi

@ -1 +1 @@
Subproject commit c11d2e53fd326eb37ba4e4c53a890ff8f1a9a917 Subproject commit 4fa00811c6d243888828e67b0952b5b06f46a3d7

View File

@ -1,43 +1,62 @@
from simulation.devices import tradfri_light import logging
from simulation.devices import tradfri_light # indirect by classes tradfri_..., livarno_...
from simulation.devices import silvercrest_powerplug from simulation.devices import silvercrest_powerplug
from simulation.devices import shelly as shelly_sw1 from simulation.devices import shelly as shelly_sw1
from simulation.devices import brennenstuhl_heatingvalve from simulation.devices import brennenstuhl_heatingvalve
from simulation.devices import my_powerplug from simulation.devices import my_powerplug
from simulation.devices import videv_heating as videv_hea
from simulation.devices import videv_light # indirect by classes videv_
shelly_pro3 = None try:
tradfri_button = None from config import APP_NAME as ROOT_LOGGER_NAME
silvercrest_button = None except ImportError:
silvercrest_motion_sensor = None ROOT_LOGGER_NAME = 'root'
audio_status = None logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
remote = None
my_ambient = None
class tradfri_sw(tradfri_light): # TODO: Not yet implemented devices ###################################
def __init__(self, mqtt_client, topic): def hue_sw_br_ct(mqtt_client, topic):
super().__init__(mqtt_client, topic, enable_state=True, enable_brightness=False, enable_color_temp=False, send_on_power_on=True) logger.warning("Device type hue_sw_br_ct is not yet implemented. Topic %s will not be supported", topic)
return None
class tradfri_sw_br(tradfri_light): def shelly_pro3(mqtt_client, topic):
def __init__(self, mqtt_client, topic): logger.warning("Device type shelly_pro3 is not yet implemented. Topic %s will not be supported", topic)
super().__init__(mqtt_client, topic, enable_state=True, enable_brightness=True, enable_color_temp=False, send_on_power_on=True) return None
class tradfri_sw_br_ct(tradfri_light): def tradfri_button(mqtt_client, topic):
def __init__(self, mqtt_client, topic): logger.warning("Device type tradfri_button is not yet implemented. Topic %s will not be supported", topic)
super().__init__(mqtt_client, topic, enable_state=True, enable_brightness=True, enable_color_temp=True, send_on_power_on=True) return None
class hue_sw_br_ct(tradfri_light): def silvercrest_button(mqtt_client, topic):
def __init__(self, mqtt_client, topic): logger.warning("Device type silvercrest_button is not yet implemented. Topic %s will not be supported", topic)
super().__init__(mqtt_client, topic, enable_state=True, enable_brightness=True, enable_color_temp=True, send_on_power_on=True) return None
class livarno_sw_br_ct(tradfri_light): def silvercrest_motion_sensor(mqtt_client, topic):
def __init__(self, mqtt_client, topic): logger.warning("Device type silvercrest_motion_sensor is not yet implemented. Topic %s will not be supported", topic)
super().__init__(mqtt_client, topic, enable_state=True, enable_brightness=True, enable_color_temp=True, send_on_power_on=False) return None
def audio_status(mqtt_client, topic):
logger.warning("Device type audio_status is not yet implemented. Topic %s will not be supported", topic)
return None
def remote(mqtt_client, topic):
logger.warning("Device type remote is not yet implemented. Topic %s will not be supported", topic)
return None
def my_ambient(mqtt_client, topic):
logger.warning("Device type my_ambient is not yet implemented. Topic %s will not be supported", topic)
return None
# TODO: Not yet implemented devices ###################################
class group(object): class group(object):
@ -105,3 +124,38 @@ class group(object):
return getattr(self[0], name) return getattr(self[0], name)
else: else:
return rv return rv
class tradfri_sw(tradfri_light):
def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, enable_state=True, enable_brightness=False, enable_color_temp=False, send_on_power_on=True)
class tradfri_sw_br(tradfri_light):
def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, enable_state=True, enable_brightness=True, enable_color_temp=False, send_on_power_on=True)
class tradfri_sw_br_ct(tradfri_light):
def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, enable_state=True, enable_brightness=True, enable_color_temp=True, send_on_power_on=True)
class livarno_sw_br_ct(tradfri_light):
def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, enable_state=True, enable_brightness=True, enable_color_temp=True, send_on_power_on=False)
class videv_sw(videv_light):
def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, True, False, False)
class videv_sw_br(videv_light):
def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, True, True, False)
class videv_sw_br_ct(videv_light):
def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, True, True, True)

View File

@ -2,7 +2,6 @@ from base import mqtt_base
import colored import colored
import json import json
import task import task
import time
COLOR_GUI_ACTIVE = colored.fg("light_blue") COLOR_GUI_ACTIVE = colored.fg("light_blue")
COLOR_GUI_PASSIVE = COLOR_GUI_ACTIVE + colored.attr("dim") COLOR_GUI_PASSIVE = COLOR_GUI_ACTIVE + colored.attr("dim")
@ -19,14 +18,11 @@ OUTPUT_ACTIVE = False
class base_common(mqtt_base): class base_common(mqtt_base):
AUTOSEND = True AUTOSEND = True
COMMANDS = []
BOOL_KEYS = [] BOOL_KEYS = []
def __init__(self, mqtt_client, topic, default_values=None): def __init__(self, mqtt_client, topic, default_values=None):
super().__init__(mqtt_client, topic, default_values) super().__init__(mqtt_client, topic, default_values)
self.commands = self.COMMANDS[:]
def __payload_filter__(self, payload): def __payload_filter__(self, payload):
try: try:
return json.loads(payload) return json.loads(payload)
@ -63,18 +59,6 @@ class base_common(mqtt_base):
rv += u"\u25ac" if (percent_value - 5) > 10*i else u"\u25ad" rv += u"\u25ac" if (percent_value - 5) > 10*i else u"\u25ad"
return rv return rv
def __command_int_value__(self, value):
try:
return int(value)
except TypeError:
print("You need to give a integer parameter not '%s'" % str(value))
def __command_float_value__(self, value):
try:
return float(value)
except TypeError:
print("You need to give a numeric parameter not '%s'" % str(value))
def print_formatted_light(self, color, state, description, led=False): def print_formatted_light(self, color, state, description, led=False):
if OUTPUT_ACTIVE: if OUTPUT_ACTIVE:
if led is True: if led is True:
@ -150,15 +134,6 @@ class shelly(base):
INPUT_FUNC_OUT1_TRIGGER = "out1_trigger" INPUT_FUNC_OUT1_TRIGGER = "out1_trigger"
INPUT_FUNC_OUT2_FOLLOW = "out2_follow" INPUT_FUNC_OUT2_FOLLOW = "out2_follow"
INPUT_FUNC_OUT2_TRIGGER = "out2_trigger" INPUT_FUNC_OUT2_TRIGGER = "out2_trigger"
#
COMMANDS = [
"get_output_0", "toggle_output_0",
"get_output_1", "toggle_output_1",
"get_input_0", "toggle_input_0",
"get_input_1", "toggle_input_1",
"trigger_input_0_longpress", "trigger_input_1_longpress",
"toggle_overtemperature",
]
def __init__(self, mqtt_client, topic): def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, default_values={self.KEY_OUTPUT_0: False, self.KEY_OUTPUT_1: False, super().__init__(mqtt_client, topic, default_values={self.KEY_OUTPUT_0: False, self.KEY_OUTPUT_1: False,
@ -235,48 +210,6 @@ class shelly(base):
if key == self.KEY_OUTPUT_0: if key == self.KEY_OUTPUT_0:
self.set(key, False) self.set(key, False)
def command(self, command):
if command in self.COMMANDS:
if command == self.COMMANDS[0]:
self.print_formatted(self, self.KEY_OUTPUT_0, self.get(self.KEY_OUTPUT_0))
elif command == self.COMMANDS[1]:
self.set(self.KEY_OUTPUT_0, not self[self.KEY_OUTPUT_0])
elif command == self.COMMANDS[2]:
self.print_formatted(self, self.KEY_OUTPUT_1, self.get(self.KEY_OUTPUT_1))
elif command == self.COMMANDS[3]:
self.set(self.KEY_OUTPUT_1, not self[self.KEY_OUTPUT_1])
elif command == self.COMMANDS[4]:
self.print_formatted(self, self.KEY_INPUT_0, self.get(self.KEY_INPUT_0))
elif command == self.COMMANDS[5]:
self.set(self.KEY_INPUT_0, not self[self.KEY_INPUT_0])
elif command == self.COMMANDS[6]:
self.print_formatted(self, self.KEY_INPUT_1, self.get(self.KEY_INPUT_1))
elif command == self.COMMANDS[7]:
self.set(self.KEY_INPUT_1, not self[self.KEY_INPUT_1])
elif command == self.COMMANDS[8]:
self.set(self.KEY_INPUT_0, not self[self.KEY_INPUT_0])
time.sleep(0.4)
self.set(self.KEY_LONGPUSH_0, True)
time.sleep(0.1)
self.set(self.KEY_INPUT_0, not self[self.KEY_INPUT_0])
self.set(self.KEY_LONGPUSH_0, False)
elif command == self.COMMANDS[9]:
self.set(self.KEY_INPUT_1, not self[self.KEY_INPUT_1])
time.sleep(0.4)
self.set(self.KEY_LONGPUSH_1, True)
time.sleep(0.1)
self.set(self.KEY_INPUT_1, not self[self.KEY_INPUT_1])
self.set(self.KEY_LONGPUSH_1, False)
elif command == self.COMMANDS[10]:
if self.get(self.KEY_OVERTEMPERATURE):
self.warning_state_off()
else:
self.warning_state_on()
else:
print("%s: not yet implemented!" % command)
else:
print("Unknown command!")
def print_formatted(self, device, key, value): def print_formatted(self, device, key, value):
if value is not None: if value is not None:
info = (" - %ds" % self.__output_0_auto_off__) if self.__output_0_auto_off__ is not None and value else "" info = (" - %ds" % self.__output_0_auto_off__) if self.__output_0_auto_off__ is not None and value else ""
@ -301,10 +234,6 @@ class my_powerplug(base):
KEY_OUTPUT_3 = "output/4" KEY_OUTPUT_3 = "output/4"
# #
BOOL_KEYS = [KEY_OUTPUT_0, KEY_OUTPUT_1, KEY_OUTPUT_2, KEY_OUTPUT_3, ] BOOL_KEYS = [KEY_OUTPUT_0, KEY_OUTPUT_1, KEY_OUTPUT_2, KEY_OUTPUT_3, ]
#
COMMANDS = [
"get_output", "toggle_output",
]
def __init__(self, mqtt_client, topic): def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, default_values={self.KEY_OUTPUT_0: False, self.KEY_OUTPUT_1: False, super().__init__(mqtt_client, topic, default_values={self.KEY_OUTPUT_0: False, self.KEY_OUTPUT_1: False,
@ -335,17 +264,6 @@ class my_powerplug(base):
for key in keys_changed: for key in keys_changed:
self.mqtt_client.send(self.topic + "/" + key, json.dumps(self.get(key))) self.mqtt_client.send(self.topic + "/" + key, json.dumps(self.get(key)))
def command(self, command):
if command in self.COMMANDS:
if command == self.COMMANDS[0]:
self.print_formatted(self, self.KEY_OUTPUT_0, self.get(self.KEY_OUTPUT_0))
elif command == self.COMMANDS[1]:
self.set(self.KEY_OUTPUT_0, not self.get(self.KEY_OUTPUT_0))
else:
print("%s: not yet implemented!" % command)
else:
print("Unknown command!")
def print_formatted(self, device, key, value): def print_formatted(self, device, key, value):
if value is not None: if value is not None:
self.print_formatted_light(COLOR_POWERPLUG, value, "(%s)" % self.get_name(key, "State")) self.print_formatted_light(COLOR_POWERPLUG, value, "(%s)" % self.get_name(key, "State"))
@ -357,10 +275,6 @@ class silvercrest_powerplug(base):
KEY_OUTPUT_0 = "state" KEY_OUTPUT_0 = "state"
# #
BOOL_KEYS = [KEY_OUTPUT_0, ] BOOL_KEYS = [KEY_OUTPUT_0, ]
#
COMMANDS = [
"get_output", "toggle_output",
]
def __init__(self, mqtt_client, topic): def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, default_values={self.KEY_OUTPUT_0: False}) super().__init__(mqtt_client, topic, default_values={self.KEY_OUTPUT_0: False})
@ -382,17 +296,6 @@ class silvercrest_powerplug(base):
for key in keys_changed: for key in keys_changed:
self.mqtt_client.send(self.topic, json.dumps(data)) self.mqtt_client.send(self.topic, json.dumps(data))
def command(self, command):
if command in self.COMMANDS:
if command == self.COMMANDS[0]:
self.print_formatted(self, self.KEY_OUTPUT_0, self.get(self.KEY_OUTPUT_0))
elif command == self.COMMANDS[1]:
self.set(self.KEY_OUTPUT_0, not self.get(self.KEY_OUTPUT_0))
else:
print("%s: not yet implemented!" % command)
else:
print("Unknown command!")
def print_formatted(self, device, key, value): def print_formatted(self, device, key, value):
if value is not None: if value is not None:
self.print_formatted_light(COLOR_POWERPLUG, value, "(%s)" % self.get_name(key, key)) self.print_formatted_light(COLOR_POWERPLUG, value, "(%s)" % self.get_name(key, key))
@ -406,10 +309,6 @@ class tradfri_light(base):
KEY_COLOR_TEMP = "color_temp" KEY_COLOR_TEMP = "color_temp"
# #
BOOL_KEYS = [KEY_OUTPUT_0, ] BOOL_KEYS = [KEY_OUTPUT_0, ]
#
STATE_COMMANDS = ("get_state", "toggle_state", )
BRIGHTNESS_COMMANDS = ("get_brightness", "set_brightness",)
COLOR_TEMP_COMMANDS = ("get_color_temp", "set_color_temp",)
def __init__(self, mqtt_client, topic, enable_state=True, enable_brightness=False, enable_color_temp=False, send_on_power_on=True): def __init__(self, mqtt_client, topic, enable_state=True, enable_brightness=False, enable_color_temp=False, send_on_power_on=True):
default_values = {} default_values = {}
@ -423,13 +322,6 @@ class tradfri_light(base):
# #
self.send_on_power_on = send_on_power_on self.send_on_power_on = send_on_power_on
# #
if enable_state:
self.commands.extend(self.STATE_COMMANDS)
if enable_brightness:
self.commands.extend(self.BRIGHTNESS_COMMANDS)
if enable_color_temp:
self.commands.extend(self.COLOR_TEMP_COMMANDS)
#
self.add_callback(self.KEY_OUTPUT_0, None, self.print_formatted, True) self.add_callback(self.KEY_OUTPUT_0, None, self.print_formatted, True)
self.add_callback(self.KEY_BRIGHTNESS, None, self.print_formatted, True) self.add_callback(self.KEY_BRIGHTNESS, None, self.print_formatted, True)
self.add_callback(self.KEY_COLOR_TEMP, None, self.print_formatted, True) self.add_callback(self.KEY_COLOR_TEMP, None, self.print_formatted, True)
@ -470,29 +362,6 @@ class tradfri_light(base):
tx_data[key] = self.__int_to_ext__(key, self[key]) tx_data[key] = self.__int_to_ext__(key, self[key])
self.mqtt_client.send(self.topic, json.dumps(tx_data)) self.mqtt_client.send(self.topic, json.dumps(tx_data))
def command(self, command):
try:
command, value = command.split(' ')
except ValueError:
value = None
if command in self.capabilities():
if command == self.STATE_COMMANDS[0]:
self.print_formatted(self, self.KEY_OUTPUT_0, self.get(self.KEY_OUTPUT_0))
elif command == self.STATE_COMMANDS[1]:
self.set(self.KEY_OUTPUT_0, not self.get(self.KEY_OUTPUT_0))
elif command == self.BRIGHTNESS_COMMANDS[0]:
self.print_formatted(self, self.KEY_BRIGHTNESS, self.get(self.KEY_BRIGHTNESS))
elif command == self.BRIGHTNESS_COMMANDS[1]:
self.set(self.KEY_BRIGHTNESS, self.__command_int_value__(value))
elif command == self.COLOR_TEMP_COMMANDS[0]:
self.print_formatted(self, self.KEY_COLOR_TEMP, self.get(self.KEY_COLOR_TEMP))
elif command == self.COLOR_TEMP_COMMANDS[1]:
self.set(self.KEY_COLOR_TEMP, self.__command_int_value__(value))
else:
print("%s: not yet implemented!" % command)
else:
print("Unknown command!")
def power_off(self, device, key, value): def power_off(self, device, key, value):
self.set(self.KEY_OUTPUT_0, False, block_callback=(self.__send__, )) self.set(self.KEY_OUTPUT_0, False, block_callback=(self.__send__, ))
@ -526,10 +395,6 @@ class brennenstuhl_heatingvalve(base):
KEY_TEMPERATURE_SETPOINT = "current_heating_setpoint" KEY_TEMPERATURE_SETPOINT = "current_heating_setpoint"
KEY_TEMPERATURE = "local_temperature" KEY_TEMPERATURE = "local_temperature"
KEY_BATTERY = "battery" KEY_BATTERY = "battery"
#
COMMANDS = [
"get_temperature_setpoint", "set_temperature_setpoint", "set_local_temperature", "set_battery",
]
def __init__(self, mqtt_client, topic): def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, default_values={ super().__init__(mqtt_client, topic, default_values={
@ -562,21 +427,6 @@ class brennenstuhl_heatingvalve(base):
tx_data[key] = self.__int_to_ext__(key, self[key]) tx_data[key] = self.__int_to_ext__(key, self[key])
self.mqtt_client.send(self.topic, json.dumps(tx_data)) self.mqtt_client.send(self.topic, json.dumps(tx_data))
def command(self, command):
try:
command, value = command.split(' ')
except ValueError:
value = None
if command in self.COMMANDS:
if command == self.COMMANDS[0]:
self.print_formatted(self, self.KEY_TEMPERATURE_SETPOINT, self.get(self.KEY_TEMPERATURE_SETPOINT))
elif command == self.COMMANDS[1]:
self.set(self.KEY_TEMPERATURE_SETPOINT, self.__command_float_value__(value))
elif command == self.COMMANDS[2]:
self.set(self.KEY_TEMPERATURE, self.__command_float_value__(value))
elif command == self.COMMANDS[3]:
self.set(self.KEY_BATTERY, self.__command_float_value__(value))
def print_formatted(self, device, key, value): def print_formatted(self, device, key, value):
if key == self.KEY_TEMPERATURE_SETPOINT: if key == self.KEY_TEMPERATURE_SETPOINT:
perc = 100 * (value - self.TEMP_RANGE[0]) / (self.TEMP_RANGE[1] - self.TEMP_RANGE[0]) perc = 100 * (value - self.TEMP_RANGE[0]) / (self.TEMP_RANGE[1] - self.TEMP_RANGE[0])
@ -592,7 +442,7 @@ class brennenstuhl_heatingvalve(base):
class videv_light(base_videv): class videv_light(base_videv):
DEVICENAME = "ViDevLight" DEVICENAME = "ViDevCommon"
# #
KEY_OUTPUT_0 = "state" KEY_OUTPUT_0 = "state"
KEY_BRIGHTNESS = "brightness" KEY_BRIGHTNESS = "brightness"
@ -600,11 +450,6 @@ class videv_light(base_videv):
KEY_TIMER = "timer" KEY_TIMER = "timer"
# #
RX_KEYS = [KEY_OUTPUT_0, KEY_BRIGHTNESS, KEY_COLOR_TEMP, KEY_TIMER] RX_KEYS = [KEY_OUTPUT_0, KEY_BRIGHTNESS, KEY_COLOR_TEMP, KEY_TIMER]
#
STATE_COMMANDS = ("get_state", "toggle_state", )
BRIGHTNESS_COMMANDS = ("get_brightness", "set_brightness", )
COLOR_TEMP_COMMANDS = ("get_color_temp", "set_color_temp", )
TIMER_COMMANDS = ("get_timer", )
def __init__(self, mqtt_client, topic, enable_state=True, enable_brightness=False, enable_color_temp=False, enable_timer=False): def __init__(self, mqtt_client, topic, enable_state=True, enable_brightness=False, enable_color_temp=False, enable_timer=False):
default_values = {} default_values = {}
@ -623,15 +468,6 @@ class videv_light(base_videv):
self.enable_color_temp = enable_color_temp self.enable_color_temp = enable_color_temp
self.enable_timer = enable_timer self.enable_timer = enable_timer
# #
if enable_state:
self.commands.extend(self.STATE_COMMANDS)
if enable_brightness:
self.commands.extend(self.BRIGHTNESS_COMMANDS)
if enable_color_temp:
self.commands.extend(self.COLOR_TEMP_COMMANDS)
if enable_timer:
self.commands.extend(self.TIMER_COMMANDS)
#
self.timer_maxvalue = None self.timer_maxvalue = None
def __ext_to_int__(self, key, data): def __ext_to_int__(self, key, data):
@ -639,31 +475,6 @@ class videv_light(base_videv):
return int(data) return int(data)
return super().__ext_to_int__(key, data) return super().__ext_to_int__(key, data)
def command(self, command):
try:
command, value = command.split(' ')
except ValueError:
value = None
if command in self.capabilities():
if command == self.STATE_COMMANDS[0]:
self.print_formatted(self, self.KEY_OUTPUT_0, self.get(self.KEY_OUTPUT_0))
elif command == self.STATE_COMMANDS[1]:
self.set(self.KEY_OUTPUT_0, not self.get(self.KEY_OUTPUT_0))
elif command == self.BRIGHTNESS_COMMANDS[0]:
self.print_formatted(self, self.KEY_BRIGHTNESS, self.get(self.KEY_BRIGHTNESS))
elif command == self.BRIGHTNESS_COMMANDS[1]:
self.set(self.KEY_BRIGHTNESS, self.__command_int_value__(value))
elif command == self.COLOR_TEMP_COMMANDS[0]:
self.print_formatted(self, self.KEY_COLOR_TEMP, self.get(self.KEY_COLOR_TEMP))
elif command == self.COLOR_TEMP_COMMANDS[1]:
self.set(self.KEY_COLOR_TEMP, self.__command_int_value__(value))
elif command == self.TIMER_COMMANDS[0]:
self.print_formatted(self, self.KEY_TIMER, self.get(self.KEY_TIMER))
else:
print("%s: not yet implemented!" % command)
else:
print("Unknown command!")
def print_formatted(self, device, key, value): def print_formatted(self, device, key, value):
if value is not None: if value is not None:
if key == self.KEY_OUTPUT_0: if key == self.KEY_OUTPUT_0:
@ -709,9 +520,6 @@ class videv_heating(base_videv):
KEY_TEMPERATURE = 'temperature' KEY_TEMPERATURE = 'temperature'
# #
RX_KEYS = [KEY_USER_TEMPERATURE_SETPOINT, KEY_AWAY_MODE, KEY_SUMMER_MODE, KEY_VALVE_TEMPERATURE_SETPOINT, KEY_BOOST_TIMER] RX_KEYS = [KEY_USER_TEMPERATURE_SETPOINT, KEY_AWAY_MODE, KEY_SUMMER_MODE, KEY_VALVE_TEMPERATURE_SETPOINT, KEY_BOOST_TIMER]
#
COMMANDS = ["get_temperature_setpoint", "set_temperature_setpoint", "toggle_away_mode",
"toggle_summer_mode", "trigger_default_temperature", "trigger_boost"]
def __init__(self, mqtt_client, topic): def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, default_values={ super().__init__(mqtt_client, topic, default_values={
@ -730,29 +538,6 @@ class videv_heating(base_videv):
# #
self.timer_maxvalue = None self.timer_maxvalue = None
def command(self, command):
try:
command, value = command.split(' ')
except ValueError:
value = None
if command in self.capabilities():
if command == self.commands[0]:
self.print_formatted(self, self.KEY_USER_TEMPERATURE_SETPOINT, self.get(self.KEY_USER_TEMPERATURE_SETPOINT))
elif command == self.commands[1]:
self.set(self.KEY_USER_TEMPERATURE_SETPOINT, self.__command_float_value__(value))
elif command == self.commands[2]:
self.set(self.KEY_AWAY_MODE, not self.get(self.KEY_AWAY_MODE))
elif command == self.commands[3]:
self.set(self.KEY_SUMMER_MODE, not self.get(self.KEY_SUMMER_MODE))
elif command == self.commands[4]:
self.set(self.KEY_SET_DEFAULT_TEMPERATURE, True)
elif command == self.commands[5]:
self.set(self.KEY_START_BOOST, True)
else:
print("%s: not yet implemented!" % command)
else:
print("Unknown command!")
def print_formatted(self, device, key, value): def print_formatted(self, device, key, value):
desc_temp_dict = { desc_temp_dict = {
self.KEY_TEMPERATURE: "Current Temperature", self.KEY_TEMPERATURE: "Current Temperature",
@ -783,43 +568,10 @@ class videv_heating(base_videv):
self.print_formatted_percent(COLOR_GUI_ACTIVE, 't', perc, '%3d%%' % perc, '(%.1f)' % disp_value) self.print_formatted_percent(COLOR_GUI_ACTIVE, 't', perc, '%3d%%' % perc, '(%.1f)' % disp_value)
class videv_warnings(base):
DEVICENAME = "ViDevWarnings"
#
KEY_WARNING = "html_short"
#
RX_KEYS = [KEY_WARNING]
#
COMMANDS = [
"get_warnings",
]
def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, dict.fromkeys([self.KEY_WARNING]))
def command(self, command):
if command in self.COMMANDS:
if command == self.COMMANDS[0]:
self.print_formatted(self, self.KEY_WARNING, self.get(self.KEY_WARNING))
else:
print("%s: not yet implemented!" % command)
else:
print("Unknown command!")
def print_formatted(self, device, key, value):
if OUTPUT_ACTIVE:
value = value.replace("<br><br>", "\n")
value = value.replace("<br>", " - ")
print(COLOR_WARNINGS + "** WARNINGS: *************************************************")
for line in value.split("\n"):
print(" ", line)
print("**************************************************************" + colored.attr("reset"))
# class silvercrest_motion_sensor(base): # class silvercrest_motion_sensor(base):
# KEY_OCCUPANCY = "occupancy" # KEY_OCCUPANCY = "occupancy"
# KEY_BATTERY = "battery" # KEY_BATTERY = "battery"
# KEY_BATTERY_LOW = "battery_low" # KEY_BATTERY_LOW = "battery_low"
# COMMANDS = ['motion']
# def __init__(self, mqtt_client, topic): # def __init__(self, mqtt_client, topic):
# super().__init__(mqtt_client, topic) # super().__init__(mqtt_client, topic)
@ -829,18 +581,6 @@ class videv_warnings(base):
# def __rx__(self, client, userdata, message): # def __rx__(self, client, userdata, message):
# pass # pass
# def command(self, command):
# try:
# command, value = command.split(' ')
# except ValueError:
# value = None
# else:
# value = json.loads(value)
# if command == self.COMMANDS[0]:
# self.store_data(**{self.KEY_OCCUPANCY: True})
# time.sleep(value or 10)
# self.store_data(**{self.KEY_OCCUPANCY: False})
# def print_formatted(self, device, key, value): # def print_formatted(self, device, key, value):
# if value is not None: # if value is not None:
# print_light(COLOR_MOTION_SENSOR, value, self.topic, "") # print_light(COLOR_MOTION_SENSOR, value, self.topic, "")
@ -866,33 +606,13 @@ class videv_warnings(base):
# ACTION_BRIGHTNESS_DOWN_LONG = "brightness_down_hold" # ACTION_BRIGHTNESS_DOWN_LONG = "brightness_down_hold"
# ACTION_RIGHT_LONG = "arrow_right_hold" # ACTION_RIGHT_LONG = "arrow_right_hold"
# ACTION_LEFT_LONG = "arrow_left_hold" # ACTION_LEFT_LONG = "arrow_left_hold"
# # #
# COMMANDS = [ACTION_TOGGLE, ACTION_LEFT, ACTION_RIGHT, ACTION_BRIGHTNESS_UP, ACTION_BRIGHTNESS_DOWN,
# ACTION_LEFT_LONG, ACTION_RIGHT_LONG, ACTION_BRIGHTNESS_UP_LONG, ACTION_BRIGHTNESS_DOWN_LONG]
# def __init__(self, mqtt_client, topic): # def __init__(self, mqtt_client, topic):
# super().__init__(mqtt_client, topic) # super().__init__(mqtt_client, topic)
# def __rx__(self, client, userdata, message): # def __rx__(self, client, userdata, message):
# pass # pass
# def command(self, command):
# try:
# command, value = command.split(' ')
# except ValueError:
# value = None
# else:
# value = json.loads(value)
# if command in self.capabilities():
# action = self.COMMANDS[self.COMMANDS.index(command)]
# if self.COMMANDS.index(command) <= 4:
# self.mqtt_client.send(self.topic, json.dumps({self.KEY_ACTION: action}))
# elif self.COMMANDS.index(command) <= 8:
# self.mqtt_client.send(self.topic, json.dumps({self.KEY_ACTION: action}))
# time.sleep(value or 0.5)
# action = '_'.join(action.split('_')[:-1] + ['release'])
# self.mqtt_client.send(self.topic, json.dumps({self.KEY_ACTION: action}))
#
# def warning_state_on(self): # def warning_state_on(self):
# self.set(self.KEY_BATTERY, 7) # self.set(self.KEY_BATTERY, 7)
# def warning_state_off(self): # def warning_state_off(self):

View File

@ -1,330 +1,96 @@
import config from devdi import rooms
from simulation.devices import videv_light, videv_heating, videv_warnings
import inspect
from devdi import topic as props #
# rooms
#
class base(object): class ffe_livingroom(rooms.ffe_livingroom):
def getmembers(self, prefix=''): def __init__(self, mqtt_client):
rv = [] super().__init__(mqtt_client)
for name, obj in inspect.getmembers(self): # Enable/disable hue device, on power on/off
if prefix: self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, True, self.light_main_light.power_on)
full_name = prefix + '.' + name self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, False, self.light_main_light.power_off)
else:
full_name = name
if not name.startswith('_'): class ffe_sleep(rooms.ffe_sleep):
try: def __init__(self, mqtt_client):
if obj.__module__.endswith('devices'): super().__init__(mqtt_client)
rv.append(full_name) # Enable/disable hue device, on power on/off
else: self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, True, self.light_main_light.power_on)
rv.extend(obj.getmembers(full_name)) self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, False, self.light_main_light.power_off)
except AttributeError:
pass
return rv class ffw_julian(rooms.ffw_julian):
def __init__(self, mqtt_client):
def getobjbyname(self, name): super().__init__(mqtt_client)
obj = self # Enable/disable hue device, on power on/off
for subname in name.split('.'): self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, True, self.light_main_light.power_on)
obj = getattr(obj, subname) self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, False, self.light_main_light.power_off)
return obj
def command(self, full_command): class ffw_livingroom(rooms.ffw_livingroom):
try: def __init__(self, mqtt_client):
parameter = " " + full_command.split(' ')[1] super().__init__(mqtt_client)
except IndexError: # Enable/disable hue device, on power on/off
parameter = "" self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, True, self.light_main_light.power_on)
command = full_command.split(' ')[0].split('.')[-1] + parameter self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, False, self.light_main_light.power_off)
device_name = '.'.join(full_command.split(' ')[0].split('.')[:-1])
self.getobjbyname(device_name).command(command)
class ffw_sleep(rooms.ffw_sleep):
def __init__(self, mqtt_client):
class gfw_floor(base): super().__init__(mqtt_client)
def __init__(self, mqtt_client, pd): # Enable/disable hue device, on power on/off
loc = props.LOC_GFW self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, True, self.light_main_light.power_on)
roo = props.ROO_FLO self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, False, self.light_main_light.power_off)
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER) class gfw_dirk(rooms.gfw_dirk):
self.main_light_zigbee = pd.get(props.STG_ZGW, loc, roo, props.FUN_MAL) def __init__(self, mqtt_client):
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on) super().__init__(mqtt_client)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off) # Enable/disable hue device, on power on/off
# self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, True, self.light_main_light.power_on)
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_GFW_FLOOR_MAIN_LIGHT_VIDEV, True, True, True) self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, False, self.light_main_light.power_off)
class gfw_marion(base): class gfw_floor(rooms.gfw_floor):
def __init__(self, mqtt_client, pd): def __init__(self, mqtt_client):
loc = props.LOC_GFW super().__init__(mqtt_client)
roo = props.ROO_MAR # Enable/disable hue device, on power on/off
# self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, True, self.light_main_light.power_on)
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL) self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, False, self.light_main_light.power_off)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.window_light = pd.get(props.STG_ZGW, loc, roo, props.FUN_WIL)
#
self.heating_valve = pd.get(props.STG_ZGW, loc, roo, props.FUN_HEA) # Locations
#
# class ffe(object):
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_GFW_MARION_MAIN_LIGHT_VIDEV, True, False, False) def __init__(self, mqtt_client):
self.videv_window_light = videv_light(mqtt_client, config.TOPIC_GFW_MARION_WINDOW_LAMP_VIDEV, True, False, False) self.diningroom = rooms.ffe_diningroom(mqtt_client)
self.videv_heating = videv_heating(mqtt_client, config.TOPIC_GFW_MARION_HEATING_VALVE_VIDEV) self.floor = rooms.ffe_floor(mqtt_client)
self.kitchen = rooms.ffe_kitchen(mqtt_client)
self.livingroom = ffe_livingroom(mqtt_client)
class gfw_dirk(base): self.sleep = ffe_sleep(mqtt_client)
def __init__(self, mqtt_client, pd):
loc = props.LOC_GFW
roo = props.ROO_DIR class ffw(object):
# def __init__(self, mqtt_client):
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL) self.bath = rooms.ffw_bath(mqtt_client)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER) self.floor = rooms.ffw_floor(mqtt_client)
self.main_light_zigbee = pd.get(props.STG_ZGW, loc, roo, props.FUN_MAL) self.julian = ffw_julian(mqtt_client)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on) self.livingroom = ffw_livingroom(mqtt_client)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off) self.sleep = ffw_sleep(mqtt_client)
self.desk_light = pd.get(props.STG_ZGW, loc, roo, props.FUN_DEL)
self.pc_dock = pd.get(props.STG_ZGW, loc, roo, props.FUN_DCK)
class gfw(object):
self.my_powerplug = pd.get(props.STG_MYA, loc, roo, props.FUN_MPP) def __init__(self, mqtt_client):
self.dirk = gfw_dirk(mqtt_client)
self.heating_valve = pd.get(props.STG_ZGW, loc, roo, props.FUN_HEA) self.floor = gfw_floor(mqtt_client)
self.marion = rooms.gfw_marion(mqtt_client)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_MAIN_LIGHT_VIDEV, True, True, True)
self.videv_pc_dock = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_PC_DOCK_VIDEV, True, False, False) class house(object):
def __init__(self, mqtt_client):
self.videv_desk_light = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_DESK_LIGHT_VIDEV, True, True, True) self.ffe = ffe(mqtt_client)
self.videv_amplifier = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_AMPLIFIER_VIDEV, True, False, False) self.ffw = ffw(mqtt_client)
self.videv_cd_player = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_CD_PLAYER_VIDEV, True, False, False) self.gfw = gfw(mqtt_client)
self.videv_bt = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_BT_VIDEV, True, False, False) self.stairway = rooms.stairway(mqtt_client)
self.videv_phono = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_PHONO_VIDEV, True, False, False)
#
self.videv_heating = videv_heating(mqtt_client, config.TOPIC_GFW_DIRK_HEATING_VALVE_VIDEV)
class gfw(base):
def __init__(self, mqtt_client, pd):
self.floor = gfw_floor(mqtt_client, pd)
self.marion = gfw_marion(mqtt_client, pd)
self.dirk = gfw_dirk(mqtt_client, pd)
class ffw_julian(base):
def __init__(self, mqtt_client, pd):
loc = props.LOC_FFW
roo = props.ROO_JUL
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light_zigbee = pd.get(props.STG_ZFW, loc, roo, props.FUN_MAL)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off)
self.heating_valve = pd.get(props.STG_ZFW, loc, roo, props.FUN_HEA)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_VIDEV, True, True, True)
self.videv_heating = videv_heating(mqtt_client, config.TOPIC_FFW_JULIAN_HEATING_VALVE_VIDEV)
class ffw_livingroom(base):
def __init__(self, mqtt_client, pd):
loc = props.LOC_FFW
roo = props.ROO_LIV
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light_zigbee = pd.get(props.STG_ZFW, loc, roo, props.FUN_MAL)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off)
self.heating_valve = pd.get(props.STG_ZFW, loc, roo, props.FUN_HEA)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_VIDEV, True, True, True)
self.videv_heating = videv_heating(mqtt_client, config.TOPIC_FFW_LIVINGROOM_HEATING_VALVE_VIDEV)
class ffw_sleep(base):
def __init__(self, mqtt_client, pd):
loc = props.LOC_FFW
roo = props.ROO_SLP
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light_zigbee = pd.get(props.STG_ZFW, loc, roo, props.FUN_MAL)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off)
self.heating_valve = pd.get(props.STG_ZFW, loc, roo, props.FUN_HEA)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_VIDEV, True, True, False)
self.videv_heating = videv_heating(mqtt_client, config.TOPIC_FFW_SLEEP_HEATING_VALVE_VIDEV)
class ffw_bath(base):
def __init__(self, mqtt_client, pd):
loc = props.LOC_FFW
roo = props.ROO_BAT
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.heating_valve = pd.get(props.STG_ZFW, loc, roo, props.FUN_HEA)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFW_BATH_MAIN_LIGHT_VIDEV, True, False, False)
self.videv_heating = videv_heating(mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_VIDEV)
class ffw_floor(base):
def __init__(self, mqtt_client, pd):
loc = props.LOC_FFW
roo = props.ROO_FLO
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFW_FLOOR_MAIN_LIGHT_VIDEV, True, False, False)
class ffw(base):
def __init__(self, mqtt_client, pd):
self.julian = ffw_julian(mqtt_client, pd)
self.livingroom = ffw_livingroom(mqtt_client, pd)
self.sleep = ffw_sleep(mqtt_client, pd)
self.bath = ffw_bath(mqtt_client, pd)
self.floor = ffw_floor(mqtt_client, pd)
class ffe_floor(base):
def __init__(self, mqtt_client, pd):
loc = props.LOC_FFE
roo = props.ROO_FLO
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFE_FLOOR_MAIN_LIGHT_VIDEV, True, False, False)
class ffe_kitchen(base):
def __init__(self, mqtt_client, pd):
loc = props.LOC_FFE
roo = props.ROO_KIT
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.circulation_pump = pd.get(props.STG_SHE, loc, roo, props.FUN_CIR)
self.circulation_pump.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER) # , output_0_auto_off=10*60)
self.heating_valve = pd.get(props.STG_ZFE, loc, roo, props.FUN_HEA)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFE_KITCHEN_MAIN_LIGHT_VIDEV, True, False, False)
self.videv_circulation_pump = videv_light(mqtt_client, config.TOPIC_FFE_KITCHEN_CIRCULATION_PUMP_VIDEV, True, False, False, True)
self.videv_heating = videv_heating(mqtt_client, config.TOPIC_FFE_KITCHEN_HEATING_VALVE_VIDEV)
class ffe_diningroom(base):
def __init__(self, mqtt_client, pd):
loc = props.LOC_FFE
roo = props.ROO_DIN
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.floor_lamp = pd.get(props.STG_ZFE, loc, roo, props.FUN_FLL)
self.heating_valve = pd.get(props.STG_ZFE, loc, roo, props.FUN_HEA)
if config.CHRISTMAS:
self.garland = pd.get(props.STG_ZFE, loc, roo, props.FUN_GAR)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFE_DININGROOM_MAIN_LIGHT_VIDEV, True, False, False)
self.videv_floor_lamp = videv_light(mqtt_client, config.TOPIC_FFE_DININGROOM_FLOOR_LAMP_VIDEV, True, False, False)
self.videv_heating = videv_heating(mqtt_client, config.TOPIC_FFE_DININGROOM_HEATING_VALVE_VIDEV)
if config.CHRISTMAS:
self.videv_garland = videv_light(mqtt_client, config.TOPIC_FFE_DININGROOM_GARLAND_VIDEV, True, False, False)
class ffe_sleep(base):
def __init__(self, mqtt_client, pd):
loc = props.LOC_FFE
roo = props.ROO_SLP
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light_zigbee = pd.get(props.STG_ZFE, loc, roo, props.FUN_MAL)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off)
self.bed_light_di_zigbee = pd.get(props.STG_ZFE, loc, roo, props.FUN_BLD)
self.bed_light_ma = pd.get(props.STG_ZFE, loc, roo, props.FUN_BLM)
self.heating_valve = pd.get(props.STG_ZFE, loc, roo, props.FUN_HEA)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFE_SLEEP_MAIN_LIGHT_VIDEV, True, True, True)
self.videv_bed_light_ma = videv_light(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_MA_VIDEV, True, False, False)
self.videv_bed_light_di = videv_light(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_DI_VIDEV, True, True, False)
self.videv_heating = videv_heating(mqtt_client, config.TOPIC_FFE_SLEEP_HEATING_VALVE_VIDEV)
class ffe_livingroom(base):
def __init__(self, mqtt_client, pd):
loc = props.LOC_FFE
roo = props.ROO_LIV
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light_zigbee = pd.get(props.STG_ZFE, loc, roo, props.FUN_MAL)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off)
self.floor_lamp_zigbee = pd.get(props.STG_ZFE, loc, roo, props.FUN_FLL)
if config.CHRISTMAS:
self.xmas_tree = pd.get(props.STG_ZFE, loc, roo, props.FUN_XTR)
self.xmas_star = pd.get(props.STG_ZFE, loc, roo, props.FUN_XST)
self.heating_valve = pd.get(props.STG_ZFE, loc, roo, props.FUN_HEA)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_VIDEV, True, True, True)
self.videv_floor_lamp = videv_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_FLOOR_LAMP_VIDEV, True, True, True)
if config.CHRISTMAS:
self.videv_xmas_tree = videv_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_XMAS_TREE_VIDEV)
self.videv_heating = videv_heating(mqtt_client, config.TOPIC_FFE_LIVINGROOM_HEATING_VALVE_VIDEV)
class ffe(base):
def __init__(self, mqtt_client, pd):
self.floor = ffe_floor(mqtt_client, pd)
self.kitchen = ffe_kitchen(mqtt_client, pd)
self.diningroom = ffe_diningroom(mqtt_client, pd)
self.sleep = ffe_sleep(mqtt_client, pd)
self.livingroom = ffe_livingroom(mqtt_client, pd)
class stairway(base):
def __init__(self, mqtt_client, pd):
loc = props.LOC_STW
roo = props.ROO_STF
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_VIDEV, True, False, False, True)
class house(base):
def __init__(self, mqtt_client, pd):
self.gfw = gfw(mqtt_client, pd)
self.ffw = ffw(mqtt_client, pd)
self.ffe = ffe(mqtt_client, pd)
self.stairway = stairway(mqtt_client, pd)
self.warnings = videv_warnings(mqtt_client, config.TOPIC_WARNINGS)

View File

@ -1,11 +1,9 @@
import argparse import argparse
import config import config
import devdi.devices
import mqtt import mqtt
from simulation.rooms import house from simulation.rooms import house
import report import report
import os import os
import time
import tests.help import tests.help
@ -37,15 +35,10 @@ if __name__ == "__main__":
# #
mc = mqtt.mqtt_client(host=config.MQTT_SERVER, port=config.MQTT_PORT, username=config.MQTT_USER, mc = mqtt.mqtt_client(host=config.MQTT_SERVER, port=config.MQTT_PORT, username=config.MQTT_USER,
password=config.MQTT_PASSWORD, name=config.APP_NAME) password=config.MQTT_PASSWORD, name=config.APP_NAME)
#
# Smarthome physical Devices
#
pd = devdi.devices.physical_devices(mc)
# #
# House instance # House instance
# #
h = house(mc, pd) h = house(mc)
# #
# Testsuite # Testsuite

View File

@ -14,9 +14,9 @@ from config import APP_NAME as ROOT_LOGGER_NAME
DELAY_SET_GET = 0.1 DELAY_SET_GET = 0.1
STATES_SW = (True, False) STATES_SW = (True, False)
STATES_BR = range(0, 101, 20) STATES_BR = list(range(0, 101, 20))
STATES_CT = range(0, 11, 2) STATES_CT = list(range(0, 11, 2))
STATES_TEMP = range(15, 31, 5) STATES_TEMP = list(range(15, 31, 5))
class testSession(testSessionBase): class testSession(testSessionBase):

View File

@ -82,27 +82,27 @@ def ffe(ts: testSession, mc: mqtt_client, h: house):
room = h.ffe.livingroom room = h.ffe.livingroom
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
# floor_lamp videv<->zigbee + main_light->zigbee # floor_lamp videv<->zigbee + main_light->zigbee
device_follow_sw(ts, room.videv_floor_lamp, room.floor_lamp_zigbee) device_follow_sw(ts, room.videv_floor_light, room.light_floor_light)
device_follow_sw(ts, room.floor_lamp_zigbee, room.videv_floor_lamp) device_follow_sw(ts, room.light_floor_light, room.videv_floor_light)
device_follow_sw(ts, room.main_light, room.floor_lamp_zigbee) device_follow_sw(ts, room.switch_main_light, room.light_floor_light)
# xmas_tree videv<-->shelly # xmas_tree videv<-->shelly
if config.CHRISTMAS: if config.CHRISTMAS:
device_follow_sw(ts, room.videv_xmas_tree, room.xmas_tree) device_follow_sw(ts, room.videv_xmas_tree_light, room.switch_xmas_tree_light)
device_follow_sw(ts, room.xmas_tree, room.videv_xmas_tree) device_follow_sw(ts, room.switch_xmas_tree_light, room.videv_xmas_tree_light)
# Brightness and Colortemperature #################### # Brightness and Colortemperature ####################
device_follow_br(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_br(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
device_follow_ct(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_ct(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_ct(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_ct(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
device_follow_br(ts, room.videv_floor_lamp, room.floor_lamp_zigbee, room.floor_lamp_zigbee) device_follow_br(ts, room.videv_floor_light, room.light_floor_light, room.light_floor_light)
device_follow_br(ts, room.floor_lamp_zigbee, room.videv_floor_lamp, room.floor_lamp_zigbee) device_follow_br(ts, room.light_floor_light, room.videv_floor_light, room.light_floor_light)
device_follow_ct(ts, room.videv_floor_lamp, room.floor_lamp_zigbee, room.floor_lamp_zigbee) device_follow_ct(ts, room.videv_floor_light, room.light_floor_light, room.light_floor_light)
device_follow_ct(ts, room.floor_lamp_zigbee, room.videv_floor_lamp, room.floor_lamp_zigbee) device_follow_ct(ts, room.light_floor_light, room.videv_floor_light, room.light_floor_light)
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.heating_valve) device_follow_temp(ts, room.videv_heating, room.valve_heating)
# #
# ffe.sleep # ffe.sleep
@ -110,24 +110,24 @@ def ffe(ts: testSession, mc: mqtt_client, h: house):
room = h.ffe.sleep room = h.ffe.sleep
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
# bed_light_di videv<-->zigbee # bed_light_di videv<-->zigbee
device_follow_sw(ts, room.videv_bed_light_di, room.bed_light_di_zigbee) device_follow_sw(ts, room.videv_bed_dirk_light, room.light_bed_dirk_light)
device_follow_sw(ts, room.bed_light_di_zigbee, room.videv_bed_light_di) device_follow_sw(ts, room.light_bed_dirk_light, room.videv_bed_dirk_light)
# #
device_follow_sw(ts, room.videv_bed_light_ma, room.bed_light_ma) device_follow_sw(ts, room.videv_bed_marion_light, room.switch_bed_marion_light)
device_follow_sw(ts, room.bed_light_ma, room.videv_bed_light_ma) device_follow_sw(ts, room.switch_bed_marion_light, room.videv_bed_marion_light)
# Brightness and Colortemperature #################### # Brightness and Colortemperature ####################
device_follow_br(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_br(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
device_follow_ct(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_ct(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_ct(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_ct(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
device_follow_br(ts, room.videv_bed_light_di, room.bed_light_di_zigbee, room.bed_light_di_zigbee) device_follow_br(ts, room.videv_bed_dirk_light, room.light_bed_dirk_light, room.light_bed_dirk_light)
device_follow_br(ts, room.bed_light_di_zigbee, room.videv_bed_light_di, room.bed_light_di_zigbee) device_follow_br(ts, room.light_bed_dirk_light, room.videv_bed_dirk_light, room.light_bed_dirk_light)
# TODO: Wardrobe # TODO: Wardrobe
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.heating_valve) device_follow_temp(ts, room.videv_heating, room.valve_heating)
# #
# ffe.diningroom # ffe.diningroom
@ -135,16 +135,16 @@ def ffe(ts: testSession, mc: mqtt_client, h: house):
room = h.ffe.diningroom room = h.ffe.diningroom
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
# floor_lamp videv<->zigbee + main_light->zigbee # floor_lamp videv<->zigbee + main_light->zigbee
device_follow_sw(ts, room.videv_floor_lamp, room.floor_lamp) device_follow_sw(ts, room.videv_floor_light, room.switch_floor_light)
device_follow_sw(ts, room.floor_lamp, room.videv_floor_lamp) device_follow_sw(ts, room.switch_floor_light, room.videv_floor_light)
device_follow_sw(ts, room.main_light, room.floor_lamp) device_follow_sw(ts, room.switch_main_light, room.switch_floor_light)
# garland # garland
if config.CHRISTMAS: if config.CHRISTMAS:
device_follow_sw(ts, room.videv_garland, room.garland) device_follow_sw(ts, room.videv_garland_light, room.switch_garland_light)
device_follow_sw(ts, room.garland, room.videv_garland) device_follow_sw(ts, room.switch_garland_light, room.videv_garland_light)
# #
# ffe.kitchen # ffe.kitchen
@ -152,18 +152,18 @@ def ffe(ts: testSession, mc: mqtt_client, h: house):
room = h.ffe.kitchen room = h.ffe.kitchen
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
# circulation_pump # circulation_pump
device_follow_sw(ts, room.videv_circulation_pump, room.circulation_pump) device_follow_sw(ts, room.videv_circulation_pump, room.switch_circulation_pump)
device_follow_sw(ts, room.circulation_pump, room.videv_circulation_pump) device_follow_sw(ts, room.switch_circulation_pump, room.videv_circulation_pump)
# Brightness and Colortemperature #################### # Brightness and Colortemperature ####################
# TODO: device_follow_br(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) # TODO: device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
# TODO: device_follow_br(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) # TODO: device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
# TODO: device_follow_ct(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) # TODO: device_follow_ct(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
# TODO: device_follow_ct(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) # TODO: device_follow_ct(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.heating_valve) device_follow_temp(ts, room.videv_heating, room.valve_heating)
# #
# ffe.floor # ffe.floor
@ -171,8 +171,8 @@ def ffe(ts: testSession, mc: mqtt_client, h: house):
# Switching devices ################################## # Switching devices ##################################
room = h.ffe.floor room = h.ffe.floor
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
def ffw(ts: testSession, mc: mqtt_client, h: house): def ffw(ts: testSession, mc: mqtt_client, h: house):
@ -182,15 +182,15 @@ def ffw(ts: testSession, mc: mqtt_client, h: house):
room = h.ffw.livingroom room = h.ffw.livingroom
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
# Brightness and Colortemperature #################### # Brightness and Colortemperature ####################
device_follow_br(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_br(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
device_follow_ct(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_ct(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_ct(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_ct(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.heating_valve) device_follow_temp(ts, room.videv_heating, room.valve_heating)
# #
# ffw.sleep # ffw.sleep
@ -198,14 +198,14 @@ def ffw(ts: testSession, mc: mqtt_client, h: house):
room = h.ffw.sleep room = h.ffw.sleep
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
# TODO: window_light # TODO: window_light
# Brightness and Colortemperature #################### # Brightness and Colortemperature ####################
device_follow_br(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_br(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.heating_valve) device_follow_temp(ts, room.videv_heating, room.valve_heating)
# #
# ffw.julian # ffw.julian
@ -213,15 +213,15 @@ def ffw(ts: testSession, mc: mqtt_client, h: house):
room = h.ffw.julian room = h.ffw.julian
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
# Brightness and Colortemperature #################### # Brightness and Colortemperature ####################
device_follow_br(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_br(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
device_follow_ct(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_ct(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_ct(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_ct(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.heating_valve) device_follow_temp(ts, room.videv_heating, room.valve_heating)
# #
# ffw.bath # ffw.bath
@ -229,10 +229,10 @@ def ffw(ts: testSession, mc: mqtt_client, h: house):
room = h.ffw.bath room = h.ffw.bath
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light, single=True) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light, single=True) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.heating_valve) device_follow_temp(ts, room.videv_heating, room.valve_heating)
# #
# ffw.floor # ffw.floor
@ -240,8 +240,8 @@ def ffw(ts: testSession, mc: mqtt_client, h: house):
room = h.ffw.floor room = h.ffw.floor
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
def gfe(ts: testSession, mc: mqtt_client, h: house): def gfe(ts: testSession, mc: mqtt_client, h: house):
@ -260,14 +260,14 @@ def gfw(ts: testSession, mc: mqtt_client, h: house):
room = h.gfw.dirk room = h.gfw.dirk
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
# desk_light videv<-->tradfri # desk_light videv<-->tradfri
device_follow_sw(ts, room.videv_desk_light, room.desk_light) device_follow_sw(ts, room.videv_desk_light, room.light_desk_light)
device_follow_sw(ts, room.desk_light, room.videv_desk_light) device_follow_sw(ts, room.light_desk_light, room.videv_desk_light)
# desk_light videv<-->powerplug # desk_light videv<-->powerplug
device_follow_sw(ts, room.videv_pc_dock, room.pc_dock) device_follow_sw(ts, room.videv_pc_dock, room.switch_pc_dock)
device_follow_sw(ts, room.pc_dock, room.videv_pc_dock) device_follow_sw(ts, room.switch_pc_dock, room.videv_pc_dock)
# powerplug videv <-> channel # powerplug videv <-> channel
device_follow_sw(ts, room.videv_amplifier, room.my_powerplug, slave_ch=0) device_follow_sw(ts, room.videv_amplifier, room.my_powerplug, slave_ch=0)
device_follow_sw(ts, room.my_powerplug, room.videv_amplifier, master_ch=0) device_follow_sw(ts, room.my_powerplug, room.videv_amplifier, master_ch=0)
@ -275,23 +275,23 @@ def gfw(ts: testSession, mc: mqtt_client, h: house):
device_follow_sw(ts, room.my_powerplug, room.videv_phono, master_ch=1) device_follow_sw(ts, room.my_powerplug, room.videv_phono, master_ch=1)
device_follow_sw(ts, room.videv_cd_player, room.my_powerplug, slave_ch=2) device_follow_sw(ts, room.videv_cd_player, room.my_powerplug, slave_ch=2)
device_follow_sw(ts, room.my_powerplug, room.videv_cd_player, master_ch=2) device_follow_sw(ts, room.my_powerplug, room.videv_cd_player, master_ch=2)
device_follow_sw(ts, room.videv_bt, room.my_powerplug, slave_ch=3) device_follow_sw(ts, room.videv_bluetooth, room.my_powerplug, slave_ch=3)
device_follow_sw(ts, room.my_powerplug, room.videv_bt, master_ch=3) device_follow_sw(ts, room.my_powerplug, room.videv_bluetooth, master_ch=3)
# powerplug follow # powerplug follow
device_follow_sw(ts, room.my_powerplug, room.my_powerplug, master_ch=1, slave_ch=0) device_follow_sw(ts, room.my_powerplug, room.my_powerplug, master_ch=1, slave_ch=0)
device_follow_sw(ts, room.my_powerplug, room.my_powerplug, master_ch=2, slave_ch=0) device_follow_sw(ts, room.my_powerplug, room.my_powerplug, master_ch=2, slave_ch=0)
device_follow_sw(ts, room.my_powerplug, room.my_powerplug, master_ch=3, slave_ch=0) device_follow_sw(ts, room.my_powerplug, room.my_powerplug, master_ch=3, slave_ch=0)
# Brightness and Colortemperature #################### # Brightness and Colortemperature ####################
device_follow_br(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_br(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
device_follow_ct(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_ct(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_ct(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_ct(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
device_follow_br(ts, room.videv_desk_light, room.desk_light, room.desk_light) device_follow_br(ts, room.videv_desk_light, room.light_desk_light, room.light_desk_light)
device_follow_br(ts, room.desk_light, room.videv_desk_light, room.desk_light) device_follow_br(ts, room.light_desk_light, room.videv_desk_light, room.light_desk_light)
device_follow_ct(ts, room.videv_desk_light, room.desk_light, room.desk_light) device_follow_ct(ts, room.videv_desk_light, room.light_desk_light, room.light_desk_light)
device_follow_ct(ts, room.desk_light, room.videv_desk_light, room.desk_light) device_follow_ct(ts, room.light_desk_light, room.videv_desk_light, room.light_desk_light)
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.heating_valve) device_follow_temp(ts, room.videv_heating, room.valve_heating)
# #
# gfw.marion # gfw.marion
@ -299,14 +299,14 @@ def gfw(ts: testSession, mc: mqtt_client, h: house):
room = h.gfw.marion room = h.gfw.marion
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
# floor_lamp videv<->zigbee + main_light->zigbee # floor_lamp videv<->zigbee + main_light->zigbee
device_follow_sw(ts, room.videv_window_light, room.window_light) device_follow_sw(ts, room.videv_window_light, room.light_window_light)
device_follow_sw(ts, room.window_light, room.videv_window_light) device_follow_sw(ts, room.light_window_light, room.videv_window_light)
device_follow_sw(ts, room.main_light, room.window_light) device_follow_sw(ts, room.switch_main_light, room.light_window_light)
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.heating_valve) device_follow_temp(ts, room.videv_heating, room.valve_heating)
# #
# gfw.floor # gfw.floor
@ -314,13 +314,13 @@ def gfw(ts: testSession, mc: mqtt_client, h: house):
room = h.gfw.floor room = h.gfw.floor
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
# Brightness and Colortemperature #################### # Brightness and Colortemperature ####################
device_follow_br(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_br(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
device_follow_ct(ts, room.videv_main_light, room.main_light_zigbee, room.main_light) device_follow_ct(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_ct(ts, room.main_light_zigbee, room.videv_main_light, room.main_light) device_follow_ct(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
def stw(ts: testSession, mc: mqtt_client, h: house): def stw(ts: testSession, mc: mqtt_client, h: house):
@ -330,5 +330,5 @@ def stw(ts: testSession, mc: mqtt_client, h: house):
room = h.stairway room = h.stairway
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)