Fix MQTT publishing when mqtt is not configured
This commit is contained in:
parent
0a55298feb
commit
76c06690a2
@ -1 +1 @@
|
|||||||
Subproject commit 8030bb24a8f37d4b6efc4a5ac2751856ee70506b
|
Subproject commit 6ffd79de30164e67f6c059b7a1792bdc3860e973
|
@ -174,21 +174,22 @@ int getGpioFromSubscription(Adafruit_MQTT_Subscribe *subscription, const char *p
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttChangeGpioValue(int gpio, int value) {
|
void MqttNofity(int gpio, int value){
|
||||||
pinMode(gpio, OUTPUT);
|
|
||||||
digitalWrite(gpio, value);
|
|
||||||
int watchIdx = findIndex(gpio, gpioWatched);
|
int watchIdx = findIndex(gpio, gpioWatched);
|
||||||
if (watchIdx >= 0 ) {
|
if (watchIdx >= 0 && isMqttConfigured) {
|
||||||
mqttGpio[watchIdx]->publish(value);
|
mqttGpio[watchIdx]->publish(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MqttChangeGpioValue(int gpio, int value) {
|
||||||
|
pinMode(gpio, OUTPUT);
|
||||||
|
digitalWrite(gpio, value);
|
||||||
|
MqttNofity(gpio, value);
|
||||||
|
}
|
||||||
|
|
||||||
void MqttChangePWMValue(int gpio, int value) {
|
void MqttChangePWMValue(int gpio, int value) {
|
||||||
analogWrite(gpio, value);
|
analogWrite(gpio, value);
|
||||||
int watchIdx = findIndex(gpio, gpioWatched);
|
MqttNofity(gpio, value);
|
||||||
if (watchIdx >= 0 ) {
|
|
||||||
mqttGpio[watchIdx]->publish(value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttCheckSubscription() {
|
void MqttCheckSubscription() {
|
||||||
|
Loading…
Reference in New Issue
Block a user