File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
homeassistant/components/husqvarna_automower
tests/components/husqvarna_automower Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -541,6 +541,11 @@ def extra_state_attributes(self) -> Mapping[str, Any] | None:
541541 """Return the state attributes."""
542542 return self .entity_description .extra_state_attributes_fn (self .mower_attributes )
543543
544+ @property
545+ def available (self ) -> bool :
546+ """Return the available attribute of the entity."""
547+ return super ().available and self .native_value is not None
548+
544549
545550class WorkAreaSensorEntity (WorkAreaAvailableEntity , SensorEntity ):
546551 """Defining the Work area sensors with WorkAreaSensorEntityDescription."""
Original file line number Diff line number Diff line change 1010from syrupy .assertion import SnapshotAssertion
1111
1212from homeassistant .components .husqvarna_automower .coordinator import SCAN_INTERVAL
13- from homeassistant .const import STATE_UNKNOWN , Platform
13+ from homeassistant .const import STATE_UNAVAILABLE , Platform
1414from homeassistant .core import HomeAssistant
1515from homeassistant .helpers import entity_registry as er
1616
@@ -39,7 +39,7 @@ async def test_sensor_unknown_states(
3939 async_fire_time_changed (hass )
4040 await hass .async_block_till_done ()
4141 state = hass .states .get ("sensor.test_mower_1_mode" )
42- assert state .state == STATE_UNKNOWN
42+ assert state .state == STATE_UNAVAILABLE
4343
4444
4545async def test_cutting_blade_usage_time_sensor (
@@ -78,7 +78,7 @@ async def test_next_start_sensor(
7878 async_fire_time_changed (hass )
7979 await hass .async_block_till_done ()
8080 state = hass .states .get ("sensor.test_mower_1_next_start" )
81- assert state .state == STATE_UNKNOWN
81+ assert state .state == STATE_UNAVAILABLE
8282
8383
8484async def test_work_area_sensor (
You can’t perform that action at this time.
0 commit comments