From 184134a2cbf69c2fa2e6c7f3df8a13f882c46f8f Mon Sep 17 00:00:00 2001 From: Chris van Marle Date: Thu, 24 Jun 2021 18:18:43 +0200 Subject: [PATCH 1/2] Allow inversion of input GPIO --- main/ZmqttDiscovery.ino | 2 +- main/config_GPIOInput.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/main/ZmqttDiscovery.ino b/main/ZmqttDiscovery.ino index 59d454636f..93cf17cd76 100644 --- a/main/ZmqttDiscovery.ino +++ b/main/ZmqttDiscovery.ino @@ -479,7 +479,7 @@ void pubMqttDiscovery() { # ifdef ZsensorGPIOInput Log.trace(F("GPIOInputDiscovery" CR)); - char* GPIOInputsensor[8] = {"binary_sensor", "GPIOInput", "", "", jsonGpio, "HIGH", "LOW", ""}; + char* GPIOInputsensor[8] = {"binary_sensor", "GPIOInput", "", "", jsonGpio, INPUT_GPIO_ON_VALUE, INPUT_GPIO_OFF_VALUE, ""}; //component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement Log.trace(F("CreateDiscoverySensor" CR)); diff --git a/main/config_GPIOInput.h b/main/config_GPIOInput.h index 56e293f922..941ced8e23 100644 --- a/main/config_GPIOInput.h +++ b/main/config_GPIOInput.h @@ -42,4 +42,7 @@ extern void GPIOInputtoMQTT(); # endif #endif +#define INPUT_GPIO_ON_VALUE "HIGH" +#define INPUT_GPIO_OFF_VALUE "LOW" + #endif From c1b2c87dd8bc0403e02a1e9e243347a3c2e47aa8 Mon Sep 17 00:00:00 2001 From: Chris van Marle Date: Fri, 25 Jun 2021 13:14:22 +0200 Subject: [PATCH 2/2] Fix formatting --- main/config_GPIOInput.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/config_GPIOInput.h b/main/config_GPIOInput.h index 941ced8e23..b7dce135c8 100644 --- a/main/config_GPIOInput.h +++ b/main/config_GPIOInput.h @@ -42,7 +42,7 @@ extern void GPIOInputtoMQTT(); # endif #endif -#define INPUT_GPIO_ON_VALUE "HIGH" +#define INPUT_GPIO_ON_VALUE "HIGH" #define INPUT_GPIO_OFF_VALUE "LOW" #endif