20 lines
509 B
Python
20 lines
509 B
Python
|
|
import redis
|
|
import json
|
|
from config import *
|
|
|
|
####################################################
|
|
### Redis Functions
|
|
####################################################
|
|
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
|
|
|