diff --git a/environments.ini b/environments.ini index e244eef837..6a811f5aa6 100644 --- a/environments.ini +++ b/environments.ini @@ -277,6 +277,7 @@ build_flags = ${com-esp32.build_flags} '-DZgatewayRF="RF"' '-DGateway_Name="OMG_ESP32_RF"' + '-DvalueAsATopic=true' custom_description = RF gateway using RCSwitch library [env:esp32dev-pilight] @@ -1436,6 +1437,7 @@ build_flags = ${com-esp.build_flags} '-DZgatewayRF="RF"' '-DGateway_Name="OMG_ESP8266_RF"' + '-DvalueAsATopic=true' board_build.flash_mode = dout custom_description = The historic RF gateway using RCSwitch library @@ -1453,6 +1455,7 @@ build_flags = '-DZgatewayRF="RF"' '-DZradioCC1101="CC1101"' '-DGateway_Name="OMG_ESP8266_RF-CC1101"' + '-DvalueAsATopic=true' board_build.flash_mode = dout custom_description = RF gateway using RCSwitch library with CC1101 diff --git a/main/ZgatewayRF.ino b/main/ZgatewayRF.ino index 882e916170..24901c4e26 100644 --- a/main/ZgatewayRF.ino +++ b/main/ZgatewayRF.ino @@ -95,12 +95,14 @@ void RFtoMQTTdiscovery(uint64_t MQTTvalue) { String discovery_topic = String(subjectRFtoMQTT); # endif - String theUniqueId = getUniqueId("-" + String(switchRF[0]), "-" + String(switchRF[1])); + String theUniqueId = getUniqueId(String(switchRF[0]), "-" + String(switchRF[1])); + String subType = String(switchRF[0]); announceDeviceTrigger( false, (char*)discovery_topic.c_str(), - "", "", + "received", + (char*)subType.c_str(), (char*)theUniqueId.c_str(), "", "", "", ""); }