feat: Enhance DALI Gateway with RGBW and RGBCW support
- Added support for RGBW and RGBCW color modes in the DALI Gateway. - Updated JSON color mode parsing to handle new color types. - Extended the StoreDt8SceneSnapshot function to include white, amber, and free color parameters. - Introduced new methods in DaliGatewayBridge for setting RGBW, RGBCW, and RGBWAF colors. - Modified KnxDaliChannel to send RGBW and RGBCW colors based on the color type. - Updated parameter types and definitions in the KNX product XML files to accommodate new color modes. - Enhanced README with migration details and validation instructions. Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
@@ -1020,6 +1020,12 @@ DaliDt8SceneColorMode JsonColorMode(const cJSON* root) {
|
||||
if (item->valueint == 2) {
|
||||
return DaliDt8SceneColorMode::kRgb;
|
||||
}
|
||||
if (item->valueint == 3) {
|
||||
return DaliDt8SceneColorMode::kRgbw;
|
||||
}
|
||||
if (item->valueint == 4) {
|
||||
return DaliDt8SceneColorMode::kRgbcw;
|
||||
}
|
||||
return DaliDt8SceneColorMode::kDisabled;
|
||||
}
|
||||
if (!cJSON_IsString(item) || item->valuestring == nullptr) {
|
||||
@@ -1032,6 +1038,12 @@ DaliDt8SceneColorMode JsonColorMode(const cJSON* root) {
|
||||
if (mode == "rgb") {
|
||||
return DaliDt8SceneColorMode::kRgb;
|
||||
}
|
||||
if (mode == "rgbw") {
|
||||
return DaliDt8SceneColorMode::kRgbw;
|
||||
}
|
||||
if (mode == "rgbcw" || mode == "rgbWwCw" || mode == "rgb_cw") {
|
||||
return DaliDt8SceneColorMode::kRgbcw;
|
||||
}
|
||||
return DaliDt8SceneColorMode::kDisabled;
|
||||
}
|
||||
|
||||
@@ -1049,6 +1061,15 @@ GatewayBridgeHttpResponse StoreDt8SceneSnapshot(DaliDomainService& domain, uint8
|
||||
const int red = JsonIntAny(root, "red", "r").value_or(0);
|
||||
const int green = JsonIntAny(root, "green", "g").value_or(0);
|
||||
const int blue = JsonIntAny(root, "blue", "b").value_or(0);
|
||||
const int white = JsonIntAny(root, "white", "w")
|
||||
.value_or(JsonIntAny(root, "coolWhite", "cool_white")
|
||||
.value_or(JsonInt(root, "cw").value_or(0)));
|
||||
const int amber = JsonIntAny(root, "amber", "a")
|
||||
.value_or(JsonIntAny(root, "warmWhite", "warm_white")
|
||||
.value_or(JsonInt(root, "ww").value_or(0)));
|
||||
const int freecolour = JsonIntAny(root, "freecolour", "freeColor").value_or(255);
|
||||
const int rgbwaf_control = JsonIntAny(root, "rgbwafControl", "rgbwaf_control")
|
||||
.value_or(JsonInt(root, "control").value_or(-1));
|
||||
cJSON_Delete(root);
|
||||
|
||||
if (!address.has_value() || !scene.has_value() || !brightness.has_value() ||
|
||||
@@ -1057,7 +1078,7 @@ GatewayBridgeHttpResponse StoreDt8SceneSnapshot(DaliDomainService& domain, uint8
|
||||
}
|
||||
if (!domain.storeDt8SceneSnapshot(gateway_id, address.value(), scene.value(),
|
||||
brightness.value(), color_mode, color_temperature, red,
|
||||
green, blue)) {
|
||||
green, blue, white, amber, freecolour, rgbwaf_control)) {
|
||||
return ErrorResponse(ESP_FAIL, "failed to store DT8 scene snapshot");
|
||||
}
|
||||
return StoredSnapshotResponse(domain.dt8SceneColorReport(gateway_id, address.value(),
|
||||
|
||||
Reference in New Issue
Block a user