The purpleair device on my local network will return a JSON dump of current state over http at the /json
endpoint. Having a local polling integration would be a great addition to the cloud-based purpleair integration already provided.
I was able to simulate this using the REST integration. It works pretty well, though it would be nice to have real support. As a bonus, you can read the AQI values from the sensor, not available via the API.
rest:
- resource: http://purpleair.lan/json?live=true
sensor:
- name: "PM1.0 Ch A"
value_template: "{{ value_json['pm1_0_atm'] }}"
device_class: pm1
unit_of_measurement: "µg/m³"
- name: "PM1.0 Ch B"
value_template: "{{ value_json['pm1_0_atm_b'] }}"
device_class: pm1
unit_of_measurement: "µg/m³"
- name: "PM2.5 Ch A"
value_template: "{{ value_json['pm2_5_atm'] }}"
device_class: pm25
unit_of_measurement: "µg/m³"
- name: "PM2.5 Ch B"
value_template: "{{ value_json['pm2_5_atm_b'] }}"
device_class: pm25
unit_of_measurement: "µg/m³"
- name: "PM10 Ch A"
value_template: "{{ value_json['pm10_0_atm'] }}"
device_class: pm10
unit_of_measurement: "µg/m³"
- name: "PM10 Ch B"
value_template: "{{ value_json['pm10_0_atm_b'] }}"
device_class: pm10
unit_of_measurement: "µg/m³"
- name: "PM2.5 AQI Ch A"
value_template: "{{ value_json['pm2.5_aqi'] }}"
device_class: aqi
state_class: measurement
- name: "PM2.5 AQI Ch B"
value_template: "{{ value_json['pm2.5_aqi_b'] }}"
device_class: aqi
state_class: measurement
This is awesome. Exactly what I needed. Thanks! Works great with latest PurpleAir as of 2023-06.
Have you seen this set of instructions:
https://www.reddit.com/r/homeassistant/comments/tbhdvb/tutorial_complete_detailed_purpleair_integration/
I’ve been using it for over a year now with a PA-II-Flex outdoor locally and it’s been great.
awesome, thanks for sharing.
after this hacs component (GitHub - catchdave/home-assistant-purpleair: PurpleAir Integration (local network access only)) stopped working a couple of weeks ago, this was an easy replacement to see local purpleair values without cloud API calls.
I forked the catchdave repo and made a few commits to support HA 2025.1, removing all the warnings, adding temperatures in celsius and it’s working pretty good on my end. Feel free to install it using HACS, and collaborate if you think it can be improved!
Thanks for doing this. For me at least, your updated integration now loads, in 2025.1, which is an improvement, but it’s not pulling any sensor data - all entities are “unavailable.” Did you experience anything like that? thanks -
I also have a fork from a while ago which i just updated to work in 2025.1 GitHub - ryushi32/home-assistant-purpleair: PurpleAir Integration (local network access only) all of the entities should be correct now.
Great thanks for doing this, I burned through 2 million “points” in a month using the default web-only plugin.
I don’t know what is involved in putting custom plugins up on HACS, but would that be possible?