mirror of
https://github.com/alexhopeoconnor/arduino-home-assistant.git
synced 2026-10-22 02:32:11 +10:00
Per-entity availability, deferred discovery publish, suggested precision
- Add HAAvailabilityConfig for per-entity availability_topic and payloads - Defer discovery until MQTT connected; publish availability after discovery - HASensor/HANumber: optional suggested_display_precision in discovery - HASerializer/HADictionary: extend for new keys; update device types and mocks - Docs and examples reflect availability and precision usage - Tests updated for discovery and availability behavior - Ignore .cursor/ in repo root
This commit is contained in:
@@ -676,3 +676,14 @@ void test_SensorNumberTest_publish_precision_mismatch(void) {
|
||||
TEST_ASSERT_EQUAL(mock->getFlushedMessagesNb(), 0);
|
||||
}
|
||||
|
||||
void test_SensorNumberTest_disconnected_value_updates_local_shadow(void) {
|
||||
initMqttTest(testDeviceId)
|
||||
|
||||
HASensorNumber sensor(testUniqueId, HASensorNumber::PrecisionP1);
|
||||
|
||||
TEST_ASSERT_FALSE(sensor.setValue(27.5f));
|
||||
TEST_ASSERT_TRUE(sensor.getCurrentValue().isSet());
|
||||
AHA_ASSERT_NEAR_FLOAT(27.5f, sensor.getCurrentValue().toFloat(), 0.1f);
|
||||
TEST_ASSERT_EQUAL(0, mock->getFlushedMessagesNb());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user