From 15c49aa9757fd09ecba18c1d538c1ab87b076343 Mon Sep 17 00:00:00 2001 From: Markus Kirberg Date: Mon, 14 Oct 2024 19:23:12 +0200 Subject: [PATCH 1/5] adapt settings --- fs_src/index.html | 4 ++++ fs_src/script.js | 2 ++ mos.yml | 1 + src/shelly_hap_humidity_sensor.cpp | 16 ++++++++++------ src/shelly_hap_temperature_sensor.cpp | 17 +++++++++++------ src/shelly_main.cpp | 3 +++ 6 files changed, 31 insertions(+), 12 deletions(-) diff --git a/fs_src/index.html b/fs_src/index.html index a358a292..f19c8eab 100644 --- a/fs_src/index.html +++ b/fs_src/index.html @@ -767,6 +767,10 @@

Sensor

  s +
+ + +
- - + +
-
+
  s
diff --git a/fs_src/script.js b/fs_src/script.js index f0336422..e48e8fca 100644 --- a/fs_src/script.js +++ b/fs_src/script.js @@ -794,6 +794,8 @@ function updateComponent(cd) { } updateInnerText(el(c, "value"), v); selectIfNotModified(el(c, "unit"), cd.unit); + el("update_interval_container").style.display = + (cd.unit == 2) ? "none" : "block"; setValueIfNotModified(el(c, "update_interval"), cd.update_interval); setValueIfNotModified(el(c, "offset"), cd.offset / 100.0); break; diff --git a/src/shelly_hap_humidity_sensor.cpp b/src/shelly_hap_humidity_sensor.cpp index 1f79f0ea..f6ea3752 100644 --- a/src/shelly_hap_humidity_sensor.cpp +++ b/src/shelly_hap_humidity_sensor.cpp @@ -86,8 +86,7 @@ Status HumiditySensor::SetConfig(const std::string &config_json, } if (cfg_->update_interval != cfg.update_interval) { cfg_->update_interval = cfg.update_interval; - // update interval is set via temperature sensor - // hum_sensor_->StartUpdating(cfg_->update_interval * 1000); + // update interval is set via temperature sensor on DHT } return Status::OK(); } @@ -126,7 +125,6 @@ Status HumiditySensor::Init() { kHAPCharacteristicDebugDescription_CurrentRelativeHumidity); AddChar(current_humidity_characteristic_); - hum_sensor_->StartUpdating(cfg_->update_interval * 1000); return Status::OK(); } From da4db793f6ec0363c161b1cc88253624190364c4 Mon Sep 17 00:00:00 2001 From: Markus Kirberg Date: Fri, 18 Oct 2024 14:06:25 +0000 Subject: [PATCH 5/5] fix shellyu/u25 building --- src/shelly_main.cpp | 30 +++++++++++++++--------------- src/shelly_output.cpp | 2 ++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/shelly_main.cpp b/src/shelly_main.cpp index 717fb1df..79534c57 100644 --- a/src/shelly_main.cpp +++ b/src/shelly_main.cpp @@ -761,28 +761,28 @@ void InitApp() { // Initialize accessory server. HAPAccessoryServerOptions server_options = { - .maxPairings = kHAPPairingStorage_MinElements, + .maxPairings = kHAPPairingStorage_MinElements, #if HAP_IP - .ip = - { - .transport = &kHAPAccessoryServerTransport_IP, + .ip = + { + .transport = &kHAPAccessoryServerTransport_IP, #ifndef __clang__ - .available = 0, + .available = 0, #endif - .accessoryServerStorage = &s_ip_storage, - }, + .accessoryServerStorage = &s_ip_storage, + }, #endif #if HAP_BLE - .ble = - { - .transport = nullptr, + .ble = + { + .transport = nullptr, #ifndef __clang__ - .available = 0, + .available = 0, #endif - .accessoryServerStorage = nullptr, - .preferredAdvertisingInterval = 0, - .preferredNotificationDuration = 0, - }, + .accessoryServerStorage = nullptr, + .preferredAdvertisingInterval = 0, + .preferredNotificationDuration = 0, + }, #endif }; static struct HAPPlatformMFiTokenAuth s_mfi_auth; diff --git a/src/shelly_output.cpp b/src/shelly_output.cpp index a5c42e6b..d2e6cefb 100644 --- a/src/shelly_output.cpp +++ b/src/shelly_output.cpp @@ -83,6 +83,8 @@ Status OutputPin::SetStatePWM(float duty, const char *source) { } return Status::OK(); #else + (void) duty; + (void) source; return Status::UNIMPLEMENTED(); #endif }