Skip to content

Commit

Permalink
Merge branch 'release/v1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed Apr 22, 2020
2 parents 2677376 + e7406ad commit 9eee59f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ You can create as many groups as you need. But each group must have an unique na
> Room Formaldehyde (HCHO; CH<sub>2</sub>O) sensor entity ID.\
> Required sensor's unit of measurement: ppm, ppb, mg/m<sup>3</sup> or µg/m<sup>3</sup>
>
> **radon**:\
> _(string) (Optional)_\
> Room Radon (Rn) sensor entity ID.\
> Required sensor's unit of measurement: Bq/m<sup>3</sup>
>
> **pm**:\
> _(string | list) (Optional)_\
> Room particulate matter sensors entity IDs.\
Expand Down
31 changes: 28 additions & 3 deletions custom_components/iaquk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
from .const import DOMAIN, VERSION, ISSUE_URL, SUPPORT_LIB_URL, CONF_SOURCES, \
DATA_IAQUK, CONF_CO2, CONF_TEMPERATURE, CONF_HUMIDITY, CONF_TVOC, \
LEVEL_INADEQUATE, LEVEL_POOR, LEVEL_FAIR, LEVEL_GOOD, LEVEL_EXCELLENT, \
CONF_NO2, CONF_PM, CONF_CO, CONF_HCHO, UNIT_PPM, UNIT_PPB, UNIT_UGM3, \
ATTR_SOURCES_USED, ATTR_SOURCES_SET, MWEIGTH_TVOC, MWEIGTH_HCHO, \
MWEIGTH_CO, MWEIGTH_NO2, MWEIGTH_CO2
CONF_NO2, CONF_PM, CONF_CO, CONF_HCHO, CONF_RADON, UNIT_PPM, UNIT_PPB, \
UNIT_UGM3, UNIT_MGM3, ATTR_SOURCES_USED, ATTR_SOURCES_SET, MWEIGTH_TVOC, \
MWEIGTH_HCHO, MWEIGTH_CO, MWEIGTH_NO2, MWEIGTH_CO2
from .sensor import SENSORS

_LOGGER = logging.getLogger(__name__)
Expand All @@ -38,6 +38,7 @@
CONF_NO2,
CONF_TVOC,
CONF_HCHO,
CONF_RADON,
CONF_PM,
]

Expand Down Expand Up @@ -489,3 +490,27 @@ def _hcho_index(self) -> Optional[int]:
elif value <= 240: # ppb
index = 2
return index

@property
def _radon_index(self):
"""Transform indoor Radon (Rn) values to IAQ points according
to Indoor Air Quality UK: http://www.iaquk.org.uk/ """
entity_id = self._sources.get(CONF_RADON)

if entity_id is None:
return None

value = self._get_number_state(entity_id, 'Bq/m3')
if value is None:
return None

# _LOGGER.debug('[%s] Radon=%s', self._entity_id, value)

index = 1
if value == 0: # Bq/m3
index = 5
elif value <= 20: # Bq/m3
index = 3
elif value <= 100: # Bq/m3
index = 2
return index
3 changes: 2 additions & 1 deletion custom_components/iaquk/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Base component constants
DOMAIN = "iaquk"
VERSION = "1.2.1"
VERSION = "1.3.0"
ISSUE_URL = "https://github.com/Limych/ha-iaquk/issues"
ATTRIBUTION = None
DATA_IAQUK = 'iaquk'
Expand All @@ -18,6 +18,7 @@
CONF_NO2 = "no2"
CONF_CO = "co"
CONF_HCHO = "hcho" # Formaldehyde
CONF_RADON = "radon"

ATTR_SOURCES_SET = 'sources_set'
ATTR_SOURCES_USED = 'sources_used'
Expand Down
2 changes: 1 addition & 1 deletion tracker.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"iaquk": {
"version": "1.2.1",
"version": "1.3.0",
"local_location": "/custom_components/iaquk/__init__.py",
"remote_location": "https://raw.githubusercontent.com/Limych/ha-iaquk/master/custom_components/iaquk/__init__.py",
"visit_repo": "https://github.com/Limych/ha-iaquk",
Expand Down

0 comments on commit 9eee59f

Please sign in to comment.