Skip to content

Commit

Permalink
Fix UNIT_SYSTEM not set necessarily since 0.94 (cytech#10)
Browse files Browse the repository at this point in the history
Since ~ 0.94 some basic attributes of the Homeassistant installation can be set via GUI. Until that is applied, a unit_system does not seem to be set causing home assistant as whole to crash.
  • Loading branch information
jmtatsch authored and cytech committed Aug 12, 2019
1 parent e7389e5 commit 4df537a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/wundergroundpws/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@
conf_file = config.get_default_config_dir() + '/configuration.yaml'
load_config = config.load_yaml_config_file(conf_file)

UNIT_SYSTEM = load_config['homeassistant']['unit_system']
try:
UNIT_SYSTEM = load_config['homeassistant']['unit_system']
except KeyError as err:
UNIT_SYSTEM = "metric"

if UNIT_SYSTEM == 'imperial':
TEMPUNIT = TEMP_FAHRENHEIT
Expand Down

0 comments on commit 4df537a

Please sign in to comment.