From d3f345f944216da990cd35abd347b706d38a10fb Mon Sep 17 00:00:00 2001 From: 1technophile Date: Sat, 4 May 2019 21:52:17 +0200 Subject: [PATCH] HA mqtt discovery corrections #393 add value template definition when missing and correct wrong payloads --- ZmqttDiscovery.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ZmqttDiscovery.ino b/ZmqttDiscovery.ino index 63506ef..183eb3d 100644 --- a/ZmqttDiscovery.ino +++ b/ZmqttDiscovery.ino @@ -138,7 +138,7 @@ void pubMqttDiscovery() #ifdef ZsensorHCSR501 trc(F("HCSR501Discovery")); - char * HCSR501sensor[8] = {"binary_sensor", "hcsr501", "hcsr501", "","","true", "false", ""}; + char * HCSR501sensor[8] = {"binary_sensor", "hcsr501", "hcsr501", "","{{value_json.hcsr501}}","true", "false", ""}; //component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement trc(F("CreateDiscoverySensor")); @@ -152,7 +152,7 @@ void pubMqttDiscovery() #ifdef ZsensorGPIOInput trc(F("GPIOInputDiscovery")); - char * GPIOInputsensor[8] = {"binary_sensor", "GPIOInput", "GPIOInput", "","","true", "false", ""}; + char * GPIOInputsensor[8] = {"binary_sensor", "GPIOInput", "GPIOInput", "","{{value_json.gpio}}","HIGH", "LOW", ""}; //component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement trc(F("CreateDiscoverySensor")); @@ -338,7 +338,7 @@ void pubMqttDiscovery() #ifdef ZgatewayBT // Sensor to display BT received value trc(F("gatewayBTDiscovery")); - char * gatewayBT[8] = {"sensor", "gatewayBT", "", "","{{ value_json.message }}","", "", ""}; + char * gatewayBT[8] = {"sensor", "gatewayBT", "", "","{{ value_json.id }}","", "", ""}; //component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement trc(F("CreateDiscoverySensor"));