Skip to content

Commit

Permalink
Rename device_state_attributes to extra_state_attributes.
Browse files Browse the repository at this point in the history
This change was made in HA 2021.4, but only started issuing deprecation warnings in 2021.12.
  • Loading branch information
make-all committed Dec 12, 2021
1 parent 60ddbcd commit 175582c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/metlink/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def device_class(self):
return SensorDeviceClass.TIMESTAMP

@property
def device_state_attributes(self) -> Dict[str, Any]:
def extra_state_attributes(self) -> Dict[str, Any]:
return self.attrs

async def async_update(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async def test_async_update_success(hass, aioclient_mock):
}

assert expected == sensor.attrs
assert expected == sensor.device_state_attributes
assert expected == sensor.extra_state_attributes
assert sensor.available is True
assert sensor.icon == "mdi:train"
assert sensor.name == "Metlink WELL"
Expand Down Expand Up @@ -213,7 +213,7 @@ async def test_async_update_multiple(hass, aioclient_mock):
}

assert expected == sensor.attrs
assert expected == sensor.device_state_attributes
assert expected == sensor.extra_state_attributes
assert sensor.available is True
assert sensor.icon == "mdi:train"
assert sensor.name == "Metlink WELL"
Expand Down

0 comments on commit 175582c

Please sign in to comment.