From 8fcf257726dc1d6ef848451962c9ace373714a91 Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Thu, 29 Feb 2024 23:52:36 +0000 Subject: [PATCH 1/3] Fix check workflow failing on pull requests This fixes the following check GitHub Actions workflow failure that would otherwise occur on pull requests (but not on pushes/branches): Error installing Git Library: Library install failed: object not found --- .github/workflows/check.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4b1c029..80186da 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -40,6 +40,13 @@ jobs: WiFiManager@2.0.16-rc.2 Arduino_JSON@0.2.0 U8g2@2.34.22 + # In some cases, actions/checkout@v4 will check out a detached HEAD; for + # example, this happens on pull request events, where an hypothetical + # PR merge commit is checked out. This tends to confuse + # `arduino-cli lib install --git-url`, making it fail with errors such as: + # Error installing Git Library: Library install failed: object not found + # Create and check out a dummy branch to work around this issue. + - run: git checkout -b check - run: bin/arduino-cli --verbose lib install --git-url . env: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL: "true" From f361e3c9a9093c4f27a9620642b923de774de5f6 Mon Sep 17 00:00:00 2001 From: gouthamve Date: Fri, 8 Mar 2024 19:02:19 +0100 Subject: [PATCH 2/3] [ONE/Prometheus] Use full unit in temperature metric Please see: https://prometheus.io/docs/practices/naming/#base-units Also, thanks a lot for this support, I had my own exporter that I can now delete :) Signed-off-by: gouthamve --- examples/ONE/ONE.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ONE/ONE.ino b/examples/ONE/ONE.ino index fde5c3c..ae3d1f3 100644 --- a/examples/ONE/ONE.ino +++ b/examples/ONE/ONE.ino @@ -1056,7 +1056,7 @@ void webServerMetricsGet(void) { add_metric("temperature", "The ambient temperature as measured by the AirGradient SHT " "sensor, in degrees Celsius", - "gauge", "degc"); + "gauge", "celcius"); add_metric_point("", String(temp)); } if (hum >= 0) { From f60e9bbe3e9c167326687993129e28301c2bc6b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Austvik?= Date: Fri, 8 Mar 2024 23:37:12 +0100 Subject: [PATCH 3/3] Fix MDNS Service Discovery: - Underscore before names per https://github.com/espressif/arduino-esp32/issues/962 - Only one service per port The combination of both changes is needed to make the service discoverable in OpenHAB The removal of the published http service is maybe something you don't want, but as long as it doesn't serve web pages it is maybe OK? --- examples/ONE/ONE.ino | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/examples/ONE/ONE.ino b/examples/ONE/ONE.ino index fde5c3c..db1606b 100644 --- a/examples/ONE/ONE.ino +++ b/examples/ONE/ONE.ino @@ -1091,17 +1091,11 @@ static void webServerInit(void) { // Make it possible to query this device from Prometheus/OpenMetrics. webServer.on("/metrics", HTTP_GET, webServerMetricsGet); webServer.begin(); - MDNS.addService("http", "tcp", 80); - MDNS.addServiceTxt("http", "_tcp", "model", mdnsModelName); - MDNS.addServiceTxt("http", "_tcp", "serialno", getDevId()); - MDNS.addServiceTxt("http", "_tcp", "fw_ver", ag.getVersion()); - MDNS.addServiceTxt("http", "_tcp", "vendor", "AirGradient"); - MDNS.addService("http", "tcp", 80); - MDNS.addService("_airgradient", "tcp", 80); - MDNS.addServiceTxt("airgradient", "_tcp", "model", mdnsModelName); - MDNS.addServiceTxt("airgradient", "_tcp", "serialno", getDevId()); - MDNS.addServiceTxt("airgradient", "_tcp", "fw_ver", ag.getVersion()); - MDNS.addServiceTxt("airgradient", "_tcp", "vendor", "AirGradient"); + MDNS.addService("_airgradient", "_tcp", 80); + MDNS.addServiceTxt("_airgradient", "_tcp", "model", mdnsModelName); + MDNS.addServiceTxt("_airgradient", "_tcp", "serialno", getDevId()); + MDNS.addServiceTxt("_airgradient", "_tcp", "fw_ver", ag.getVersion()); + MDNS.addServiceTxt("_airgradient", "_tcp", "vendor", "AirGradient"); if (xTaskCreate(webServerHandler, "webserver", 1024 * 4, NULL, 5, NULL) != pdTRUE) {