Allow Hue emulation friendly names to go beyond 13

This commit is contained in:
Stephan Hadinger 2019-09-25 18:14:58 +02:00
parent 902dc6b69c
commit 9c885079f0
1 changed files with 8 additions and 5 deletions

View File

@ -364,12 +364,15 @@ void HueLightStatus2(uint8_t device, String *response)
char fname[33];
strcpy(fname, Settings.friendlyname[MAX_FRIENDLYNAMES-1]);
uint32_t fname_len = strlen(fname);
if (fname_len >= 33-3) {
fname[33-3] = 0x00;
fname_len = 33-3;
}
if (fname_len > 30) { fname_len = 30; }
fname[fname_len++] = '-';
if (device - MAX_FRIENDLYNAMES < 10) {
fname[fname_len++] = '0' + device - MAX_FRIENDLYNAMES;
} else {
fname[fname_len++] = 'A' + device - MAX_FRIENDLYNAMES - 10;
}
fname[fname_len] = 0x00;
response->replace("{j1", fname);
}
response->replace("{j2", GetHueDeviceId(device));