From e41f986b031e9ee5492c41f07d8c623af92fc611 Mon Sep 17 00:00:00 2001 From: DavidFW1960 <36390762+DavidFW1960@users.noreply.github.com> Date: Sun, 24 Nov 2019 14:44:03 +1100 Subject: [PATCH] fix for multiple fire zones --- custom_components/bom_forecast/sensor.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/custom_components/bom_forecast/sensor.py b/custom_components/bom_forecast/sensor.py index e702f79..0266388 100644 --- a/custom_components/bom_forecast/sensor.py +++ b/custom_components/bom_forecast/sensor.py @@ -436,8 +436,13 @@ def get_reading(self, condition, index): fire_danger_data = self._data.find(_FIND_QUERY_4.format(index)) _LOGGER.debug("fire_danger_data = %s", fire_danger_data) if fire_danger_data is not None: - fire_danger = fire_danger_data.text - _LOGGER.debug("fire_danger = %s", fire_danger) + fire_danger = fire_danger_data.text.strip() + if fire_danger == '': + # Check if there are sub-tags. + fire_danger_data_paragraphs = fire_danger_data.findall("./p") + if fire_danger_data_paragraphs is not None: + paragraphs = [paragraph.text for paragraph in fire_danger_data_paragraphs] + return ", ".join(paragraphs) return fire_danger else: _LOGGER.debug("not City")