Skip to content

Commit

Permalink
publishing of CAJOE CPM and uSv/h on homeassistant added
Browse files Browse the repository at this point in the history
  • Loading branch information
iw2lsi committed Jun 7, 2022
1 parent 3176deb commit dd80980
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
35 changes: 18 additions & 17 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,24 @@ lib_deps =
bblanchon/ArduinoJson @ 6.19.4
chrisjoyce911/esp32FOTA @ 0.1.6
; hpsaturn/CanAirIO Air Quality Sensors Library @ 0.5.4
adafruit/Adafruit Unified Sensor @ 1.1.5
adafruit/Adafruit BME280 Library @ 2.2.2
adafruit/Adafruit BMP280 Library @ 2.6.2
adafruit/Adafruit BME680 Library @ 2.0.2
adafruit/Adafruit BusIO @ 1.11.6
adafruit/Adafruit SHT31 Library @ 2.1.0
robtillaart/AM232X @ 0.4.1
enjoyneering/AHT10 @ 1.1.0
paulvha/sps30 @ 1.4.12
wifwaf/MH-Z19 @ 1.5.3
sparkfun/SparkFun SCD30 Arduino Library @ 1.0.17
sensirion/Sensirion Core @ 0.5.3
sensirion/Sensirion I2C SCD4x @ 0.3.1
https://github.com/hpsaturn/DHT_nonblocking.git
https://github.com/paulvha/SN-GCJA5.git
https://github.com/jcomas/S8_UART.git
https://github.com/jcomas/CM1106_UART.git
https://github.com/iw2lsi/canairio_sensorlib.git
; adafruit/Adafruit Unified Sensor @ 1.1.5
; adafruit/Adafruit BME280 Library @ 2.2.2
; adafruit/Adafruit BMP280 Library @ 2.6.2
; adafruit/Adafruit BME680 Library @ 2.0.2
; adafruit/Adafruit BusIO @ 1.11.6
; adafruit/Adafruit SHT31 Library @ 2.1.0
; robtillaart/AM232X @ 0.4.1
; enjoyneering/AHT10 @ 1.1.0
; paulvha/sps30 @ 1.4.12
; wifwaf/MH-Z19 @ 1.5.3
; sparkfun/SparkFun SCD30 Arduino Library @ 1.0.17
; sensirion/Sensirion Core @ 0.5.3
; sensirion/Sensirion I2C SCD4x @ 0.3.1
; https://github.com/hpsaturn/DHT_nonblocking.git
; https://github.com/paulvha/SN-GCJA5.git
; https://github.com/jcomas/S8_UART.git
; https://github.com/jcomas/CM1106_UART.git

https://github.com/256dpi/arduino-mqtt.git
https://github.com/tobiasschuerg/InfluxDB-Client-for-Arduino.git
Expand Down
10 changes: 10 additions & 0 deletions src/cloud_hass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ void hassPubSensorPayload() {
doc["battery"] = String(battery.getCharge());
doc["voltage"] = String(battery.getVoltage());

#ifdef CAJOE_GEIGER
doc["geiger_cpm"] = String(sensors.getGeigerCPM());
doc["geiger_usvh"] = String(sensors.getGeigerMicroSievertHour());
#endif

size_t n = serializeJson(doc, buffer);

if (clientHass.publish(getStateTopic().c_str(), buffer, n)) {
Expand Down Expand Up @@ -96,6 +101,11 @@ bool hassRegisterSensors() {
hassConfigured = publishDiscoveryPayload("pressure", "pressure", "hPa");
hassConfigured = publishDiscoveryPayload("battery", "battery", "%");

#ifdef CAJOE_GEIGER // WARNING! I'm not sure about this fields!
hassConfigured = publishDiscoveryPayload("geiger_cpm", "geiger_cpm", "cpm");
hassConfigured = publishDiscoveryPayload("geiger_usvh", "geiger_usvh", "uSv/h");
#endif

if (hassConfigured) Serial.printf("-->[MQTT] Hass device registered\t: %s\n",getHostId().c_str());
else Serial.printf("[E][MQTT] Hass not configured yet\t: device: %s\n",getHostId().c_str());

Expand Down

0 comments on commit dd80980

Please sign in to comment.