There are many calculators already on the web which I’m sure could be utilized as a web service to do this without implementing the formula. Most only need to know the current µg/m3 as given by the API.
So I’m trying to get it going your way… Let me ask you, how did you mount the samba folder within hass.io? If you put it within the fstab inside the container, it will be overwritten whenever restarting, no? If you do it on the filesystem, you’d need to map it to the container… I tried to map it inside the share directory, but it wasn’t visible from inside the container.
Okay, so I finally got around to doing this and it works pretty well. A couple hints for anyone who wants to do it after me:
Latest versions of Ubuntu do not include CIFS (Samba) mount command by default, you must install it with the commands
apt update
apt install cifs-utils
Airvisual node requires v1 SMB, so make sure you include the argument for it in your fstab entry (mine wouldn’t mount without it). Here’s the syntax I used:
Also, I had no luck getting homeassistant to recognize the folder unless I mounted it using fstab, even if it was mounted correctly. Your mileage may vary, but this is what worked for me. The /etc/avnode.conf file (or whatever filename you want to use) containing the username and password looks like:
If you want to mount your airvisual directory into another folder than your config folder (such as your share folder in the example below), you will need to add this line to your configuration.yaml:
whitelist_external_dirs:
- /share
As I like using the AirVisual Card in lovelace, I also made a sensor to use for Air Pollution Level. It looks like this:
- platform: template
sensors:
home_air_pollution:
friendly_name: "Home Air Pollution Level"
value_template: >-
{% if states('sensor.home_air_quality')|float < 50 %}
Good
{% elif states('sensor.home_air_quality')|float < 100 and states('sensor.home_air_quality')|float >= 50 %}
Moderate
{% elif states('sensor.home_air_quality')|float < 150 and states('sensor.home_air_quality')|float >= 100 %}
Unh. Sens. Groups
{% elif states('sensor.home_air_quality')|float < 200 and states('sensor.home_air_quality')|float >= 150 %}
Unhealthy
{% elif states('sensor.home_air_quality')|float < 250 and states('sensor.home_air_quality')|float >= 200 %}
Very Unhealthy
{% elif states('sensor.home_air_quality')|float < 500 and states('sensor.home_air_quality')|float >= 250 %}
Hazardous
{% else %}
Off the Charts
{% endif %}
For the main_pollutant option I just use the one from the nearest public airvisual node, not from my node pro which doesn’t (and can’t) capture this.
Hi all. My wife and I recently bought a Pro Node, so I will be adding official support for it soon. There’s some work that needs to be done first (e.g., https://github.com/home-assistant/home-assistant/pull/32072), but wanted to drop you a line and let you know it’s on the way.
Cool! Look forward to testing it! TBH the SMB based template sensor is working very well, much better than I ever expected it to, but it will be a lot more practical for people to use a classical integration.
No doubt! The integration will use Samba, as well, but I wouldn’t have gotten the idea for wrapping that into an official integration without the work done here.
thanks for the support and development for airvisual ,
on Home Assistant 0.104.3
i sign to airvisual created an api key nothing special ,
follow the documentation i added to configuration file:
airvisual:
api_key: !secret airvisual_api
getting error:
2020-03-20 23:55:54 ERROR (MainThread) [homeassistant.setup] Setup failed for airvisual: No setup function defined.
Trying to get Airvisual to work. Homeassistant 0.107.7
Getting the following in the log.
Logger: homeassistant.components.airvisual
Error while retrieving data: city_not_found
On the Airvisual site I can see the calls to the api increment.
Tried with and without geographies: set same result both using a api key
Configuration.yaml
airvisual:
api_key: 24ecdedd-.........
# geographies:
# city: Bend
# state: Oregon
# country: USA
When I try the following with my key I get proper results.
curl --location --request GET 'api.airvisual.com/v2/city?city=Bend&state=Oregon&country=USA&key={24ecdedd-.........}'
Figured it out.
First time I had configured it incorrectly with the wrong city. For some reason when I corrected this it never changed in core.entity_registry
Steps to correct.
Hi bachya, I’m tracking your progress everyday and finally saw ‘Done’ yesterday. This would be crucial for my automations with purifier, based on AQI, and windows opening, based on CO2. Thank you very much for your efforts!
I’ve just updated to Home Assistant 0.110, and followed this guide:
To enable the integration and gather from a Node/Pro unit, add the following lines to your configuration.yaml file:
airvisual:
ip_address: YOUR_NODE_PRO_IP_ADDRESS
password: YOUR_NODE_PRO_SAMBA_PASSWORD
However, I got the error:
Invalid config for [airvisual]: [ip_address] is an invalid option for [airvisual]. Check: airvisual->airvisual->ip_address. (See /config/configuration.yaml, line 36).
Update: I can add the node Pro though Integrations section. Thank you