redis test 4a
This commit is contained in:
1 parent
aaccbbe668
commit
0bd9f37f90
2 files changed
+21
-1
No files matched your search
@@ -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
|
||||||
|
|
||||||
+1
-1
@@ -8,7 +8,7 @@ from typing import Set, Iterable
|
|||||||
from config import *
|
from config import *
|
||||||
from sensors import *
|
from sensors import *
|
||||||
from ble import *
|
from ble import *
|
||||||
from ble-redis import *
|
from ble_redis import *
|
||||||
|
|
||||||
# In-memory cache + thread-safe lock
|
# In-memory cache + thread-safe lock
|
||||||
_mac_cache: Set[str] = set()
|
_mac_cache: Set[str] = set()
|
||||||
|
|||||||
Reference in new issue
Block a user