Page 1 of 2
Purpleair sensor integration - need help. **solved**
Posted: Thu Nov 26, 2020 10:40 pm
by admin
As far as I could find out in the Internet there is a way to read data locally in the LAN from a purpleair sensor. I would like to add this a station option for Meteobridge but would need a Meteobridge in the same LAN as a purpleair sensor.
If someone from the Meteobridge users has such a setup, I would very much like to ask for a remote login to develop and test the drivers. Please mail to "info(at)meteobridge.com" if you own such a setup and you are interested to have it included into your Meteobridge setup.
Re: Purpleair sensor integration - need help
Posted: Fri Nov 27, 2020 12:19 am
by admin
Thanks to Wim who gave me access! I can read this data from the sensor. Any idea what values mean and what is best suited to be used by Meteobridge?
Code: Select all
"p25aqic_b":"rgb(255,0,0)",
"pm2.5_aqi_b":151,
"pm1_0_cf_1_b":47.00,
"p_0_3_um_b":7134.00,
"pm2_5_cf_1_b":74.00,
"p_0_5_um_b":2017.00,
"pm10_0_cf_1_b":82.00,
"p_1_0_um_b":356.00,
"pm1_0_atm_b":36.00,
"p_2_5_um_b":34.00,
"pm2_5_atm_b":56.00,
"p_5_0_um_b":8.00,
"pm10_0_atm_b":71.00,
"p_10_0_um_b":2.00,
"p25aqic":"rgb(255,40,0)",
"pm2.5_aqi":144,
"pm1_0_cf_1":42.00,
"p_0_3_um":6333.00,
"pm2_5_cf_1":64.00,
"p_0_5_um":1747.00,
"pm10_0_cf_1":68.00,
"p_1_0_um":294.00,
"pm1_0_atm":34.00,
"p_2_5_um":21.00,
"pm2_5_atm":53.00,
"p_5_0_um":3.00,
"pm10_0_atm":63.00,
"p_10_0_um":1.00,
"pa_latency":243,
Re: Purpleair sensor integration - need help
Posted: Fri Nov 27, 2020 9:45 am
by wvdkuil
Thanks for integrating those AQ sensors into the Meteobridge-data.
A lot of owners are also using a MB and can then use 1 script only to process the data.
I use the PurpleAir website-API to load the data, but the field-names seems the same, you can check yours here:
https://api.purpleair.com/#api-sensors-get-sensor-data
The PurpleAir device has two sensors , named A and B.
So all measurements should be available for both.
There probably should be a setting in the data if one of the sensors is not functioning.
I will be back home this weekend and will take a more detailed look.
Wim
P.sS. There is other documentation here also
https://www2.purpleair.com/community/fa ... s-the-json
Re: Purpleair sensor integration - need help
Posted: Fri Nov 27, 2020 10:07 am
by wvdkuil
There is another AQ sensor out there also. Luftdaten. Heavily used in Western Europe.
Accessing it locally with localIP/data.json (example
http://192.168.0.115/data.json) returns
{"software_version": "NRZ-2020-131", "age":"35", "sensordatavalues":[{"value_type":"SDS_P1","value":"37.00"},{"value_type":"SDS_P2","value":"25.83"},{"value_type":"temperature","value":"10.00"},{"value_type":"humidity","value":"99.90"},{"value_type":"samples","value":"3512827"},{"value_type":"min_micro","value":"33"},{"value_type":"max_micro","value":"20256"},{"value_type":"interval","value":"145000"},{"value_type":"signal","value":"-33"}]}
P1 => PM10
P2 => PM2.5
There is no PM1 data. But temp/hum/ optional pressure are available.
Link to documentation:
https://luftdaten.info/faq/#toggle-id-8
Wim
Re: Purpleair sensor integration - need help
Posted: Fri Nov 27, 2020 11:57 am
by admin
Wim, thanks for supporting me on this! With multi-station feature of Meteobridge it shouldn't be too hard to have it integrated and by that to avoid a need for individual scripts etc.
Re: Purpleair sensor integration - need help
Posted: Fri Nov 27, 2020 1:24 pm
by admin
For purpleair this sensor data is currently used:
Code: Select all
pm10_0_cf_1 -> air0pm
pm2_5_cf_1 -> air1pm
pm1_0_cf_1 -> air2pm
Re: Purpleair sensor integration - need help. **solved**
Posted: Fri Nov 27, 2020 6:58 pm
by admin
Experimental support for PurpleAir and Luftdaten station is part of the just released update.
Re: Purpleair sensor integration - need help. **solved**
Posted: Fri Nov 27, 2020 8:50 pm
by ToTo
Great, many thanks for this support!
Re: Purpleair sensor integration - need help. **solved**
Posted: Sun Nov 29, 2020 6:56 pm
by ConligWX
admin
I too have purpleair AND Airlink. if you want to check it out I'll send you the link via email0/pm if you like.
Re: Purpleair sensor integration - need help. **solved**
Posted: Sun Nov 29, 2020 10:21 pm
by ice124
I just set up my PurpleAir sensor this morning in the latest Meteobridge build, but it doesn't seem to be reading data from the sensor. It is on the same subnet as my Meteobridge, so it should be able to access the data.
I see this in the logs:
Code: Select all
logger (29.11.2020 12:02:03): connect station 1 (PurpleAir via SW Driver).
...
logger (29.11.2020 12:02:14): station 1 (PurpleAir), PurpleAir HW:? SW:?
Here's my Meteobridge version:
Meteobridge 5.0 (Nov 28 2020, build 1472), FW 1.3 on a Raspberry Pi 3B
I have a PurpleAir II sensor running firmware v6.01
Is there a setup step that I missed or any troubleshooting information that I can provide?
Re: Purpleair sensor integration - need help. **solved**
Posted: Mon Nov 30, 2020 3:54 pm
by wvdkuil
ice124 wrote: Sun Nov 29, 2020 10:21 pm
I just set up my PurpleAir sensor this morning in the latest Meteobridge build, but it doesn't seem to be reading data from the sensor. It is on the same subnet as my Meteobridge, so it should be able to access the data.
I see this in the logs:
Code: Select all
logger (29.11.2020 12:02:03): connect station 1 (PurpleAir via SW Driver).
...
logger (29.11.2020 12:02:14): station 1 (PurpleAir), PurpleAir HW:? SW:?
Here's my Meteobridge version:
Meteobridge 5.0 (Nov 28 2020, build 1472), FW 1.3 on a Raspberry Pi 3B
I have a PurpleAir II sensor running firmware v6.01
Is there a setup step that I missed or any troubleshooting information that I can provide?
Attached my setup for the Purpleair sensor. Maybe you have a typo in the IP-number?
My logging shows correct connection as it reads the SW:6.01.
Yours has a ? for those fields so it is not connected to the PurpleAir device.
Code: Select all
logger (30.11.2020 14:45:07): connect station 4 (PurpleAir via SW Driver).
. . .
logger (30.11.2020 14:45:07): sensors are now providing data.
logger (30.11.2020 14:45:07): services started.
logger (30.11.2020 14:45:07): station 4 (PurpleAir), PurpleAir-9a85 HW:2.0 SW:6.01
It shows this data in the LiveData => Raw Sensor Data
Code: Select all
# Sensor Signal Metric Data Imperial Data
. . .
4 Indoor 8 sec 10.0°C 59% 1019.6hPa (1019.6hPa) 50.0°F 59% 30.11inHg (30.11inHg)
4 Outdoor 8 sec 10.0°C 59% (dew 2.4°C, heat 10.0°C) 50.0°F 59% (dew 36.3°F, heat 50.0°F)
4 Air 8 sec 38.0µg/m³ 38.0µg/m³
4 Air #1 8 sec 27.0µg/m³ 27.0µg/m³
4 Air #2 8 sec 16.0µg/m³ 16.0µg/m³
Re: Purpleair sensor integration - need help. **solved**
Posted: Mon Nov 30, 2020 5:02 pm
by ice124
I triple-checked the IP address before submitting my post.
Here's the page from my PA II:

- Capture1.JPG (80.09 KiB) Viewed 4431 times
Here's my Station configuration page in Meteobridge:

- Capture2.JPG (53.41 KiB) Viewed 4431 times
I still see no data. Is there another log file that reports on parsing of the PurpleAir data? That might provide a clue as to where the problem lies.
Re: Purpleair sensor integration - need help. **solved**
Posted: Mon Nov 30, 2020 6:08 pm
by wvdkuil
ice124 wrote: Mon Nov 30, 2020 5:02 pm
I triple-checked the IP address before submitting my post.
Here's the page from my PA II:
Capture1.JPG
Here's my Station configuration page in Meteobridge:
Capture2.JPG
I still see no data. Is there another log file that reports on parsing of the PurpleAir data? That might provide a clue as to where the problem lies.
You can check the data with
http://192.168.11.3/json in your browser.
One common cause of "not
talking to the other device" occurs when the Purpleair sensor is on another access point as the Meteobridge is.
Although they are on the "same subnet 192.168.3.x " dozens of problems are possible
Google search "router clients can not access AP clients"
-> some access points hide their clients from being accessed by clients of the router or another access point.
-> some AP although using the router DHCP act as a "stand-alone" network and only allow outside internet via the router.
-> access point is connected wrongly to the backbone
As far as I can see, the message in your Meteobridge clearly states that the Meteobridge can not communicate with the PurpleAir.
Maybe you could test by connecting the PurpleAir to another accespoint?
Wim
Re: Purpleair sensor integration - need help. **solved**
Posted: Tue Dec 01, 2020 5:40 am
by ice124
One common cause of "not talking to the other device" occurs when the Purpleair sensor is on another access point as the Meteobridge is.
Although they are on the "same subnet 192.168.3.x " dozens of problems are possible
This is an interesting idea, although not really a possibility in my LAN configuration. I have an embedded PC operating as a router (OPNSense) and an Ubiquiti AP providing WiFi to the PA II. They are on the same subnet and the same VLAN, which is as close as I can get to being hosted on the same device.
I ran a quick check via SSH on my Meteobridge. I issued a
Code: Select all
wget -O - http://192.168.11.3/json
to attempt to read from the device from my Meteobridge, which returned the following, which looks correct:
Connecting to 192.168.11.3:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/json]
Saving to: 'STDOUT'
- [<=> ] 0 --.-KB/s {"SensorId":"84:f3:eb:44:d8:bd","DateTime":"2020/12/01T03:36:22z","Geo":"PurpleAir-d8bd","Mem":18960,"memfrag":26,"memfb":15016,"memcs":752,"Id":76073,"lat":47.823898,"lon":-122.223503,"Adc":0.05,"loggingrate":15,"place":"outside","version":"6.01","uptime":3478070,"rssi":-52,"period":120,"httpsuccess":174784,"httpsends":174857,"hardwareversion":"2.0","hardwarediscovered":"2.0+BME280+PMSX003-B+PMSX003-A","current_temp_f":52,"current_humidity":58,"current_dewpoint_f":38,"pressure":1020.71,"p25aqic_b":"rgb(255,241,0)","pm2.5_aqi_b":74,"pm1_0_cf_1_b":16.98,"p_0_3_um_b":2101.34,"pm2_5_cf_1_b":22.95,"p_0_5_um_b":652.68,"pm10_0_cf_1_b":23.75,"p_1_0_um_b":102.73,"pm1_0_atm_b":16.98,"p_2_5_um_b":4.68,"pm2_5_atm_b":22.95,"p_5_0_um_b":1.29,"pm10_0_atm_b":23.75,"p_10_0_um_b":0.59,"p25aqic":"rgb(255,244,0)","pm2.5_aqi":72,"pm1_0_cf_1":16.67,"p_0_3_um":2336.90,"pm2_5_cf_1":22.16,"p_0_5_um":672.43,"pm10_0_cf_1":23.09,"p_1_0_um":83.74,"pm1_0_atm":16.67,"p_2_5_um":4.07,"pm2_5_atm":22.16,"p_5_0_um":1.16,"pm10_0_atm":23.09,"p_10_0_um":0.00,"pa_latency":180,"response":201,"response_date":1606793776,"latency":265,"key1_response":200,"key1_response_date":1606793770,"key1_count":660880,"ts_latency":508,"key2_response":200,"key2_response_date":1606793772,"key2_count":660770,"ts_s_latency":484,"key1_response_b":200,"key1_response_date_b":1606793773,"key1_count_b":660855,"ts_latency_b":485,"key2_response_b":200,"key2_response_date_b":1606793774,"key2_count_b":661146,"ts_s_latency_b":493,"wlstate":"Connected","status_0":2,"status_1":2,"status_2":2,"status_3":2,"- [ <=> ] 1.62K --.-KB/s in 0.05s
2020-11-30 19:36:23 (29.5 KB/s) - written to stdout [1656]
I believe that my Meteobridge device is able to access data from the PA II successfully and pull the JSON response, but seems to be having trouble parsing the result. That's why I'm wondering if there is another log file to see if there is a problem with Meteobridge parsing the resulting JSON.
Re: Purpleair sensor integration - need help. **solved**
Posted: Tue Dec 01, 2020 9:49 am
by wvdkuil
Maybe you could have your Meteobridge using the same WiFi at the same Ubiquiti AP ?
It is especially that brand I was referring to which has extra "security features"
All things are cleared when you could test the 2 devices at the same AP or router.
Also:
The json-part in your example is incomplete, at least there is no ending }, status-array should end with 10, ssid should be displayed also.
Although I assume Meteobridge would give another message if it receives incomplete data.
Could you test the link with a browser and then copy the file to a text-file? And or check if it ends correctly?
If you use firefox it probably will detect it is receiving json and expand if if the file is correct.
Wim