yi-hack-v5
yi-hack-v5 copied to clipboard
mqtt-config ignores MQTT_CLIENT_ID config key
Hi,
I have seen a lot of broker connection problems like this:
2022-08-26T07:29:45: New connection from 10.0.0.202:56495 on port 1883.
2022-08-26T07:29:45: Client 15564 disconnected, not authorised.
After some research I've noticed that mqtt-config process was attempting "anonymous connections". It is not sending any ClientId to the broker.
I executed manually mqtt-config and got:
Ignoring key: MQTT_CLIENT_ID - value: yicamcocheraclientID
Ignoring key: MQTT_PREFIX - value: yicam-cochera
Ignoring key: TOPIC_BIRTH_WILL - value: status
Ignoring key: TOPIC_MOTION - value: motion_detection
Ignoring key: TOPIC_MOTION_IMAGE - value: motion_detection_image
[...]
I can't guess why it is ignoring MQTT_CLIENT_ID key when it is explicitly coded in mqtt-config.c
} else if(strcmp(key, "MQTT_CLIENT_ID")==0) {
conf.client_id = malloc((char) strlen(value) + 1 + 2);
sprintf(conf.client_id, "%s_c", value);
Greetings.
@juacas Please upgrade to v0.3.3