forked from Krautspace/doorstatus
statusd.py: add logging messages to change_status()
This commit is contained in:
parent
22f3d4e75b
commit
4c77e6b820
1 changed files with 4 additions and 0 deletions
|
@ -118,7 +118,9 @@ def change_status(raw_data, api):
|
|||
if data != False:
|
||||
status, timestamp = set_values(raw_data)
|
||||
if os.access(api, os.W_OK):
|
||||
logging.debug('API file is writable')
|
||||
with open(api, 'w') as api_file:
|
||||
logging.debug('API file open successfull')
|
||||
for line in data.splitlines():
|
||||
if line.strip().startswith('"state":'):
|
||||
edit = True
|
||||
|
@ -134,6 +136,8 @@ def change_status(raw_data, api):
|
|||
logging.error('Failed to write line to API file')
|
||||
logging.error('Line: {}'.format(line))
|
||||
logging.error('{}'.format(e))
|
||||
logging.error('Failed to open API file')
|
||||
logging.error('API file is not writable. No permissions?')
|
||||
logging.info('Status successfull changed to {}'.format(status))
|
||||
return True
|
||||
return False
|
||||
|
|
Loading…
Reference in a new issue