Limych / ha-iaquk

Indoor Air Quality Sensor Component for Home Assistant
MIT License
111 stars 16 forks source link

Radon #1

Closed jjanderson closed 4 years ago

jjanderson commented 4 years ago

Is your feature request related to a problem? Please describe.

No Issues, love the component and thanks for all your hard work on this

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like

Could you please add Radon (Bq/m3) as an optional sensor?

Radon, although excess exposure is limited to certain areas in the UK, is the 2nd largest cause of Lung Cancer after smoking with roughly 1,100 lung cancer deaths attributed to radon exposure in the home per year in the UK.

Thanks again for making this!

Limych commented 4 years ago

I wanted to add it, but I could not understand in what units the sensors usually return its value. Could you clarify this question for me?

Limych commented 4 years ago

I've created feauture branch for Radon. You can test it by installing this version manually on top of the original one. https://github.com/Limych/ha-iaquk/archive/feature/radon.zip

jjanderson commented 4 years ago

Hi,

I installed this branch, but not sure if this includes the bug for unknown values that I raised. I don't think it does as now I am getting at least one value reading as per the image. This does however seem to indicate that the Radon component is successfully coming through as Kitchen is where I have the radon sensor:

image

Here is my config.yaml entry:

iaquk:
  kitchen:
    name: "Kitchen"
    sources:
      temperature: sensor.kitchen_multisensor_temperature
      humidity: sensor.kitchen_multisensor_relative_humidity
      co2: sensor.airthings_co2
      tvoc: sensor.airthings_voc
      radon: sensor.airthings_short_term_radon
    sensors:
      - iaq_level
  finn:
    name: "Finn"
    sources:
      temperature: sensor.finn_bedroom_ave_temp
      humidity: sensor.finn_ave_humidity
      co2: sensor.netatmo_bedroom_co2
#      tvoc: sensor.finn_tvoc
    sensors:
      - iaq_level
  jake:
    name: "Jake"
    sources:
      temperature: sensor.jake_bedroom_ave_temp
      humidity: sensor.jake_ave_humidity
      co2: sensor.netatmo_jake_co2
#      tvoc: sensor.jake_tvoc
    sensors:
      - iaq_level
  lounge:
    name: "Lounge"
    sources:
      temperature: sensor.downstairs_thermostat_temperature
      humidity: sensor.downstairs_thermostat_humidity
#      co2: sensor.lounge_eco2
#      tvoc: sensor.lounge_tvoc
    sensors:
      - iaq_level
  bedroom:
    name: "Bedroom"
    sources:
      temperature: sensor.master_bedroom_ave_temp
      humidity: sensor.netatmo_bedroom_humidity
#      co2: sensor.bedroom_eco2
#      tvoc: sensor.bedroom_tvoc
    sensors:
      - iaq_level

Additionally, here are my entries for each of the active sensors for Finn's Room:

`sensor.finn_bedroom_ave_temp 19.77 count_sensors: 3 max_value: 20.6 mean: 19.77 min_value: 19.2 last: 20.6 unit_of_measurement: °C friendly_name: Finn Bedroom Ave Temp icon: mdi:thermometer custom_ui_state_card: state-card-custom-ui device_class: temperature`
`sensor.finn_ave_humidity 50.77 count_sensors: 3 max_value: 55.3 mean: 50.77 min_value: 43 last: 43 unit_of_measurement: % friendly_name: Finn Ave Humidity icon: mdi:water-percent custom_ui_state_card: state-card-custom-ui device_class: humidity`
`sensor.netatmo_bedroom_co2 407 unit_of_measurement: ppm friendly_name: netatmo Finn Room Bedroom CO2 icon: mdi:periodic-table-co2 custom_ui_state_card: state-card-custom-ui`

This is a reallly great component, thanks for making it... let me know if you need any more info or anything.

Thanks

jjanderson commented 4 years ago

sorry, just to add, here are my logs:

Thu Jan 30 2020 15:52:26 GMT+0000 (Greenwich Mean Time)
Error doing job: Exception in callback async_track_state_change.<locals>.state_change_listener(<Event state_...010778+00:00>>) at /usr/src/homeassistant/homeassistant/helpers/event.py:81
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 103, in state_change_listener
    event.data.get("new_state"),
  File "/usr/src/homeassistant/homeassistant/core.py", line 364, in async_run_job
    target(*args)
  File "/config/custom_components/iaquk/__init__.py", line 128, in sensor_state_listener
    self.update()
  File "/config/custom_components/iaquk/__init__.py", line 193, in update
    index = self.__getattribute__('_%s_index' % src)
  File "/config/custom_components/iaquk/__init__.py", line 332, in _tvoc_index
    value = self._get_number_state(entity_id, 'ppb')
  File "/config/custom_components/iaquk/__init__.py", line 226, in _get_number_state
    UNIT_NOT_RECOGNIZED_TEMPLATE.format(unit, "source sensor's"))
ValueError: ppm is not a recognized source sensor's unit.
jjanderson commented 4 years ago

image

So some are working and some not...

Let me know if you need any further sensor data. I think that this could possibly be due to the decimals? Not sure, but let me knw what other information you may need.

Thanks again for making this... We may have a requirement for some work to be done professionally at my work. I am a product manager for IoT at a UK Mobile Telco. Would this be something that you would be intereseted in working on?

jjanderson commented 4 years ago

Sorry, I also think that the logs would seem to indicate the custom component is giving the TVOC in ppm as opposed to ppb which is causing the issue in the log. Let me contact the owner of the other repo and see..

Limych commented 4 years ago

Yes, the reason is that different sensors give values in different units. I had to make it possible to automatically convert units. o:)

Test new version please ;)

jjanderson commented 4 years ago

Hi,

All seems to be great! Thanks for your help...

I suppose a feature request, when using multiple sources for determining Air Quality is to call out the problem readings if low air quality? (i.e Huidy High, VOC High etc)

Anyway, thanks again for your help

jjanderson commented 4 years ago

Radon readins now supplied

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.