SamZorSec / Arilux_AL-LC0X

Alternative firmware for Arilux AL-LC0X LED controllers, based on the MQTT protocol and a TLS connection
MIT License
190 stars 33 forks source link

MQTT discovery name gets corrupt #39

Closed oglodyte closed 5 years ago

oglodyte commented 7 years ago

It looks like device name used for MQTT discovery gets corrupt. Here is what I get in the MQTT after some time:

homeassistant/light/ARILUX_LC11_RGBWW_000EDAA8/config {"name":"Arilux LC11 RGBWW LED Controller{\"state\":\"OFF\",\"brightness\":255,\"white_value\":118,\"color\":{\"r\":245,\"g\":3,\"b\":0}}","platform":"mqtt_json","state_topic":"RGBWW/000EDAA8/json/state","command_topic":"RGBWW/000EDAA8/json/set","brightness":true,"rgb":true,"white_value":true}

instead of

homeassistant/light/ARILUX_LC11_RGBWW_000EDAA8/config {"name":"Arilux LC11 RGBWW LED Controller 000EDAA8","platform":"mqtt_json","state_topic":"RGBWW/000EDAA8/json/state","command_topic":"RGBWW/000EDAA8/json/set","brightness":true,"rgb":true,"white_value":true}

IMO the problem is char friendlyName[32]; as length of "Arilux LC11 RGBWW LED Controller 000EDAA8" is > 32

I simply changed it to char friendlyName[48];

will see if it fixes the problem.