diff --git a/config.py b/config.py index d002e3f..d69bb80 100644 --- a/config.py +++ b/config.py @@ -6,16 +6,16 @@ debug_output = False bind_ip = "0.0.0.0" api_port = 5000 redis_port = 6379 -enable_redis = False +enable_redis = True # --- This will store friendly names for MAC addresses ----------------- comment_lookup = [ { - "mac": "A4:C1:38:00:11:10", - "comment": "Living Room" + "mac": "A4:C1:38:11:F4:2A", + "comment": "Sensor 0" }, { - "mac": "A4:C1:38:00:11:11", - "comment": "Main Bedroom" + "mac": "A4:C1:38:D7:8D:26", + "comment": "Sensor 1" } ] \ No newline at end of file diff --git a/scanner.py b/scanner.py index 536c86f..b45fc5b 100644 --- a/scanner.py +++ b/scanner.py @@ -61,7 +61,7 @@ def update_cache() -> None: sensor_data = sensor_data_query(new_macs) print(sensor_data) except Exception as e: - print(f"Aww fuck, no data :(- {e}") + print(f"Aww fuck, no data :( - {e}") # now we update the data in the sensor objects for sensor_datum in sensor_data: print(f"MAC - {sensor_datum['name']} | temp - {sensor_datum['temp']} | humidity - {sensor_datum['humidity']}") diff --git a/sensors.py b/sensors.py index d1091b8..2fcba38 100644 --- a/sensors.py +++ b/sensors.py @@ -81,6 +81,9 @@ class Sensor: self.first_seen = ts self.last_seen = ts self.comment = self.name + for sensor in comment_lookup: + if sensor['mac'] == self.name: + self.comment = sensor['comment'] # ----------------------------------------------------------------------- # # Core API