Merge pull request #15612 from emontnemery/discover_shutter_tilt

Include shutter tilt config in discovery message
This commit is contained in:
Theo Arends 2022-05-13 14:02:56 +02:00 committed by GitHub
commit 77722733d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -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
}

View File

@ -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
}