OpenCO2_Sensor
OpenCO2_Sensor copied to clipboard
MQTT support
I found this on Tindie and I am extremely interested.
Would it be possible to add MQTT support? That way it could be easily connected to Home Assistant. It could work or example something like this: when screen information refreshes, check if mqtt is configured, if yes then publish message to it.
Hello @P1-Ro & thank you for reaching out regarding this. Generally MQTT support is implemented but not jet fully validated. I would appreciate your support regarding this a lot.
Currently its enabled via a special firmware or via your own build by enabling it here: https://github.com/davidkreidler/OpenCO2_Sensor/blob/main/OpenCO2_Sensor.ino#L40C10-L40C10 Please then also comment out "#define airgradient" and use esp board version 2.0.13
How to install it:
- Download "OpenCO2_Sensor.ino.bin" from https://drive.google.com/file/d/1W8UEv53j-Czv9JsQuHC9AA_DrWFvl-n6/view?usp=sharing
- Connect Power to the Sensor and enable WiFi via the Menu on the OpenCO2 Sensor. Then connect a client to the new WiFi Network "OpenCO2 Sensor".
- Navigate in your Webbrowser to http://192.168.4.1 (It also opens automatically on modern smartphones)
- Under Update select the OpenCO2_Sensor.ino.bin file and click Update. The Sensor will restart.
Connect again to the "OpenCO2 Sensor" network and insert your home network credentials and MQTT settings under "Configure WiFi".
Super stoked about that. I'll let you know when I have time to play with it :)
Currently playing around with the MQTT enabled firmware, but already run into a problem:
The device was previously joined to a WiFi (so it does not open its own AP and show up under 192.168.4.1 any more), but I can ping its home wifi client IP.
How do I get the WiFiManager configuration web form now to enter the MQTT data? It does not seem to listen on port 80.
Update: found it out: one can erase all the flash via the arduino IDE option, then, after enabling WiFi via the OpenCO2 menu, it will start from scratch.