diff --git a/.github/workflows/hacs.yaml b/.github/workflows/hacs.yaml index 3ad2499..83cc9d5 100644 --- a/.github/workflows/hacs.yaml +++ b/.github/workflows/hacs.yaml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: ⤵️ Check out code from GitHub - uses: actions/checkout@v4.1.2 + uses: actions/checkout@v4.1.3 - name: 🚀 Run HACS validation uses: hacs/action@main diff --git a/.github/workflows/hassfest.yml b/.github/workflows/hassfest.yml index 93bccab..3ad3d41 100644 --- a/.github/workflows/hassfest.yml +++ b/.github/workflows/hassfest.yml @@ -17,7 +17,7 @@ jobs: runs-on: "ubuntu-latest" steps: - name: "Checkout the repository" - uses: "actions/checkout@v4.1.2" + uses: "actions/checkout@v4.1.3" - name: "Run hassfest validation" uses: "home-assistant/actions/hassfest@master" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b39d885..5b1d6fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: id-token: write steps: - name: "Checkout the repository" - uses: "actions/checkout@v4.1.2" + uses: "actions/checkout@v4.1.3" - name: 🔢 Adjust version number shell: bash diff --git a/custom_components/adaptive_cover/__init__.py b/custom_components/adaptive_cover/__init__.py index 8c6a21f..ab1b6c2 100644 --- a/custom_components/adaptive_cover/__init__.py +++ b/custom_components/adaptive_cover/__init__.py @@ -6,7 +6,7 @@ from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers.event import ( - async_track_state_change_event, + async_track_state_change, ) from .const import ( @@ -48,7 +48,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: _entities.append(entity) entry.async_on_unload( - async_track_state_change_event( + async_track_state_change( hass, _entities, coordinator.async_check_entity_state_change, @@ -56,7 +56,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: ) entry.async_on_unload( - async_track_state_change_event( + async_track_state_change( hass, _cover_entities, coordinator.async_check_cover_state_change, diff --git a/custom_components/adaptive_cover/config_flow.py b/custom_components/adaptive_cover/config_flow.py index 942697e..20e6c3a 100644 --- a/custom_components/adaptive_cover/config_flow.py +++ b/custom_components/adaptive_cover/config_flow.py @@ -84,7 +84,7 @@ ), vol.Required(CONF_DEFAULT_HEIGHT, default=60): selector.NumberSelector( selector.NumberSelectorConfig( - min=1, max=100, step=1, mode="slider", unit_of_measurement="%" + min=0, max=100, step=1, mode="slider", unit_of_measurement="%" ) ), vol.Optional(CONF_MAX_POSITION, default=100): selector.NumberSelector( diff --git a/custom_components/adaptive_cover/coordinator.py b/custom_components/adaptive_cover/coordinator.py index 9153f4e..4d71955 100644 --- a/custom_components/adaptive_cover/coordinator.py +++ b/custom_components/adaptive_cover/coordinator.py @@ -13,7 +13,7 @@ SERVICE_SET_COVER_POSITION, SERVICE_SET_COVER_TILT_POSITION, ) -from homeassistant.core import Event, EventStateChangedData, HomeAssistant, State +from homeassistant.core import HomeAssistant, State from homeassistant.helpers.template import state_attr from homeassistant.helpers.update_coordinator import DataUpdateCoordinator @@ -120,21 +120,20 @@ async def async_config_entry_first_refresh(self) -> None: await super().async_config_entry_first_refresh() _LOGGER.debug("Config entry first refresh") - async def async_check_entity_state_change(self) -> None: + async def async_check_entity_state_change( + self, entity: str, old_state: State | None, new_state: State | None + ) -> None: """Fetch and process state change event.""" _LOGGER.debug("Entity state change") self.state_change = True await self.async_refresh() async def async_check_cover_state_change( - self, event: Event[EventStateChangedData] + self, entity: str, old_state: State | None, new_state: State | None ) -> None: """Fetch and process state change event.""" _LOGGER.debug("Cover state change") - data = event.data - self.state_change_data = StateChangedData( - data["entity_id"], data["old_state"], data["new_state"] - ) + self.state_change_data = StateChangedData(entity, old_state, new_state) self.cover_state_change = True self.process_entity_state_change() await self.async_refresh() @@ -304,7 +303,9 @@ def get_blind_data(self): def after_start_time(self): """Check if time is after start time.""" if self.start_time_entity is not None: - time = get_datetime_from_state(get_safe_state(self.start_time_entity)) + time = get_datetime_from_state( + get_safe_state(self.hass, self.start_time_entity) + ) now = dt.datetime.now(dt.UTC) if now.date() == time.date(): return now >= time diff --git a/poetry.lock b/poetry.lock index 9450b31..81f9fae 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1827,28 +1827,28 @@ files = [ [[package]] name = "ruff" -version = "0.3.7" +version = "0.4.1" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:0e8377cccb2f07abd25e84fc5b2cbe48eeb0fea9f1719cad7caedb061d70e5ce"}, - {file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:15a4d1cc1e64e556fa0d67bfd388fed416b7f3b26d5d1c3e7d192c897e39ba4b"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d28bdf3d7dc71dd46929fafeec98ba89b7c3550c3f0978e36389b5631b793663"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:379b67d4f49774ba679593b232dcd90d9e10f04d96e3c8ce4a28037ae473f7bb"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c060aea8ad5ef21cdfbbe05475ab5104ce7827b639a78dd55383a6e9895b7c51"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:ebf8f615dde968272d70502c083ebf963b6781aacd3079081e03b32adfe4d58a"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d48098bd8f5c38897b03604f5428901b65e3c97d40b3952e38637b5404b739a2"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:da8a4fda219bf9024692b1bc68c9cff4b80507879ada8769dc7e985755d662ea"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c44e0149f1d8b48c4d5c33d88c677a4aa22fd09b1683d6a7ff55b816b5d074f"}, - {file = "ruff-0.3.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3050ec0af72b709a62ecc2aca941b9cd479a7bf2b36cc4562f0033d688e44fa1"}, - {file = "ruff-0.3.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a29cc38e4c1ab00da18a3f6777f8b50099d73326981bb7d182e54a9a21bb4ff7"}, - {file = "ruff-0.3.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:5b15cc59c19edca917f51b1956637db47e200b0fc5e6e1878233d3a938384b0b"}, - {file = "ruff-0.3.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e491045781b1e38b72c91247cf4634f040f8d0cb3e6d3d64d38dcf43616650b4"}, - {file = "ruff-0.3.7-py3-none-win32.whl", hash = "sha256:bc931de87593d64fad3a22e201e55ad76271f1d5bfc44e1a1887edd0903c7d9f"}, - {file = "ruff-0.3.7-py3-none-win_amd64.whl", hash = "sha256:5ef0e501e1e39f35e03c2acb1d1238c595b8bb36cf7a170e7c1df1b73da00e74"}, - {file = "ruff-0.3.7-py3-none-win_arm64.whl", hash = "sha256:789e144f6dc7019d1f92a812891c645274ed08af6037d11fc65fcbc183b7d59f"}, - {file = "ruff-0.3.7.tar.gz", hash = "sha256:d5c1aebee5162c2226784800ae031f660c350e7a3402c4d1f8ea4e97e232e3ba"}, + {file = "ruff-0.4.1-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:2d9ef6231e3fbdc0b8c72404a1a0c46fd0dcea84efca83beb4681c318ea6a953"}, + {file = "ruff-0.4.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:9485f54a7189e6f7433e0058cf8581bee45c31a25cd69009d2a040d1bd4bfaef"}, + {file = "ruff-0.4.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d2921ac03ce1383e360e8a95442ffb0d757a6a7ddd9a5be68561a671e0e5807e"}, + {file = "ruff-0.4.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eec8d185fe193ad053eda3a6be23069e0c8ba8c5d20bc5ace6e3b9e37d246d3f"}, + {file = "ruff-0.4.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:baa27d9d72a94574d250f42b7640b3bd2edc4c58ac8ac2778a8c82374bb27984"}, + {file = "ruff-0.4.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:f1ee41580bff1a651339eb3337c20c12f4037f6110a36ae4a2d864c52e5ef954"}, + {file = "ruff-0.4.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0926cefb57fc5fced629603fbd1a23d458b25418681d96823992ba975f050c2b"}, + {file = "ruff-0.4.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2c6e37f2e3cd74496a74af9a4fa67b547ab3ca137688c484749189bf3a686ceb"}, + {file = "ruff-0.4.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:efd703a5975ac1998c2cc5e9494e13b28f31e66c616b0a76e206de2562e0843c"}, + {file = "ruff-0.4.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b92f03b4aa9fa23e1799b40f15f8b95cdc418782a567d6c43def65e1bbb7f1cf"}, + {file = "ruff-0.4.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1c859f294f8633889e7d77de228b203eb0e9a03071b72b5989d89a0cf98ee262"}, + {file = "ruff-0.4.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:b34510141e393519a47f2d7b8216fec747ea1f2c81e85f076e9f2910588d4b64"}, + {file = "ruff-0.4.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:6e68d248ed688b9d69fd4d18737edcbb79c98b251bba5a2b031ce2470224bdf9"}, + {file = "ruff-0.4.1-py3-none-win32.whl", hash = "sha256:b90506f3d6d1f41f43f9b7b5ff845aeefabed6d2494307bc7b178360a8805252"}, + {file = "ruff-0.4.1-py3-none-win_amd64.whl", hash = "sha256:c7d391e5936af5c9e252743d767c564670dc3889aff460d35c518ee76e4b26d7"}, + {file = "ruff-0.4.1-py3-none-win_arm64.whl", hash = "sha256:a1eaf03d87e6a7cd5e661d36d8c6e874693cb9bc3049d110bc9a97b350680c43"}, + {file = "ruff-0.4.1.tar.gz", hash = "sha256:d592116cdbb65f8b1b7e2a2b48297eb865f6bdc20641879aa9d7b9c11d86db79"}, ] [[package]] @@ -2143,4 +2143,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "92247abbae4e159268d2577078d35272c35a0ecd3f1f957d9cbd5ca5a9697684" +content-hash = "aa39e3396e13474a8a0b92f17603d331bcb5c955c7a5bba67ab8146f4f5c87fd" diff --git a/pyproject.toml b/pyproject.toml index a1157bb..cd9ff35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ hass-nabucasa = "0.75.1" pre-commit = "3.7.0" pre-commit-hooks = "4.6.0" pylint = "3.1.0" -ruff = "0.3.7" +ruff = "0.4.1" [tool.poetry.urls] "Bug Tracker" = "https://github.com/basbruss/adaptive-cover/issues"