mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-12-02 11:13:03 +05:00
feat: configure Home Assistant discovery and retry publications
This commit is contained in:
1 parent
65df4b7f5a
commit
8b2678bbbc
17 files changed
+78
-26
No files matched your search
@@ -4,7 +4,7 @@
|
||||
|
||||
HA::Discovery haDiscovery;
|
||||
|
||||
void publishHaEntity(HaEntity entityId, bool remove) {
|
||||
bool publishHaEntity(HaEntity entityId, bool remove) {
|
||||
std::unique_ptr<HA::Component> entity;
|
||||
const UnitSystem unit = settings.system.unitSystem;
|
||||
const uint32_t stateExpiration = std::max<uint32_t>(60u, 2u * settings.mqtt.interval);
|
||||
@@ -837,15 +837,15 @@ void publishHaEntity(HaEntity entityId, bool remove) {
|
||||
}
|
||||
|
||||
default: {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (remove) {
|
||||
haDiscovery.unpublish(std::move(entity));
|
||||
return haDiscovery.unpublish(std::move(entity));
|
||||
|
||||
} else {
|
||||
haDiscovery.publish(std::move(entity));
|
||||
return haDiscovery.publish(std::move(entity));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user