diff --git a/pyheatpump/cli.py b/pyheatpump/cli.py index 792aa67..7ec99bb 100644 --- a/pyheatpump/cli.py +++ b/pyheatpump/cli.py @@ -183,12 +183,12 @@ def supervise(since): logger.debug(h.__dict__()) - post_req = requests.post( + post_resp = requests.post( url=build_url(post_url), json=h.__dict__(), verify=False ) - if post_req.status_code == 200: + if post_resp.status_code == 200: logger.info('POST to supervisor succeeded') get_path = '/'.join(( @@ -200,7 +200,14 @@ def supervise(since): **{'path': get_path} } - get_req = requests.get( + get_resp = requests.get( url=build_url(get_url), verify=False ) + + control_data = get_resp.json() + if h.control(control_data): + commit() + logger.info('GET to supervisor succeded : updated values') + else: + logger.warn('Unable to set data from supervisor\n{}'.format(control_data))