Solved!
The forum won’t let me upload the firmware bin file, and honestly, you shouldn’t trust it from some random person on the internet. Maybe the person who runs templates.blakadder.com can build and upload this custom version of the binary with these instructions.
Here’s how I did it:
You will first need to compile Tasmota with the following in your tasmota/user_config_override.h
file:
// These are necessary:
#define USE_SHT
#define USE_SHT3X
#define USE_SENSEAIR
#define USE_PMS5003
#define USE_DISPLAY
#define USE_DISPLAY_SH1106
#define USE_SGP41
#define WS2812_LEDS 11
#ifndef USE_RULES
#define USE_RULES
#endif
// The rest below are optional
#define USE_BMP
#define USE_BME
#define USE_ADS1115
#ifdef USER_TEMPLATE
#undef USER_TEMPLATE
#endif
#define USER_TEMPLATE "{\"NAME\":\"AirGradient Pro v9\",\"GPIO\":[1632,1600,224,1,1,1,608,640,0,0,1376,0,0,0,0,0,0,0,0,0,1696,1664],\"FLAG\":0,\"BASE\":1}"
// This runs the first time the firmware is installed.
// You can remove 'Dimmer2 40;' and anything else __AFTER__ 'DisplayAddress1 60;'
// This is just to show that the firmware is installed and working.
#define USER_BACKLOG "Module 0; DisplayMode 0; DisplayModel 7; PulseTime1 1 Power2 On; Power3 On; Rule1 On; Rule2 On; Power1 On; DisplayAddress1 60; Dimmer2 40; Color2 00ff55; Led1 222222"
// Watchdog keep alive
#ifdef USER_RULE1
#undef USER_RULE1
#endif
#ifndef USER_RULE1
#define USER_RULE1 "On Time#Minute DO Power1 On ENDON"
#endif
// Display
#ifdef USER_RULE2
#undef USER_RULE2
#endif
#define USER_RULE2 "On SHT4X#Temperature do DisplayText [s1l1c1]T: %value%C endon on SHT4X#Humidity do DisplayText [s1l1c11]H: %value%% endon on S8#CarbonDioxide do DisplayText [s1l2c1]CO2: %value% ppm endon on PMS5003#PM2.5 do DisplayText [s1l3c1]PM2.5: %value% endon on PMS5003#PM10 do DisplayText [s1l3c11]PM10: %value% endon on PMS5003#PB0.3 do DisplayText [s1l4c1]PB.3: %value% endon on SHT4X#Temperature do DisplayText [s1l5c1]%timestamp% endon on tele-DisplayText [s1l6c1] endon"
#ifndef DISPLAY_MODEL
#define DISPLAY_MODEL 7
#endif
I tried to compile with the template, rules and display mode set, but not sure if it’s working. If it’s not, no big deal, you can apply these settings manually in the Tasmota console as explained below. The most important thing is compiling with the sensors and display code in the firmware.
You will also need to comment out tasmota
and uncomment tasmota32
in the platformio_override.ini
file.
Select the tasmota32c3
environment if using vscode:
Build and upload.
Manual settings:
Use template:
{"NAME":"AirGradient Pro v9","GPIO":[1632,1600,224,1,1,1,608,640,0,0,1376,0,0,0,0,0,0,0,0,0,1696,1664],"FLAG":0,"BASE":1}
Rule 1 (In console) for Watchdog pulse (Relay1, GPIO-02). Setting this will prevent the AirGradient from rebooting every 30~ minutes:
Rule1 ON Time#Minute DO Power1 On ENDON
Rule1 On
Rule2 (In Console) for display:
Rule2 on SHT4X#Temperature do DisplayText [s1l1c1]T: %value%C endon on SHT4X#Humidity do DisplayText [s1l1c11]H: %value%% endon on S8#CarbonDioxide do DisplayText [s1l2c1]CO2: %value% ppm endon on PMS5003#PM2.5 do DisplayText [s1l3c1]PM2.5: %value% endon on PMS5003#PM10 do DisplayText [s1l3c11]PM10: %value% endon on PMS5003#PB0.3 do DisplayText [s1l4c1]PB.3: %value% endon on SHT4X#Temperature do DisplayText [s1l5c1]%timestamp% endon on tele-DisplayText [s1l6c1] endon
Rule2 On
If using an BME680, you can set Rule2 to:
Rule2 on BME680#Temperature do DisplayText [s1l1c1]T: %value%C endon on BME680#Humidity do DisplayText [s1l1c11]H: %value%% endon on S8#CarbonDioxide do DisplayText [s1l2c1]CO2: %value% ppm endon on PMS5003#PM2.5 do DisplayText [s1l3c1]PM2.5: %value% endon on PMS5003#PM10 do DisplayText [s1l3c11]PM10: %value% endon on PMS5003#PB0.3 do DisplayText [s1l4c1]PB.3: %value% endon on BME680#Temperature do DisplayText [ds1l5c1]%timestamp% endon on tele do DisplayText [ds1l6c1] endon
Rule2 On
Set DisplayMode to 0 for text and DisplayModel to 7 so that it uses the driver for SH1106
the instead of SSD1306
:
DisplayMode 0
DisplayModel 7
If it’s working you should see this every minute, which means the watchdog won’t reboot the device:
12:54:00.911 RUL: TIME#MINUTE performs "Power1 On"
12:54:00.917 RSL: RESULT = {"POWER1":"ON"}
12:54:00.919 RSL: POWER1 = ON
12:54:01.062 RSL: RESULT = {"POWER1":"OFF"}
12:54:01.064 RSL: POWER1 = OFF
Here’s a screenshot and photo of it working:
Note:
- Toggle1 is the watchdog relay. You probably shouldn’t click it, but it shouldn’t break anything if you do.
- Toggle2 and the sliders is for the LEDs. It changes all the LEDs.
- Toggle3 turns the display on and off.
- You can set specific LEDs with the LED command. eg:
led1 ff0000
, led5 0000ff
as shown in the photo above.