From be446e10e3927f57b1025bee1be1255a295a4ed3 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 13 May 2022 12:28:48 +0200 Subject: [PATCH] Include shutter tilt config in discovery message --- tasmota/xdrv_12_discovery.ino | 12 ++++++++++++ tasmota/xdrv_12_home_assistant.ino | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/tasmota/xdrv_12_discovery.ino b/tasmota/xdrv_12_discovery.ino index 5d5f71431..44c3325c7 100644 --- a/tasmota/xdrv_12_discovery.ino +++ b/tasmota/xdrv_12_discovery.ino @@ -209,6 +209,18 @@ void TasDiscoverMessage(void) { } ResponseAppend_P(PSTR("]," // Shutter Options (end) + "\"sht\":[")); // Shutter Tilt (start) + for (uint32_t i = 0; i < MAX_SHUTTERS; i++) { +#ifdef USE_SHUTTER + ResponseAppend_P(PSTR("%s[%d,%d,%d]"), (i > 0 ? "," : ""), + Settings->shutter_tilt_config[0][i], + Settings->shutter_tilt_config[1][i], + Settings->shutter_tilt_config[2][i]); +#else + ResponseAppend_P(PSTR("%s[0,0,0]"), (i > 0 ? "," : "")); +#endif // USE_SHUTTER + } + ResponseAppend_P(PSTR("]," // Shutter Tilt (end) "\"ver\":1}")); // Discovery version } diff --git a/tasmota/xdrv_12_home_assistant.ino b/tasmota/xdrv_12_home_assistant.ino index 00bbf6734..ffc099e5d 100644 --- a/tasmota/xdrv_12_home_assistant.ino +++ b/tasmota/xdrv_12_home_assistant.ino @@ -376,6 +376,18 @@ void HassDiscoverMessage(void) { } ResponseAppend_P(PSTR("]," // Shutter Options (end) + "\"sht\":[")); // Shutter Tilt (start) + for (uint32_t i = 0; i < MAX_SHUTTERS; i++) { +#ifdef USE_SHUTTER + ResponseAppend_P(PSTR("%s[%d,%d,%d]"), (i > 0 ? "," : ""), + Settings->shutter_tilt_config[0][i], + Settings->shutter_tilt_config[1][i], + Settings->shutter_tilt_config[2][i]); +#else + ResponseAppend_P(PSTR("%s[0,0,0]"), (i > 0 ? "," : "")); +#endif // USE_SHUTTER + } + ResponseAppend_P(PSTR("]," // Shutter Tilt (end) "\"ver\":1}")); // Discovery version }