diff --git a/everblu_meters.c b/everblu_meters.c index bd1028e..93d606f 100644 --- a/everblu_meters.c +++ b/everblu_meters.c @@ -137,8 +137,9 @@ int main(int argc, char *argv[]) sprintf(mqtt_topic, "homeassistant/sensor/cyblemeter_%s/state", meter_id); printf("Liters: %i\n", meter_data.liters); - mosquitto_publish(mosq, NULL, mqtt_topic, strlen(buff),buff,0,false); - + + if(mosquitto_publish(mosq, NULL, mqtt_topic, strlen(buff),buff,0,false) != MOSQ_ERR_SUCCESS) + fprintf(stderr, "ERROR: could not publish message") mosquitto_destroy(mosq); mosquitto_lib_cleanup();