check for non-existent temperature
This commit is contained in:
parent
8742d1e32a
commit
a50be9a2ff
|
@ -62,7 +62,10 @@ for key in sensors:
|
||||||
name = json_data.get(i)['name']
|
name = json_data.get(i)['name']
|
||||||
if json_data.get(i)['type'] == 'ZLLTemperature':
|
if json_data.get(i)['type'] == 'ZLLTemperature':
|
||||||
updated = json_data.get(i)['state']['lastupdated'][-8:]
|
updated = json_data.get(i)['state']['lastupdated'][-8:]
|
||||||
temperature = round((json_data.get(i)['state']['temperature'] / 100), 1)
|
if json_data.get(i)['state']['temperature']:
|
||||||
|
temperature = round((json_data.get(i)['state']['temperature'] / 100), 1)
|
||||||
|
else:
|
||||||
|
temperature = 0
|
||||||
if verbose:
|
if verbose:
|
||||||
print (f"{name:<32s} - {temperature:>4}C (updated: {updated} UTC)")
|
print (f"{name:<32s} - {temperature:>4}C (updated: {updated} UTC)")
|
||||||
elif debug:
|
elif debug:
|
||||||
|
|
Loading…
Reference in New Issue