Support for AirVisual's Outdoor Unit?

Was wondering if there was any support for the AirVisual Outdoor unit? AirVisual Series I don’t see that the current integration pulls any other information from the Pro unit that the indoor information, and I don’t see an option to include more than the one unit.

Thanks

It would would be great to see integration of the Outdoor unit.
At the moment I’m trying to get the info from the published data via API, but that’s also not yet working for me.

edit 12-12-2022: via online API is working. But I only get Air Quality Index. I really would love to get the temperature/humidity/pressure data.
I reached out to AirVisual, but it seems not possible to acquire this data from the unit directly.

just ordered Outdoor unit, so there is no way to get the particulate value in HA ?

It seems so. I really hope some one can reverse engineer the Outdoor unit so the data can be acquired by HA.
It’s a shame that the Outdoor unit cannot be reached like the indoor unit…

The outdoor unit seems perfect, PoE powered and hardwired for data! Does anyone know if the new AirVisual Pro integration would pick up the data if we used the Pro+Outdoor combo? Maybe @bachya knows as the author of the integration? :pray:

(My hope is that the samba data on the Pro unit includes data from the Outdoor one…)

1 Like

Not sure how I missed that thread, thank you! Doesn’t seem clear if outdoor unit has Samba or not, so maybe I will take the chance.

Hi All - Did anyone ever get this to work? I have an outdoor unit, but not an indoor pro unit.

It is my understanding that the indoor pro unit has the ability to show on its LCD screen the outdoor unit’s values. If this is correct - then does it mean that if you setup the HA integration with the Indoor Pro unit AND you have an outdoor unit, that you can then show the outdoor unit’s data in HA?

If I buy an indoor unit too will it fix my problem?

Is the SAMBA password for the outdoor unit printed somewhere on the unit itself?

The Indoor unit reads the Outdoor unit and makes some of the information available in its own history files. That means that if someone owns both units, they can read the AQI from the outside unit with the inside one.

Once I figured out that was possible I made a pull request to add support to the integration for using this, and that PR was merged in today. The good news is that this sensor will show up for people with both units after the next release.

The bad news is that this is only a subset of data, and not everyone owns both units. The only way to get all of the data off of the outdoor unit is via the SMB share, but there’s no way to get that password. Everyone who owns one of these units should contact IQAir and ask them to make this password retrievable from their app.

3 Likes

Thanks for doing this! I managed to get the Outdoor AQI from the updated integration. But… yeah, it would be nice to get the other data.

There is an integration to access the rest API, AirVisual Cloud - Home Assistant, and I have installed that. But among other issues you have to get a new key annually. It also does not give detailed data, just the AQI, the pollution “level” (e.g. Good) and the main pollutant (but not the amount), so not much more than the above.

For local access to raw data I see two possibilities: 1. get a SAMBA key for direct access to the device (or whatever, it may or may not be using SAMBA) e.g. from the app or from the Pro’s display 2. ask AirIQ to mirror all the data on the Pro.

I think 2 would be a straightforward extension and would work fine, but AirIQ has to do it (I have done my duty by sending a request, for either of these options; 2 would also not require exposing a second password). As for 1: We just need the password. SAMBA is not an especially secure protocol… but that seems like a last resort.

There is another “device” API with share codes etc. available via the AirIQ dashboard. Unlike the API used by the above “cloud” integration, this does seem to give actual device data. The dashboard is here: https://dashboard.iqair.com/

Update: device API apparently available to corporate or enterprise plans only. Ugh. It’s my device, I should be able to access my own data…

1 Like

Update: device API apparently available to corporate or enterprise plans only. Ugh. It’s my device, I should be able to access my own data…

Agreed, though it’s worth noting that it isn’t strictly true that it requires the corporate or enterprise plans. It also is available is enableable on the free individual API tier if you publish your station publicly. Not a solution for everyone, and still has the worrying possibility of stopping working at the company’s whims (or insolvency), but should be quite viable to use the API for an integration?

