Created
March 25, 2015 15:35
-
-
Save naotaco/792cca57f6d437158e43 to your computer and use it in GitHub Desktop.
reading setpoint from Redis DB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis | |
redis_db = redis.Redis(host='127.0.0.1', port=6379, db=0) | |
new_setpoint = 0.0 | |
try: | |
new_setpoint = float(redis_db.get('cooker_target_temperature')) | |
except ValueError: | |
new_setpoint = 0.0 | |
if (new_setpoint > 0 and new_setpoint != setpoint): | |
print ("setpoint updated from " + str(setpoint) + " to " + str(new_setpoint)) | |
setpoint = new_setpoint |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment