MQTT Topic Variations
Heya,
I've been back to working on my HomeAssistant integration for pulling CAD data, with a focus on moving to MQTT and away from HTTP polling.
It seems there are a few potential MQTT topics where data can be published to. My CAD publishes to SMART/HILD/, but I received a report from someone with a CAD publishing to SMART/DCAD/, and it seems others have CADs publishing to SMART/IGLOO/.
The MQTT server doesn't seem to mind subscribing to multiple potential topics (so I'm currently subscribing to SMART/HILD/ and SMART/DCAD/), but I was wondering if there was a REST API endpoint or similar that could be used to discover the correct topic- it doesn't seem to be exposed through the /resource or /device endpoints.
I released v0.1.0-beta last night which has rough support for smart meter autodiscovery & MQTT streaming, but it's likely this won't work at all until I've had a chance to add better error handling.
Really appreciate any suggestions/feedback on this.
Thanks :)

Comments
If I subscribe to
(obviously with my valid Glow ID) it doesn't matter whether it's HILD or DCAD or IGLOO.
Except that it wont auth - or at least it didn't when I tried.
As for knowing which topic - no sadly there is no programmatic way of knowing .
However just ask - we will tell you and it won't change.
It is an historical accident which can't change without affecting other users.
@clivee
It worked perfectly for me just using `mosquitto_sub` so I've built that into all of my API code. Here's a simple example.
#include <stdio.h> #include <stdint.h> #include <string.h> #include <unistd.h> #include <mosquitto.h> const char* usr = "a@b.com"; const char* pwd = "pwd"; const char* dev = "DEADBEEFCAFE"; void concb(struct mosquitto *mosq, void *obj, int rc) { if (rc) printf("Connect rc=%d\n", rc); } void msgcb(struct mosquitto *mosq, void *obj, const struct mosquitto_message *msg) { printf("Topic: %s\n Payload:", msg->topic); printf("%.*s\n", msg->payloadlen, (char*) msg->payload); } int main(int argc, char* argv[]) { struct mosquitto *mosq; int rc = 0; char topic[23]; mosquitto_lib_init(); mosq = mosquitto_new(NULL, true, 0); if(mosq) { mosquitto_connect_callback_set(mosq, concb); mosquitto_message_callback_set(mosq, msgcb); mosquitto_username_pw_set(mosq, usr, pwd); mosquitto_tls_set(mosq, NULL, "/etc/ssl/certs", NULL, NULL, NULL); mosquitto_tls_opts_set(mosq, 1, NULL, NULL); rc = mosquitto_connect(mosq, "glowmqtt.energyhive.com", 8883, 30); if (rc) printf("connect, rc=%d\n", rc); sprintf(topic, "SMART/+/%s", dev); mosquitto_subscribe(mosq, NULL, topic, 0); for(;;) { rc = mosquitto_loop(mosq, -1, 1); if (rc) { printf("Conn error\n"); sleep(10); mosquitto_reconnect(mosq); } } mosquitto_destroy(mosq); } mosquitto_lib_cleanup(); }