davidkreidler / OpenCO2_Sensor

Arduino Repository for an E-Ink CO2 Sensor using ESP32 and SCD4X
https://www.tindie.com/products/davidkreidler/open-co2-sensor/
MIT License
100 stars 5 forks source link

MQTT support #12

Open P1-Ro opened 11 months ago

P1-Ro commented 11 months ago

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.

davidkreidler commented 11 months ago

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:

  1. Download "OpenCO2_Sensor.ino.bin" from https://drive.google.com/file/d/1W8UEv53j-Czv9JsQuHC9AA_DrWFvl-n6/view?usp=sharing
  2. 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".
  3. Navigate in your Webbrowser to http://192.168.4.1 (It also opens automatically on modern smartphones)
  4. 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". mqtt

P1-Ro commented 11 months ago

Super stoked about that. I'll let you know when I have time to play with it :)

ThomasWaldmann commented 5 months ago

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.