Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RF] Improve Home Assistant auto discoverability #2057

Open
wants to merge 7 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions environments.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
6 changes: 4 additions & 2 deletions main/ZgatewayRF.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
"", "", "", "");
}
Expand Down