From 0bd9f37f9053aa51cfad26fa398490f57bc965ac Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 13 Oct 2026 02:48:37 -0700 Subject: [PATCH] redis test 4a --- ble_redis.py | 20 ++++++++++++++++++++ scanner.py | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 ble_redis.py diff --git a/ble_redis.py b/ble_redis.py new file mode 100644 index 0000000..45de8fe --- /dev/null +++ b/ble_redis.py @@ -0,0 +1,20 @@ + +import redis +import json +from config import * + +#################################################### +### Redis Functions +#################################################### +if enable_redis: + r = redis.Redis(host=bind_ip, port=redis_port) + +def update_redis(data): + # push data to redis + # Publish to the Redis channel that the WS server is listening on + r.publish('temp_hum', json.dumps(data)) + if debug_output: + print("=== Stats Redis Update ===") + print(json.dumps(data, indent=2)) + return True + diff --git a/scanner.py b/scanner.py index 048a55f..70567bc 100644 --- a/scanner.py +++ b/scanner.py @@ -8,7 +8,7 @@ from typing import Set, Iterable from config import * from sensors import * from ble import * -from ble-redis import * +from ble_redis import * # In-memory cache + thread-safe lock _mac_cache: Set[str] = set()