Ex. using my device I just set up yesterday: https://device.iqair.com/v2/66d0c0be00e30446e1750a4e

But I take it then nobody has made an integration that uses these API endpoints? Dunno if I’ll get around to it quickly, since i’ve never done any such thing with Home Assistant and for practical purposes it’s kindof fine that the AirVisual Cloud integration only does AQI despite that I’d prefer PM2.5 specifically, but if nobody else has I will probably eventually scratch this itch . . .

1 Like

Following up on this, since I have an AirVisual Pro indoors, and an AirVisual Outdoor on the outside of my house – I used the REST integration to pull data from this device.iqair.com endpoint, and it works quite well. As far as I can tell, the device.iqair.com domain is only ever referenced in this thread – they don’t list it as a public API, except in the bottom-right corner of the device details page off of https://dashboard.iqair.com/ :
Screenshot 2024-11-10 at 11.54.54 PM

It’s rate-limited to 30 requests per hour per IP (possibly more if you provided an API key, but one isn’t necessary, as long as the station is public). Using this API endpoint gives a significantly more accurate and up-to-date feed than the other options. In the graph below:

The AirVisual Pro line has odd drop-outs, and seems to lag slightly, and the granularity of the AirVisual Cloud data leaves something to be desired. I suspect the AirVisual Cloud data is doing a bunch of averaging with their models and other sensors in the area.

Here’s the YAML configuration I’m using:

rest:
  - scan_interval: 120
    # Replace the following line with the "Device API" URL from the bottom-right of the device page from https://dashboard.iqair.com/
    resource: https://device.iqair.com/v2/12345
    sensor:
      - name: "Outdoor AQI"
        value_template: "{{ value_json.current.aqius }}"
        device_class: aqi
      - name: "Outdoor humidity"
        value_template: "{{ value_json.current.hm }}"
        device_class: humidity
      - name: "Outdoor temperature"
        value_template: "{{ value_json.current.tp }}"
        device_class: temperature
        unit_of_measurement: "°C"
      - name: "Outdoor pressure"
        value_template: "{{ value_json.current.pr }}"
        device_class: pressure
        unit_of_measurement: Pa
      - name: "Outdoor pm25"
        value_template: "{{ value_json.current.pm25.conc }}"
        device_class: pm25
      - name: "Outdoor pm10"
        value_template: "{{ value_json.current.pm10.conc }}"
        device_class: pm10
      - name: "Outdoor pm1"
        value_template: "{{ value_json.current.pm1.conc }}"
        device_class: pm1
2 Likes

Dug into the Airvisual Pro Outdoor a bit, it shares a lot of firmware similarities with the indoor one, but they are different and samba support has been intentionally built out of the firmware. Not really sure why they made that choice. It is possible to bring it back. The most difficult issue is that it doesn’t produce the “latest_config_measurements.json” but most of that file can be generated from _AirVisual_values.txt file as well as other source.

I put together a gist that:

  • Adds the airvisual samba user with a supplied password
  • Installs the samba start script so it starts on boot
  • Installs a script to start on boot that periodically generates the latest_config_measurements.json file
  • Starts both

I of course cannot guarantee that this script will not brick your avpro, but it has a large number of prechecks to make sure things are sane.

A few other notes. The Airvisual pro indoor samba password set by the factory is generated by the mac address. Both units connect to a bootstrap server to obtain a root certificate, MQTT server certificate, and MQTT server address based on their model and serial number. If you replace this bootstrap server, you can have it connect to your own TLS MQTT server.

1 Like

MicroSD card? The AirVisual Outdoor has a card slot? I didn’t notice one when I set mine up.

I see a MicroUSB port between the indicator light and the Ethernet port – right next to the little black “control button” that puts the device into pairing mode. I have a MicroUSB storage device… but its shape is such that it pushes in that button when you try to connect it to the port. I might could find an adapter or something to fit these together without pressing the button, but that’s getting a little janky.

