>>> Join Us in the Fight Against Air Pollution

AirGradient Forum

AirGradient Integrations

Never looked before but it seems that it should be possible - they have info here Publishing Air Quality Data: on the aqicn.org / waqi.info map

Hi,

I succesful send data to WAQI.
I use Home Assistant to do that.
I have the Airgradient firmware with the MQTT set up
I retreive the data in HA by setting a sensors in the config yaml file.

mqtt:
  sensor:
    - name: "AirGradient Outdoor"
      state_topic: "airgradient/readings/<id of the AG>"
      value_template: "{{ value_json.pm02 }}"
      unit_of_measurement: "µg/m3"
      json_attributes_topic: "airgradient/readings/<id of the AG>"

I use pm02 as main value cause, I can calculate US AQI after that (not provided in MQTT stream (could be a nice improvment))
→ It will create a sensors with PM02 as main value and all the other data are attributes to that sensors
Then I setup a node red flow inside Home Assistant to send data to WAQI via the json api

Here the code to import in Node Red (you can delete weather data as I send my Davis Vantage data)
You have to set your lat long in the function box and also your Token from WAQI (works like a charm)
→ You can remove Weatherlink box and AQI box too

[{"id":"3e49292f7307e314","type":"group","z":"3fa1c2aa7dd4a8a0","name":"envois poussière vers WAQI","style":{"label":true},"nodes":["56ed22aa0ae44aeb","35ea220149053376","2d42f1205760cf2b","e974d2ea6e7cfb59","f087e7b6bb6b58df","4649ac5daf8ee750"],"x":34,"y":3519,"w":1152,"h":202},{"id":"56ed22aa0ae44aeb","type":"inject","z":"3fa1c2aa7dd4a8a0","g":"3e49292f7307e314","name":"Toutes les minutes","props":[{"p":"payload"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":3560,"wires":[["4649ac5daf8ee750"]]},{"id":"35ea220149053376","type":"http request","z":"3fa1c2aa7dd4a8a0","g":"3e49292f7307e314","name":"Envois vers aqicn","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://aqicn.org/sensor/upload","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"Content-Type","keyValue":"","valueType":"other","valueValue":"application/json"}],"x":1070,"y":3680,"wires":[[]]},{"id":"2d42f1205760cf2b","type":"api-current-state","z":"3fa1c2aa7dd4a8a0","g":"3e49292f7307e314","name":"","server":"f910323b.88e67","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.airgradient_jardin","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"air","propertyType":"msg","value":"","valueType":"entityState"},{"property":"airgradient","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":450,"y":3620,"wires":[["e974d2ea6e7cfb59"]]},{"id":"e974d2ea6e7cfb59","type":"api-current-state","z":"3fa1c2aa7dd4a8a0","g":"3e49292f7307e314","name":"","server":"f910323b.88e67","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"weather.weatherlink_001d0a717179","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"weather","propertyType":"msg","value":"","valueType":"entityState"},{"property":"weatherlink","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":450,"y":3680,"wires":[["f087e7b6bb6b58df"]]},{"id":"f087e7b6bb6b58df","type":"function","z":"3fa1c2aa7dd4a8a0","g":"3e49292f7307e314","name":"fabrication de la requete","func":"msg.payload = \n{\n \"token\": \"<TOKEN>\", \n\t\"station\": \n\t{\n\t\t\"id\": \"<id>\", \n\t\t\"name\": \"<name>\",\n\t\t\"latitude\": <lat>,\n\t\t\"longitude\": <long>, \n\t},\n\t\"org\": {\n\t\t\"website\": \"<website>/\",\n\t\t\"name\": \"<name>\",\n\t},\n\t\"readings\": \n\t[\n\t\t\t{ \"specie\": \"pm0.3\", \"value\": msg.airgradient.attributes.pm003_count, \"unit\": \"count\" },\n\t\t\t{ \"specie\": \"pm1.0\", \"value\": msg.airgradient.attributes.pm01, \"unit\": \"µg/m3\" },\n\t\t\t{ \"specie\": \"pm2.5\", \"value\": msg.airgradient.attributes.pm02, \"unit\": \"µg/m3\" },\n\t\t\t{ \"specie\": \"pm10\", \"value\": msg.airgradient.attributes.pm10, \"unit\": \"µg/m3\" },\n\t\t\t{ \"specie\": \"CO2\", \"value\": msg.airgradient.attributes.rco2, \"unit\": \"ppm\" },\n\t\t\t{ \"specie\": \"VOC Index\", \"value\": msg.airgradient.attributes.tvoc_index },\n\t\t\t{ \"specie\": \"VOC RAW\", \"value\": msg.airgradient.attributes.tvoc_raw },\n\t\t\t{ \"specie\": \"NOx Index\", \"value\": msg.airgradient.attributes.nox_index },\n\t\t\t{ \"specie\": \"NOx RAW\", \"value\": msg.airgradient.attributes.nox_raw },\n\t\t\t{ \"specie\": \"AQI_PM25\", \"value\": msg.aqi, \"unit\": \"US AQI\" },\n\t\t\t{ \"specie\": \"temp\", \"value\": msg.weatherlink.attributes.temperature, \"unit\": \"°C\" },\n\t\t\t{ \"specie\": \"Hum\", \"value\": msg.weatherlink.attributes.humidity, \"unit\": \"%\" },\n\t\t\t{ \"specie\": \"Pressure\", \"value\": msg.weatherlink.attributes.pressure, \"unit\": \"hPa\" },\n\t\t\t{ \"specie\": \"Wind Speed\", \"value\": msg.weatherlink.attributes.wind_speed, \"unit\": \"km/h\" },\n\t\t\t{ \"specie\": \"Wind_bearing\", \"value\": msg.weatherlink.attributes.wind_bearing, \"unit\": \"°\" },\n\t]\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":3680,"wires":[["35ea220149053376"]]},{"id":"4649ac5daf8ee750","type":"api-current-state","z":"3fa1c2aa7dd4a8a0","g":"3e49292f7307e314","name":"","server":"f910323b.88e67","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.pm25_aqi_outdoor","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"aqi","propertyType":"msg","value":"","valueType":"entityState"},{"property":"US_AQI","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":460,"y":3560,"wires":[["2d42f1205760cf2b"]]},{"id":"f910323b.88e67","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]