temperature_store: Add configparser support

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-08-05 21:08:11 -04:00
parent 470cc13b0e
commit 0abfc76871
1 changed files with 5 additions and 5 deletions

View File

@ -11,8 +11,8 @@ TEMPERATURE_UPDATE_MS = 1000
TEMPERATURE_STORE_SIZE = 20 * 60 TEMPERATURE_STORE_SIZE = 20 * 60
class TemperatureStore: class TemperatureStore:
def __init__(self, server): def __init__(self, config):
self.server = server self.server = config.get_server()
# Temperature Store Tracking # Temperature Store Tracking
self.last_temps = {} self.last_temps = {}
@ -51,7 +51,7 @@ class TemperatureStore:
"objects/subscription", 'POST', sub) "objects/subscription", 'POST', sub)
result = await request.wait() result = await request.wait()
if isinstance(result, self.server.error): if isinstance(result, self.server.error):
logging.info("Error subscribing to sensors: %s" %(str(result))) logging.info("Error subscribing to sensors: %s" % (str(result)))
return return
logging.info("Configuring available sensors: %s" % (str(sensors))) logging.info("Configuring available sensors: %s" % (str(sensors)))
new_store = {} new_store = {}
@ -98,5 +98,5 @@ class TemperatureStore:
async def close(self): async def close(self):
self.temp_update_cb.stop() self.temp_update_cb.stop()
def load_plugin(server): def load_plugin(config):
return TemperatureStore(server) return TemperatureStore(config)