diff --git a/homeassistant/components/counter/__init__.py b/homeassistant/components/counter/__init__.py index 91a90c1aa50..d2834b8991b 100644 --- a/homeassistant/components/counter/__init__.py +++ b/homeassistant/components/counter/__init__.py @@ -245,10 +245,6 @@ class Counter(collection.CollectionEntity, RestoreEntity): and (state := await self.async_get_last_state()) is not None ): self._state = self.compute_next_state(int(state.state)) - self._config[CONF_INITIAL] = state.attributes.get(ATTR_INITIAL) - self._config[CONF_MAXIMUM] = state.attributes.get(ATTR_MAXIMUM) - self._config[CONF_MINIMUM] = state.attributes.get(ATTR_MINIMUM) - self._config[CONF_STEP] = state.attributes.get(ATTR_STEP) @callback def async_decrement(self) -> None: diff --git a/tests/components/counter/test_init.py b/tests/components/counter/test_init.py index 6730b4dec84..097102a341e 100644 --- a/tests/components/counter/test_init.py +++ b/tests/components/counter/test_init.py @@ -307,14 +307,11 @@ async def test_initial_state_overrules_restore_state(hass: HomeAssistant) -> Non async def test_restore_state_overrules_initial_state(hass: HomeAssistant) -> None: """Ensure states are restored on startup.""" - attr = {"initial": 6, "minimum": 1, "maximum": 8, "step": 2} - mock_restore_cache( hass, ( State("counter.test1", "11"), State("counter.test2", "-22"), - State("counter.test3", "5", attr), ), ) @@ -332,14 +329,6 @@ async def test_restore_state_overrules_initial_state(hass: HomeAssistant) -> Non assert state assert int(state.state) == -22 - state = hass.states.get("counter.test3") - assert state - assert int(state.state) == 5 - assert state.attributes.get("initial") == 6 - assert state.attributes.get("minimum") == 1 - assert state.attributes.get("maximum") == 8 - assert state.attributes.get("step") == 2 - async def test_no_initial_state_and_no_restore_state(hass: HomeAssistant) -> None: """Ensure that entity is create without initial and restore feature."""