From 3e5fb92e6e90480df967626803299e77ebd887b8 Mon Sep 17 00:00:00 2001 From: Onkel Andy Date: Wed, 16 Aug 2023 13:55:05 +0200 Subject: [PATCH] stateengine plugin: improve error handling when laststate items, etc. are not defined --- stateengine/StateEngineItem.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/stateengine/StateEngineItem.py b/stateengine/StateEngineItem.py index 557334bad..196e1f088 100755 --- a/stateengine/StateEngineItem.py +++ b/stateengine/StateEngineItem.py @@ -96,43 +96,53 @@ def instant_leaveaction(self): @property def laststate(self): - return self.__laststate_item_id.property.value + _returnvalue = None if self.__laststate_item_id is None else self.__laststate_item_id.property.value + return _returnvalue @property def previousstate(self): - return self.__previousstate_item_id.property.value + _returnvalue = None if self.__previousstate_item_id is None else self.__previousstate_item_id.property.value + return _returnvalue @property def lastconditionset(self): - return self.__lastconditionset_item_id.property.value + _returnvalue = None if self.__lastconditionset_item_id is None else self.__lastconditionset_item_id.property.value + return _returnvalue @property def previousconditionset(self): - return self.__previousconditionset_item_id.property.value + _returnvalue = None if self.__previousconditionset_item_id is None else self.__previousconditionset_item_id.property.value + return _returnvalue @property def previousstate_conditionset(self): - return self.__previousstate_conditionset_item_id.property.value + _returnvalue = None if self.__previousstate_conditionset_item_id is None else self.__previousstate_conditionset_item_id.property.value + return _returnvalue @property def laststate_name(self): - return self.__laststate_item_name.property.value + _returnvalue = None if self.__laststate_item_name is None else self.__laststate_item_name.property.value + return _returnvalue @property def previousstate_name(self): - return self.__previousstate_item_name.property.value + _returnvalue = None if self.__previousstate_item_name is None else self.__previousstate_item_name.property.value + return _returnvalue @property def lastconditionset_name(self): - return self.__lastconditionset_item_name.property.value + _returnvalue = None if self.__lastconditionset_item_name is None else self.__lastconditionset_item_name.property.value + return _returnvalue @property def previousconditionset_name(self): - return self.__previousconditionset_item_name.property.value + _returnvalue = None if self.__previousconditionset_item_name is None else self.__previousconditionset_item_name.property.value + return _returnvalue @property def previousstate_conditionset_name(self): - return self.__previousstate_conditionset_item_name.property.value + _returnvalue = None if self.__previousstate_conditionset_item_name is None else self.__previousstate_conditionset_item_name.property.value + return _returnvalue @property def ab_alive(self):