Stop UpdateIndex if there is an error

This commit is contained in:
Carsten Schmiemann 2023-07-16 13:14:29 +02:00
parent 4897387ab0
commit 0771aacf20
1 changed files with 5 additions and 4 deletions

View File

@ -142,10 +142,11 @@ class NodeRedGridMeter:
logging.debug("---");
# increment UpdateIndex - to show that new data is available
index = self._dbusservice['/UpdateIndex'] + 1 # increment index
if index > 255: # maximum value of the index
index = 0 # overflow from 255 to 0
self._dbusservice['/UpdateIndex'] = index
if self._dbusservice['/Connected'] == 1 :
index = self._dbusservice['/UpdateIndex'] + 1 # increment index
if index > 255: # maximum value of the index
index = 0 # overflow from 255 to 0
self._dbusservice['/UpdateIndex'] = index
#update lastupdate vars
self._lastUpdate = time.time()