temperature: Modify logging and device temp

This commit is contained in:
Carsten Schmiemann 2022-08-19 23:14:50 +02:00
parent 5bb8e776d2
commit 6a1f23228a
2 changed files with 7 additions and 9 deletions

View File

@ -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

View File

@ -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):