commit a50be9a2ffd86052eee424012fa7ef90076d16f7 from: mischa date: Sun Nov 17 12:06:10 2019 UTC check for non-existent temperature commit - 8742d1e32a857518c5be6e06eb53d21025654f3d commit + a50be9a2ffd86052eee424012fa7ef90076d16f7 blob - 2af898299dfd162483972368bcef449750472ea6 blob + 9026d575a89b80d7688d6b41d412a897968e1601 --- temperature.py +++ temperature.py @@ -62,7 +62,10 @@ for key in sensors: name = json_data.get(i)['name'] if json_data.get(i)['type'] == 'ZLLTemperature': 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: print (f"{name:<32s} - {temperature:>4}C (updated: {updated} UTC)") elif debug: