Skip to content

Commit

Permalink
updated sensor.py
Browse files Browse the repository at this point in the history
correct icon issue PR cytech#30
  • Loading branch information
cytech authored Feb 11, 2021
1 parent d367c86 commit f8ed681
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions custom_components/wundergroundpws/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@
conf_file = config.get_default_config_dir() + '/configuration.yaml'
load_config = config.load_yaml_config_file(conf_file)

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

if UNIT_SYSTEM == 'imperial':
TEMPUNIT = TEMP_FAHRENHEIT
Expand Down Expand Up @@ -174,7 +171,7 @@ def __init__(self, friendly_name, period, field,
feature='forecast',
value=(lambda wu: wu.data['daypart'][0][field][period]),
unit_of_measurement=ha_unit,
entity_picture=lambda wu: wu.data['daypart'][0]['iconCode'][period] if not icon else None,
entity_picture=lambda wu: str(wu.data['daypart'][0]['iconCode'][period]) if not icon else None,
icon=icon,
device_state_attributes={
'date': lambda wu: wu.data['observations'][0]['obsTimeLocal']
Expand Down

0 comments on commit f8ed681

Please sign in to comment.