Skip to content

Instantly share code, notes, and snippets.

@naotaco
Created March 25, 2015 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naotaco/792cca57f6d437158e43 to your computer and use it in GitHub Desktop.
Save naotaco/792cca57f6d437158e43 to your computer and use it in GitHub Desktop.
reading setpoint from Redis DB
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