From 7e4f92aaf1cd1dd2626e2b3337277eddfc37578e Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Tue, 12 Dec 2023 12:38:15 +0100 Subject: [PATCH] Fix for get method and get_str method implemented --- devices.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/devices.py b/devices.py index d1d3b40..f5f73f3 100644 --- a/devices.py +++ b/devices.py @@ -74,11 +74,21 @@ class base(dict): loc (numeric): Location (see LOC_* in props) roo (numeric): Room (see ROO_* in props) fun (numeric): Function (see FUN_* in props) - num (numeric): Device number in case of multiple devices """ - topic = self.__topic__(stg, loc, roo, fun) + topic = topic_by_props(stg, loc, roo, fun) return self[topic] + def get_str(self, stg, loc, roo, fun): + """Method to get a device by str version of props + + Args: + stg (str): Source transmittion group (see SIS_* in props) + loc (str): Location (see LOC_* in props) + roo (str): Room (see ROO_* in props) + fun (str): Function (see FUN_* in props) + """ + return self.get(getattr(props, stg), getattr(props, loc), getattr(props, roo), getattr(props, fun)) + class physical_devices(base): """