bmsd/mqtt.c

changeset 578
e75ce5bbda73
parent 572
7a03181d29a3
child 590
a43b8b85d8b3
equal deleted inserted replaced
577:b4bfed3684d0 578:e75ce5bbda73
1 /***************************************************************************** 1 /*****************************************************************************
2 * Copyright (C) 2017-2019 2 * Copyright (C) 2017-2020
3 * 3 *
4 * Michiel Broek <mbroek at mbse dot eu> 4 * Michiel Broek <mbroek at mbse dot eu>
5 * 5 *
6 * This file is part of the bms (Brewery Management System) 6 * This file is part of the bms (Brewery Management System)
7 * 7 *
101 mosquitto_subscribe(mosq, NULL, topic, 0); 101 mosquitto_subscribe(mosq, NULL, topic, 0);
102 free(topic); 102 free(topic);
103 topic = xstrcpy((char *)"mbv1.0/co2meters/#"); // Subscribe to co2meter messages. 103 topic = xstrcpy((char *)"mbv1.0/co2meters/#"); // Subscribe to co2meter messages.
104 mosquitto_subscribe(mosq, NULL, topic, 0); 104 mosquitto_subscribe(mosq, NULL, topic, 0);
105 free(topic); 105 free(topic);
106 topic = xstrcpy((char *)"ispindel/#"); // Subscribe to ispindel messages. 106 topic = xstrcpy((char *)"mbv1.0/ispindels/#"); // Subscribe to ispindel messages.
107 mosquitto_subscribe(mosq, NULL, topic, 0); 107 mosquitto_subscribe(mosq, NULL, topic, 0);
108 free(topic); 108 free(topic);
109 topic = NULL; 109 topic = NULL;
110 mqtt_status = STATUS_CONNACK_RECVD; 110 mqtt_status = STATUS_CONNACK_RECVD;
111 } else { 111 } else {
181 } 181 }
182 if (strstr(message->topic, (char *)"co2meters") && strstr(message->topic, (char *)"DLOG")) { 182 if (strstr(message->topic, (char *)"co2meters") && strstr(message->topic, (char *)"DLOG")) {
183 co2meter_log(message->topic, (char *)message->payload); 183 co2meter_log(message->topic, (char *)message->payload);
184 return; 184 return;
185 } 185 }
186 if (strstr(message->topic, (char *)"ispindel")) { 186 if (strstr(message->topic, (char *)"ispindels") && strstr(message->topic, (char *)"DBIRTH")) {
187 ispindel_mqtt(message->topic, (char *)message->payload); 187 ispindel_birth_data(message->topic, (char *)message->payload);
188 return;
188 } 189 }
189 syslog(LOG_NOTICE, "MQTT: message callback %s :: %d", message->topic, message->payloadlen); 190 syslog(LOG_NOTICE, "MQTT: message callback %s :: %d", message->topic, message->payloadlen);
190 } else { 191 } else {
191 if (strstr(message->topic, (char *)"NBIRTH")) { 192 if (strstr(message->topic, (char *)"NBIRTH")) {
192 // Ignore ?? 193 // Ignore ??

mercurial