Skip to content

Commit 3134d1f

Browse files
shailensobheeclaude
andcommitted
feat: expose hcsr04.enabled + last reading in /discovery
Adds an hcsr04 block to /discovery so the HA integration can decide whether to create the distance sensor entity without probing. Companion change: shailensobhee/ESPSomfy-RTS-ha PR #1. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 305a4b2 commit 3134d1f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Web.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,10 @@ void Web::handleDiscovery(AsyncWebServerRequest *request) {
456456
resp.beginArray("groups");
457457
serializeGroups(resp);
458458
resp.endArray();
459+
resp.beginObject("hcsr04");
460+
resp.addElem("enabled", settings.HCSR04.enabled);
461+
resp.addElem("distanceCm", hcsr04.lastDistanceCm);
462+
resp.endObject();
459463
resp.endObject();
460464
resp.endResponse();
461465
net.needsBroadcast = true;

0 commit comments

Comments
 (0)