mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-03-10 01:08:05 +01:00
No index in RGB name
This commit is contained in:
@@ -119,9 +119,12 @@ void hass_populate_common(cJSON *root, ENTITY_TYPE type, int index, char *unique
|
||||
//A device can have both relay and PWM and they would need to have separate names.
|
||||
switch(type){
|
||||
case ENTITY_LIGHT_PWM:
|
||||
sprintf(tmp,"%s light %i",CFG_GetShortDeviceName(),index);
|
||||
break;
|
||||
case ENTITY_LIGHT_RGB:
|
||||
case ENTITY_LIGHT_RGBCW:
|
||||
sprintf(tmp,"%s light %i",CFG_GetShortDeviceName(),index);
|
||||
//There can only be one RGB so we can skip including index in the name
|
||||
sprintf(tmp,"%s light",CFG_GetShortDeviceName());
|
||||
break;
|
||||
case ENTITY_RELAY:
|
||||
//state_topic and command_topic are only for relay
|
||||
|
||||
@@ -1386,20 +1386,20 @@ int http_fn_ha_cfg(http_request_t *request) {
|
||||
}
|
||||
|
||||
hass_print_unique_id(request," - unique_id: \"%s\"\n", ENTITY_LIGHT_RGB,i);
|
||||
hprintf128(request," name: \"%s %i\"\n",shortDeviceName,i);
|
||||
hprintf128(request," rgb_command_template: \"{{ '#%%02x%%02x%%02x0000' | format(red, green, blue)}}\"\n");
|
||||
hprintf128(request," rgb_value_template: \"{{ value[1:3] | int(base=16) }},{{ value[3:5] | int(base=16) }},{{ value[5:7] | int(base=16) }}\"\n");
|
||||
hprintf128(request," rgb_state_topic: \"%s/led_basecolor_rgb/get\"\n",clientId);
|
||||
hprintf128(request," rgb_command_topic: \"cmnd/%s/led_basecolor_rgb\"\n",clientId);
|
||||
hprintf128(request," command_topic: \"cmnd/%s/led_enableAll\"\n",clientId);
|
||||
hprintf128(request," state_topic: \"%s/led_enableAll/get\"\n",clientId);
|
||||
hprintf128(request," availability_topic: \"%s/connected\"\n",clientId);
|
||||
hprintf128(request," payload_on: 1\n");
|
||||
hprintf128(request," payload_off: 0\n");
|
||||
hprintf128(request," brightness_command_topic: \"cmnd/%s/led_dimmer\"\n",clientId);
|
||||
hprintf128(request," brightness_scale: 100\n");
|
||||
hprintf128(request," #brightness_value_template: \"{{ value }}\"\n");
|
||||
|
||||
hprintf128(request," name: \"%s\"\n",shortDeviceName);
|
||||
hprintf128(request," rgb_command_template: \"{{ '#%02x%02x%02x0000' | format(red, green, blue)}}\"\n");
|
||||
hprintf128(request," rgb_state_topic: \"cmnd/%s/led_basecolor_rgb\"\n",clientId);
|
||||
hprintf128(request," rgb_command_topic: \"cmnd/%s/led_basecolor_rgb\"\n",clientId);
|
||||
hprintf128(request," command_topic: \"cmnd/%s/led_enableAll\"\n",clientId);
|
||||
hprintf128(request," availability_topic: \"%s/connected\"\n",clientId);
|
||||
hprintf128(request," payload_on: 1\n");
|
||||
hprintf128(request," payload_off: 0\n");
|
||||
hprintf128(request," brightness_command_topic: \"cmnd/%s/led_dimmer\"\n",clientId);
|
||||
hprintf128(request," brightness_scale: 100\n");
|
||||
hprintf128(request," brightness_value_template: \"{{ value_json.Dimmer }}\"\n");
|
||||
//hprintf128(request," color_temp_command_topic: \"cmnd/%s/led_temperature\"\n",clientId);
|
||||
//hprintf128(request," color_temp_state_topic: \"cmnd/%s/ctr\"\n",clientId);
|
||||
//hprintf128(request," color_temp_value_template: \"{{ value_json.CT }}\"\n");
|
||||
} else if(pwmCount > 0) {
|
||||
|
||||
for(i = 0; i < CHANNEL_MAX; i++) {
|
||||
|
||||
Reference in New Issue
Block a user