From 43ed28334057af930dfe528b5d74d4c2c0d30be8 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Thu, 2 Jul 2020 22:54:00 +0200 Subject: [PATCH] intermediate commit --- plugins/pymock/integrationpluginpymock.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/pymock/integrationpluginpymock.py b/plugins/pymock/integrationpluginpymock.py index c1872187..d96c4d75 100644 --- a/plugins/pymock/integrationpluginpymock.py +++ b/plugins/pymock/integrationpluginpymock.py @@ -9,11 +9,16 @@ def configValueChanged(paramTypeId, value): logger.log("Plugin config value changed:", paramTypeId, value) if paramTypeId == pyMockPluginAutoThingCountParamTypeId: logger.log("Auto Thing Count plugin config changed:", value, "Currently there are:", len(autoThings()), "auto things") - for i in range(value, len(myThings())): + things = autoThings(); + for i in range(len(things), value): logger.log("Creating new auto thing") descriptor = nymea.ThingDescriptor(pyMockAutoThingClassId, "Python Mock auto thing") autoThingsAppeared([descriptor]) + for i in range(len(value), things): + logger.log("Removing auto thing") + autoThingDisappeared(things[i].id) + def startMonitoringAutoThings(): logger.log("Start monitoring auto things. Have %i auto devices. Need %i." % (len(autoThings()), configValue(pyMockPluginAutoThingCountParamTypeId)))