Skip to content

Commit

Permalink
Add number of dominant pollens
Browse files Browse the repository at this point in the history
  • Loading branch information
amaximus committed May 2, 2023
1 parent 5bb6801 commit 0b31ad9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion custom_components/pollen_hu/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Pollen Information Hungary",
"documentation": "https://github.com/amaximus/pollen_hu",
"issue_tracker": "https://github.com/amaximus/pollen_hu/issues",
"version": "0.1.0",
"version": "0.2.0",
"dependencies": [],
"codeowners": ["@amaximus"],
"iot_class": "cloud_polling",
Expand Down
5 changes: 4 additions & 1 deletion custom_components/pollen_hu/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, hass, name, alldominant):
@property
def extra_state_attributes(self):
attr = {}
dominant_value = 0
dominant_value = -1

if 'pollens' in self._pdata:
attr["pollens"] = self._pdata.get('pollens')
Expand All @@ -90,11 +90,14 @@ def extra_state_attributes(self):
attr["dominant_pollen_value"] = int(val)
attr["dominant_pollen"] = item.get('name')
dominant_value = int(val)
attr["dominant_pollens_nr"] = 1
elif int(val) == dominant_value and self._alldominant:
if 'dominant_pollen' in attr:
attr["dominant_pollen"] = attr["dominant_pollen"] + "|" + item.get('name')
attr["dominant_pollens_nr"] = attr["dominant_pollens_nr"] + 1
else:
attr["dominant_pollen"] = item.get('name')
attr["dominant_pollens_nr"] = 1
attr["dominant_pollen_value"] = int(val)
dominant_value = int(val)

Expand Down
4 changes: 2 additions & 2 deletions tracker.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"pollen_hu": {
"version": "0.1.0",
"version": "0.2.0",
"updated_at": "2023-05-01",
"visit_repo": "https://github.com/amaximus/pollen_hu",
"changelog": "https://github.com/amaximus/pollen_hu/releases/0.1.0"
"changelog": "https://github.com/amaximus/pollen_hu/releases/0.2.0"
}
}

0 comments on commit 0b31ad9

Please sign in to comment.