temperature: Modify logging and device temp
This commit is contained in:
parent
5bb8e776d2
commit
6a1f23228a
|
@ -71,7 +71,7 @@ it means that the service is still running or another service is using that bus
|
||||||
|
|
||||||
### Loggings
|
### 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
|
#### Restart the script
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class NodeRedMeterTemperature:
|
||||||
|
|
||||||
# Create the mandatory objects
|
# Create the mandatory objects
|
||||||
self._dbusservice.add_path('/DeviceInstance', deviceinstance)
|
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('/FilterLength', 10)
|
||||||
self._dbusservice.add_path('/Offset', 0)
|
self._dbusservice.add_path('/Offset', 0)
|
||||||
self._dbusservice.add_path('/Scale', 1)
|
self._dbusservice.add_path('/Scale', 1)
|
||||||
|
@ -57,10 +57,10 @@ class NodeRedMeterTemperature:
|
||||||
# add _update function 'timer'
|
# add _update function 'timer'
|
||||||
gobject.timeout_add(2000, self._update) # pause 2000ms before the next request
|
gobject.timeout_add(2000, self._update) # pause 2000ms before the next request
|
||||||
|
|
||||||
# add _signOfLife 'timer' to get feedback in log every 5minutes
|
# add __Status 'timer' to get feedback in log every 5minutes
|
||||||
gobject.timeout_add(self._getSignOfLifeInterval()*60*1000, self._signOfLife)
|
gobject.timeout_add(self._get_StatusInterval()*60*1000, self.__Status)
|
||||||
|
|
||||||
def _getSignOfLifeInterval(self):
|
def _get_StatusInterval(self):
|
||||||
value = 1
|
value = 1
|
||||||
|
|
||||||
if not value:
|
if not value:
|
||||||
|
@ -86,11 +86,9 @@ class NodeRedMeterTemperature:
|
||||||
return meter_data
|
return meter_data
|
||||||
|
|
||||||
|
|
||||||
def _signOfLife(self):
|
def __Status(self):
|
||||||
logging.info("--- Start: sign of life ---")
|
logging.info("Last _update: %s" % (self._lastUpdate))
|
||||||
logging.info("Last _update() call: %s" % (self._lastUpdate))
|
|
||||||
logging.info("Last '/Temperature': %s" % (self._dbusservice['/Temperature']))
|
logging.info("Last '/Temperature': %s" % (self._dbusservice['/Temperature']))
|
||||||
logging.info("--- End: sign of life ---")
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _update(self):
|
def _update(self):
|
||||||
|
|
Loading…
Reference in New Issue