Skip to content

Commit

Permalink
Fix tplink number platform to use intended BOX mode (home-assistant#1…
Browse files Browse the repository at this point in the history
…26397)

The NumberMode should be BOX as per the entity description but due to the missing dataclass decorator was resolving to NumberMode.AUTO.
  • Loading branch information
sdb9696 authored and zxdavb committed Sep 21, 2024
1 parent e38e76b commit f723cdb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions homeassistant/components/tplink/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from dataclasses import dataclass
import logging
from typing import Final

Expand All @@ -26,6 +27,7 @@
_LOGGER = logging.getLogger(__name__)


@dataclass(frozen=True, kw_only=True)
class TPLinkNumberEntityDescription(
NumberEntityDescription, TPLinkFeatureEntityDescription
):
Expand Down
16 changes: 8 additions & 8 deletions tests/components/tplink/snapshots/test_number.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
'capabilities': dict({
'max': 65536,
'min': 0,
'mode': <NumberMode.AUTO: 'auto'>,
'mode': <NumberMode.BOX: 'box'>,
'step': 1.0,
}),
'config_entry_id': <ANY>,
Expand Down Expand Up @@ -79,7 +79,7 @@
'friendly_name': 'my_device Smooth off',
'max': 65536,
'min': 0,
'mode': <NumberMode.AUTO: 'auto'>,
'mode': <NumberMode.BOX: 'box'>,
'step': 1.0,
}),
'context': <ANY>,
Expand All @@ -98,7 +98,7 @@
'capabilities': dict({
'max': 65536,
'min': 0,
'mode': <NumberMode.AUTO: 'auto'>,
'mode': <NumberMode.BOX: 'box'>,
'step': 1.0,
}),
'config_entry_id': <ANY>,
Expand Down Expand Up @@ -134,7 +134,7 @@
'friendly_name': 'my_device Smooth on',
'max': 65536,
'min': 0,
'mode': <NumberMode.AUTO: 'auto'>,
'mode': <NumberMode.BOX: 'box'>,
'step': 1.0,
}),
'context': <ANY>,
Expand All @@ -153,7 +153,7 @@
'capabilities': dict({
'max': 65536,
'min': -10,
'mode': <NumberMode.AUTO: 'auto'>,
'mode': <NumberMode.BOX: 'box'>,
'step': 1.0,
}),
'config_entry_id': <ANY>,
Expand Down Expand Up @@ -189,7 +189,7 @@
'friendly_name': 'my_device Temperature offset',
'max': 65536,
'min': -10,
'mode': <NumberMode.AUTO: 'auto'>,
'mode': <NumberMode.BOX: 'box'>,
'step': 1.0,
}),
'context': <ANY>,
Expand All @@ -208,7 +208,7 @@
'capabilities': dict({
'max': 65536,
'min': 0,
'mode': <NumberMode.AUTO: 'auto'>,
'mode': <NumberMode.BOX: 'box'>,
'step': 1.0,
}),
'config_entry_id': <ANY>,
Expand Down Expand Up @@ -244,7 +244,7 @@
'friendly_name': 'my_device Turn off in',
'max': 65536,
'min': 0,
'mode': <NumberMode.AUTO: 'auto'>,
'mode': <NumberMode.BOX: 'box'>,
'step': 1.0,
}),
'context': <ANY>,
Expand Down

0 comments on commit f723cdb

Please sign in to comment.