From 6a1f23228ad24b55f7d105f367d6f868bd029658 Mon Sep 17 00:00:00 2001 From: Carsten Schmiemann Date: Fri, 19 Aug 2022 23:14:50 +0200 Subject: [PATCH] temperature: Modify logging and device temp --- README.md | 2 +- dbus-node-red-temp-outside/temp_outside.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index dbc32f3..a4aff56 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ it means that the service is still running or another service is using that bus ### Loggings -My scripts generate a logfile in working directory which you can check, every 10 min there will be a Sign Of Life message, with actual values and so on. +My scripts generate a logfile in working directory which you can check, every 10 min there will be a status message, with actual values and so on. #### Restart the script diff --git a/dbus-node-red-temp-outside/temp_outside.py b/dbus-node-red-temp-outside/temp_outside.py index b2151b8..87446f8 100644 --- a/dbus-node-red-temp-outside/temp_outside.py +++ b/dbus-node-red-temp-outside/temp_outside.py @@ -33,7 +33,7 @@ class NodeRedMeterTemperature: # Create the mandatory objects self._dbusservice.add_path('/DeviceInstance', deviceinstance) - self._dbusservice.add_path('/ProductId', 41314) + self._dbusservice.add_path('/ProductId', 0xA162) #from dbus spy with wire attached sensor self._dbusservice.add_path('/FilterLength', 10) self._dbusservice.add_path('/Offset', 0) self._dbusservice.add_path('/Scale', 1) @@ -57,10 +57,10 @@ class NodeRedMeterTemperature: # add _update function 'timer' gobject.timeout_add(2000, self._update) # pause 2000ms before the next request - # add _signOfLife 'timer' to get feedback in log every 5minutes - gobject.timeout_add(self._getSignOfLifeInterval()*60*1000, self._signOfLife) + # add __Status 'timer' to get feedback in log every 5minutes + gobject.timeout_add(self._get_StatusInterval()*60*1000, self.__Status) - def _getSignOfLifeInterval(self): + def _get_StatusInterval(self): value = 1 if not value: @@ -86,11 +86,9 @@ class NodeRedMeterTemperature: return meter_data - def _signOfLife(self): - logging.info("--- Start: sign of life ---") - logging.info("Last _update() call: %s" % (self._lastUpdate)) + def __Status(self): + logging.info("Last _update: %s" % (self._lastUpdate)) logging.info("Last '/Temperature': %s" % (self._dbusservice['/Temperature'])) - logging.info("--- End: sign of life ---") return True def _update(self):