on publish error message

This commit is contained in:
leo 2023-07-10 18:53:10 +02:00
parent 4296501979
commit f5f0739313
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB

View File

@ -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();