aboutsummaryrefslogtreecommitdiff
path: root/src/entity_binary_sensor.rs
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2026-01-09 11:28:49 +0000
committerdiogo464 <[email protected]>2026-01-09 11:30:08 +0000
commit27779ecf0d7c00ae0acb650c0d75d28edcc3aa89 (patch)
treec9312c4baf2f0f1a9e19b80feb0a7637c31ad5e2 /src/entity_binary_sensor.rs
parent0a1659dbd57180a7c1337d2ec4138f8c29427ce3 (diff)
add mqtt helper functions and refactor buffer management
Created helper functions to eliminate code duplication in MQTT operations: - device_mqtt_subscribe: handles subscription with timeout and error logging - device_mqtt_publish: handles publishing with optional retain flag - mqtt_receive_data: handles data receiving with buffer validation and timeout - publish_entity_discoveries: publishes all entity discoveries - generate_entity_discovery: generates entity discovery payloads Refactored buffer management by introducing DeviceBuffersOwned and DeviceBuffers structures to group related buffers together, making them easier to pass to helper functions. Added MQTT_TIMEOUT constant at module level for consistent timeout handling. Fixed bug where only the last entity's discovery was republished when Home Assistant came back online. Now correctly republishes all entities by subscribing to homeassistant/status and using publish_entity_discoveries when the "online" status is received. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Diffstat (limited to 'src/entity_binary_sensor.rs')
0 files changed, 0 insertions, 0 deletions