Assuming that’s what you mean… is there no other way in? What about the USB port on the inside where one is meant to plug in a 4G cellular radio for remote stations: can it read from that? I could give it a try if I bring the device down from its mounting plate.

Thank you for this; it looks very promising. I tried to ask IQAir for support with accessing the data from my own AVO over my own network instead of their very limited public API but they simply refused to acknowledge the question.

Ha! Okay, I’m a dumb. It does indeed have an undocumented MicroSD card slot, directly above the Ethernet port – but hidden under the removable vent cover panel.

It isn’t mentioned in the manual, but it is drawn on a schematic view of the device with its vent cover panel removed for sensor installation.

Out of pure curiosity, how did you learn these things will read from the MicroSD slot in this particular way?

Edit: My device did read and execute the script, but it bailed when it found /opt/app/disk/S91smb does not exist. This raises additional questions about why mine would be different. I purchased and installed it in June 2023, and it displays firmware version 2.0.413.

I don’t know what its whole file system looks like. I might have to hack at the script a little to get it to output some more information to the log file about what’s already there. Would be nice to just have a shell so I don’t have to shlep out there sneakernetting the script and its log on an itty bitty flake that really wants to get lost in my garden, but we’ll see. :slight_smile:

Edit 2: Well, that was a learning experience.

I kept a list of all the errata that stopped the script from making it to the end on my device:

  • /opt/app/disk/S91smb did not exist; fabricating a primitive one similar to the vendor default was sufficient.
  • /etc/samba/smb.conf had unexpected content: the netbios name of the device had already been set to AVISUAL-<serial>; note the name is written AVISUAL instead of AIRVISUAL.
  • The airvisual user and group already existed as uid/gid 1003.

The script does complete successfully if one accounts for these differences.

I’m also this close to getting SSH access to work but ugh I hate busybox so much and its quirky little syntax variations. Of course it won’t take a password string from stdin. Of course installing an SSH public key in the typical location isn’t sufficient. Off-topic, I know. Rant concluded. Anyway.

Once I moved on from there, I noticed a discrepancy in the HA integration. For some reason, the integration reports particulate matter concentrations for 0.1, 1, and 2.5 microns. The actual device, however – and this is true of both the AirVisual Pro (Indoor) and AirVisual Outdoor – measures the concentrations for 1, 2.5, and 10 microns. I own both, so I am able to confirm this is consistent throughout the IQAir product documentation, the data written to the AirVisual Pro’s storage, and the data displayed on my IQAir account dashboard.

See what happened?

Yeah. Someone moved a decimal.

The AirVisual Pro actually records the measurements under the keys pm01_ugm3, pm10_ugm3, and pm25_ugm3. Obviously this is not the most consistent possible way for the product to name its measurement keys; if you assume the decimal is in the same position for all three, you get the wrong answer. Measurement of 0.1 micron particle sizes is impractical for these devices, and it is not considered part of standard AQI reporting methods.

It’s not so big a deal because the entity with the 0.1 micron particle size can be renamed, but someone who does not know this fact about air quality measurements will be misled.

Since the HA integration is just Python, I can probably fix all this up myself in a weekend and contribute a fix for the mislabeled metric, but I anticipate someone is going to scratch their head and wonder why I’m trying to move a decimal point in one weird place.

Ahhh… stay tuned.

Edit 3: The AirVisual Outdoor contains a barometric pressure sensor. The script here does obtain that measurement, but the HA integration does not use it. I will have to add that in a separate pull request and try to justify its inclusion.

If you open up the device, it has a fairly easily accessible serial port that gives u-boot access. From there you can learn pretty much anything you want about the device. My device was ordered Oct 2023, the smb script seems like it might be a backup from an older firmware version that still ran samba. I tried to be as conservative as possible with the script. I’ll update it with the proper smb script.

1 Like