############# Air Visual Index USA ##############################
- platform: airvisual
api_key: secret
monitored_conditions:
- us
show_on_map: false
scan_interval: 210
latitude: 4x.xxxxx
longitude: -y.yyyy
up to version 0.95, it obtained three different data: index, level and main pollutant.
Since the update, the main pollutant data has disappeared.
This is the error message that appears
Sat Jun 29 2019 16:02:23 GMT+0200 (hora de verano de Europa central)
airvisual: Error on device update!
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 261, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 375, in async_device_update
await self.async_update()
File “/usr/src/homeassistant/homeassistant/components/airvisual/sensor.py”, line 244, in async_update
symbol = data[‘main{0}’.format(self._locale)]
KeyError: ‘mainus’
I had a look into it and found, that airvisual has removed data from the public api. Among other things “mainus” has been removed from the “pollution” element, which causes the error you have found.
Thanks for the information.
This change in airvisual policies steals good information from us.
We will have to wait for the developers to change the configuration.
In addition to updating the Air Visual integration, World Air Quality Index could be improved.
Its installation only adds one sensor, the Air Quality Index. However, you get a lot of other data, including the main pollutant.
It would be very interesting to have the option to add all those sensors in the configuration.
Has anyone created a template sensor with the state of the sensor.us_main_pollutant as an attribute. Templating could be used to pick what sensor to use for the state the new sensor has based on the value of sensor sensor.us_main_pollutant…
The sensor.pm_2_5um needs to already be in your config either via one of your own sensor or any other data provider. I use my own sensor, which is great for local pollution (plastic burning where i live). You then use the sensor.main_pollutant in the lovelace card.
Here is what it looks like in the frontend:
I may template to pick which sensor value should be used when I find time. At the same time, looking around the world in Air Visual, the main pollutant always seems to be PM2.5… Interested to know what others think on this?