|
|
@@ -65,36 +65,48 @@ void HomeAssistantDiscoveryClient::addConfig(const char* alias, const BulbId& bu
|
|
|
JsonArray effects = config.createNestedArray(F("effect_list"));
|
|
|
effects.add(MiLightCommandNames::NIGHT_MODE);
|
|
|
|
|
|
- // These bulbs support RGB color
|
|
|
+ // These bulbs support switching between rgb/white, and have a "white_mode" command
|
|
|
switch (bulbId.deviceType) {
|
|
|
case REMOTE_TYPE_FUT089:
|
|
|
- case REMOTE_TYPE_RGB:
|
|
|
case REMOTE_TYPE_RGB_CCT:
|
|
|
case REMOTE_TYPE_RGBW:
|
|
|
- config[F("rgb")] = true;
|
|
|
+ effects.add("white_mode");
|
|
|
break;
|
|
|
default:
|
|
|
break; //nothing
|
|
|
}
|
|
|
|
|
|
- // These bulbs support adjustable white values
|
|
|
+ // All bulbs except CCT have 9 modes. FUT029 and RGB/FUT096 has 9 modes, but they
|
|
|
+ // are not selectable directly. There are only "next mode" commands.
|
|
|
switch (bulbId.deviceType) {
|
|
|
case REMOTE_TYPE_CCT:
|
|
|
+ case REMOTE_TYPE_RGB:
|
|
|
+ case REMOTE_TYPE_FUT020:
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ addNumberedEffects(effects, 0, 8);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ // These bulbs support RGB color
|
|
|
+ switch (bulbId.deviceType) {
|
|
|
case REMOTE_TYPE_FUT089:
|
|
|
- case REMOTE_TYPE_FUT091:
|
|
|
+ case REMOTE_TYPE_RGB:
|
|
|
case REMOTE_TYPE_RGB_CCT:
|
|
|
- config[GroupStateFieldNames::COLOR_TEMP] = true;
|
|
|
+ case REMOTE_TYPE_RGBW:
|
|
|
+ config[F("rgb")] = true;
|
|
|
break;
|
|
|
default:
|
|
|
break; //nothing
|
|
|
}
|
|
|
|
|
|
- // These bulbs support switching between rgb/white, and have a "white_mode" command
|
|
|
+ // These bulbs support adjustable white values
|
|
|
switch (bulbId.deviceType) {
|
|
|
+ case REMOTE_TYPE_CCT:
|
|
|
case REMOTE_TYPE_FUT089:
|
|
|
+ case REMOTE_TYPE_FUT091:
|
|
|
case REMOTE_TYPE_RGB_CCT:
|
|
|
- case REMOTE_TYPE_RGBW:
|
|
|
- effects.add("white_mode");
|
|
|
+ config[GroupStateFieldNames::COLOR_TEMP] = true;
|
|
|
break;
|
|
|
default:
|
|
|
break; //nothing
|
|
|
@@ -152,4 +164,10 @@ String HomeAssistantDiscoveryClient::bindTopicVariables(const String& topic, con
|
|
|
boundTopic.replace(":group_id", String(bulbId.groupId));
|
|
|
|
|
|
return boundTopic;
|
|
|
+}
|
|
|
+
|
|
|
+void HomeAssistantDiscoveryClient::addNumberedEffects(JsonArray& effectList, uint8_t start, uint8_t end) {
|
|
|
+ for (uint8_t i = start; i <= end; ++i) {
|
|
|
+ effectList.add(String(i));
|
|
|
+ }
|
|
|
}
|