comment var test 1
This commit is contained in:
1 parent
77de5f007e
commit
4dd9a73cbb
3 files changed
+9
-6
No files matched your search
@@ -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"
|
||||
}
|
||||
]
|
||||
+1
-1
@@ -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']}")
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user