Skip to content

Commit 1ea609d

Browse files
authored
Merge pull request #130 from cabberley/is_number_patch
Handle import of is_number with fallback
2 parents 710e01e + 8b43501 commit 1ea609d

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Set up Python
2222
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2323
with:
24-
python-version: "3.14"
24+
python-version: "3.13.2"
2525
cache: "pip"
2626

2727
- name: Install requirements

custom_components/utility_meter_next_gen/sensor.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,19 @@
5050
async_track_state_report_event,
5151
)
5252
from homeassistant.helpers.start import async_at_started
53-
from homeassistant.helpers.template import is_number
5453
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
5554
from homeassistant.util import dt as dt_util, slugify
5655
from homeassistant.util.enum import try_parse_enum
5756

57+
try:
58+
from homeassistant.helpers.template.extensions.type_cast import (
59+
TypeCastExtension,
60+
)
61+
62+
is_number = TypeCastExtension.is_number
63+
except ImportError:
64+
from homeassistant.helpers.template import is_number
65+
5866
from .const import (
5967
ATTR_CALC_CURRENT_VALUE,
6068
ATTR_CALC_LAST_VALUE,

0 commit comments

Comments
 (0)