Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Commit

Permalink
Update sensor.py.work
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidFW1960 authored Nov 19, 2019
1 parent bb0d42d commit ae9a494
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions custom_components/bom_forecast/sensor.py.work
Original file line number Diff line number Diff line change
Expand Up @@ -392,17 +392,22 @@ class BOMForecastData:
detailed_summary = self._data.find(_FIND_QUERY.format(index, 'forecast')).text
return (detailed_summary[:251] + '...') if len(detailed_summary) > 251 else detailed_summary

if condition == 'uv_alert':
if PRODUCT_ID_LAT_LON_LOCATION[self._product_id][3] == 'City':
uv_alert_data = self._data.find(_FIND_QUERY_3.format(index)).text
if uv_alert_data:
uv_alert = self._data.find(_FIND_QUERY_3.format(index)).text
else:
uv_alert_data = self._data.find(_FIND_QUERY.format(index, 'uv_alert')).text
if uv_alert_data:
uv_alert = self._data.find(_FIND_QUERY.format(index, 'uv_alert')).text
return uv_alert

find_query = (_FIND_QUERY.format(index, SENSOR_TYPES[condition][0]))
state = self._data.find(find_query)

if condition == 'icon':
return ICON_MAPPING[state.text]
if condition == 'uv_alert':
uv_alert = self._data.find(_FIND_QUERY_3.format(index, 'uv_alert')).text
return uv_alert
if condition == 'fire_danger':
fire_danger = self._data.find(_FIND_QUERY_4.format(index, 'fire_danger')).text
return fire_danger
if state is None:
if condition == 'possible_rainfall':
return '0 mm'
Expand Down

0 comments on commit ae9a494

Please sign in to comment.