Merge branch 'dev_target_triggers_conditions' of github.com:home-assistant/core into light_target_condition

This commit is contained in:
abmantis
2025-08-07 17:43:49 +01:00
280 changed files with 13126 additions and 1208 deletions

View File

@@ -175,7 +175,7 @@ jobs:
sed -i "s|pykrakenapi|# pykrakenapi|g" requirements_all.txt sed -i "s|pykrakenapi|# pykrakenapi|g" requirements_all.txt
- name: Download translations - name: Download translations
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
name: translations name: translations
@@ -190,7 +190,7 @@ jobs:
echo "${{ github.sha }};${{ github.ref }};${{ github.event_name }};${{ github.actor }}" > rootfs/OFFICIAL_IMAGE echo "${{ github.sha }};${{ github.ref }};${{ github.event_name }};${{ github.actor }}" > rootfs/OFFICIAL_IMAGE
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3.4.0 uses: docker/login-action@v3.5.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
@@ -256,7 +256,7 @@ jobs:
fi fi
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3.4.0 uses: docker/login-action@v3.5.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
@@ -330,14 +330,14 @@ jobs:
- name: Login to DockerHub - name: Login to DockerHub
if: matrix.registry == 'docker.io/homeassistant' if: matrix.registry == 'docker.io/homeassistant'
uses: docker/login-action@v3.4.0 uses: docker/login-action@v3.5.0
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
if: matrix.registry == 'ghcr.io/home-assistant' if: matrix.registry == 'ghcr.io/home-assistant'
uses: docker/login-action@v3.4.0 uses: docker/login-action@v3.5.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
@@ -462,7 +462,7 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }} python-version: ${{ env.DEFAULT_PYTHON }}
- name: Download translations - name: Download translations
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
name: translations name: translations
@@ -502,7 +502,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}

View File

@@ -970,7 +970,7 @@ jobs:
run: | run: |
echo "::add-matcher::.github/workflows/matchers/pytest-slow.json" echo "::add-matcher::.github/workflows/matchers/pytest-slow.json"
- name: Download pytest_buckets - name: Download pytest_buckets
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
name: pytest_buckets name: pytest_buckets
- name: Compile English translations - name: Compile English translations
@@ -1336,7 +1336,7 @@ jobs:
- name: Check out code from GitHub - name: Check out code from GitHub
uses: actions/checkout@v4.2.2 uses: actions/checkout@v4.2.2
- name: Download all coverage artifacts - name: Download all coverage artifacts
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
pattern: coverage-* pattern: coverage-*
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
@@ -1486,7 +1486,7 @@ jobs:
- name: Check out code from GitHub - name: Check out code from GitHub
uses: actions/checkout@v4.2.2 uses: actions/checkout@v4.2.2
- name: Download all coverage artifacts - name: Download all coverage artifacts
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
pattern: coverage-* pattern: coverage-*
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
@@ -1511,7 +1511,7 @@ jobs:
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- name: Download all coverage artifacts - name: Download all coverage artifacts
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
pattern: test-results-* pattern: test-results-*
- name: Upload test results to Codecov - name: Upload test results to Codecov

View File

@@ -231,7 +231,7 @@ jobs:
- name: Detect duplicates using AI - name: Detect duplicates using AI
id: ai_detection id: ai_detection
if: steps.extract.outputs.should_continue == 'true' && steps.fetch_similar.outputs.has_similar == 'true' if: steps.extract.outputs.should_continue == 'true' && steps.fetch_similar.outputs.has_similar == 'true'
uses: actions/ai-inference@v1.2.4 uses: actions/ai-inference@v1.2.8
with: with:
model: openai/gpt-4o model: openai/gpt-4o
system-prompt: | system-prompt: |

View File

@@ -57,7 +57,7 @@ jobs:
- name: Detect language using AI - name: Detect language using AI
id: ai_language_detection id: ai_language_detection
if: steps.detect_language.outputs.should_continue == 'true' if: steps.detect_language.outputs.should_continue == 'true'
uses: actions/ai-inference@v1.2.4 uses: actions/ai-inference@v1.2.8
with: with:
model: openai/gpt-4o-mini model: openai/gpt-4o-mini
system-prompt: | system-prompt: |

View File

@@ -138,17 +138,17 @@ jobs:
uses: actions/checkout@v4.2.2 uses: actions/checkout@v4.2.2
- name: Download env_file - name: Download env_file
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
name: env_file name: env_file
- name: Download build_constraints - name: Download build_constraints
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
name: build_constraints name: build_constraints
- name: Download requirements_diff - name: Download requirements_diff
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
name: requirements_diff name: requirements_diff
@@ -187,22 +187,22 @@ jobs:
uses: actions/checkout@v4.2.2 uses: actions/checkout@v4.2.2
- name: Download env_file - name: Download env_file
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
name: env_file name: env_file
- name: Download build_constraints - name: Download build_constraints
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
name: build_constraints name: build_constraints
- name: Download requirements_diff - name: Download requirements_diff
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
name: requirements_diff name: requirements_diff
- name: Download requirements_all_wheels - name: Download requirements_all_wheels
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v5.0.0
with: with:
name: requirements_all_wheels name: requirements_all_wheels

2
CODEOWNERS generated
View File

@@ -1613,8 +1613,6 @@ build.json @home-assistant/supervisor
/tests/components/tplink_omada/ @MarkGodwin /tests/components/tplink_omada/ @MarkGodwin
/homeassistant/components/traccar/ @ludeeus /homeassistant/components/traccar/ @ludeeus
/tests/components/traccar/ @ludeeus /tests/components/traccar/ @ludeeus
/homeassistant/components/traccar_server/ @ludeeus
/tests/components/traccar_server/ @ludeeus
/homeassistant/components/trace/ @home-assistant/core /homeassistant/components/trace/ @home-assistant/core
/tests/components/trace/ @home-assistant/core /tests/components/trace/ @home-assistant/core
/homeassistant/components/tractive/ @Danielhiversen @zhulik @bieniu /homeassistant/components/tractive/ @Danielhiversen @zhulik @bieniu

View File

@@ -120,6 +120,9 @@ class AuthStore:
new_user = models.User(**kwargs) new_user = models.User(**kwargs)
while new_user.id in self._users:
new_user = models.User(**kwargs)
self._users[new_user.id] = new_user self._users[new_user.id] = new_user
if credentials is None: if credentials is None:

View File

@@ -6,11 +6,11 @@ import logging
from typing import Any from typing import Any
from airos.exceptions import ( from airos.exceptions import (
ConnectionAuthenticationError, AirOSConnectionAuthenticationError,
ConnectionSetupError, AirOSConnectionSetupError,
DataMissingError, AirOSDataMissingError,
DeviceConnectionError, AirOSDeviceConnectionError,
KeyDataMissingError, AirOSKeyDataMissingError,
) )
import voluptuous as vol import voluptuous as vol
@@ -59,13 +59,13 @@ class AirOSConfigFlow(ConfigFlow, domain=DOMAIN):
airos_data = await airos_device.status() airos_data = await airos_device.status()
except ( except (
ConnectionSetupError, AirOSConnectionSetupError,
DeviceConnectionError, AirOSDeviceConnectionError,
): ):
errors["base"] = "cannot_connect" errors["base"] = "cannot_connect"
except (ConnectionAuthenticationError, DataMissingError): except (AirOSConnectionAuthenticationError, AirOSDataMissingError):
errors["base"] = "invalid_auth" errors["base"] = "invalid_auth"
except KeyDataMissingError: except AirOSKeyDataMissingError:
errors["base"] = "key_data_missing" errors["base"] = "key_data_missing"
except Exception: except Exception:
_LOGGER.exception("Unexpected exception") _LOGGER.exception("Unexpected exception")

View File

@@ -6,10 +6,10 @@ import logging
from airos.airos8 import AirOS, AirOSData from airos.airos8 import AirOS, AirOSData
from airos.exceptions import ( from airos.exceptions import (
ConnectionAuthenticationError, AirOSConnectionAuthenticationError,
ConnectionSetupError, AirOSConnectionSetupError,
DataMissingError, AirOSDataMissingError,
DeviceConnectionError, AirOSDeviceConnectionError,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
@@ -47,18 +47,22 @@ class AirOSDataUpdateCoordinator(DataUpdateCoordinator[AirOSData]):
try: try:
await self.airos_device.login() await self.airos_device.login()
return await self.airos_device.status() return await self.airos_device.status()
except (ConnectionAuthenticationError,) as err: except (AirOSConnectionAuthenticationError,) as err:
_LOGGER.exception("Error authenticating with airOS device") _LOGGER.exception("Error authenticating with airOS device")
raise ConfigEntryError( raise ConfigEntryError(
translation_domain=DOMAIN, translation_key="invalid_auth" translation_domain=DOMAIN, translation_key="invalid_auth"
) from err ) from err
except (ConnectionSetupError, DeviceConnectionError, TimeoutError) as err: except (
AirOSConnectionSetupError,
AirOSDeviceConnectionError,
TimeoutError,
) as err:
_LOGGER.error("Error connecting to airOS device: %s", err) _LOGGER.error("Error connecting to airOS device: %s", err)
raise UpdateFailed( raise UpdateFailed(
translation_domain=DOMAIN, translation_domain=DOMAIN,
translation_key="cannot_connect", translation_key="cannot_connect",
) from err ) from err
except (DataMissingError,) as err: except (AirOSDataMissingError,) as err:
_LOGGER.error("Expected data not returned by airOS device: %s", err) _LOGGER.error("Expected data not returned by airOS device: %s", err)
raise UpdateFailed( raise UpdateFailed(
translation_domain=DOMAIN, translation_domain=DOMAIN,

View File

@@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/airos", "documentation": "https://www.home-assistant.io/integrations/airos",
"iot_class": "local_polling", "iot_class": "local_polling",
"quality_scale": "bronze", "quality_scale": "bronze",
"requirements": ["airos==0.2.1"] "requirements": ["airos==0.2.4"]
} }

View File

@@ -69,13 +69,6 @@ SENSORS: tuple[AirOSSensorEntityDescription, ...] = (
translation_key="wireless_essid", translation_key="wireless_essid",
value_fn=lambda data: data.wireless.essid, value_fn=lambda data: data.wireless.essid,
), ),
AirOSSensorEntityDescription(
key="wireless_mode",
translation_key="wireless_mode",
device_class=SensorDeviceClass.ENUM,
value_fn=lambda data: data.wireless.mode.value.replace("-", "_").lower(),
options=WIRELESS_MODE_OPTIONS,
),
AirOSSensorEntityDescription( AirOSSensorEntityDescription(
key="wireless_antenna_gain", key="wireless_antenna_gain",
translation_key="wireless_antenna_gain", translation_key="wireless_antenna_gain",

View File

@@ -43,13 +43,6 @@
"wireless_essid": { "wireless_essid": {
"name": "Wireless SSID" "name": "Wireless SSID"
}, },
"wireless_mode": {
"name": "Wireless mode",
"state": {
"ap_ptp": "Access point",
"sta_ptp": "Station"
}
},
"wireless_antenna_gain": { "wireless_antenna_gain": {
"name": "Antenna gain" "name": "Antenna gain"
}, },

View File

@@ -9,7 +9,6 @@ DOMAIN: Final = "amberelectric"
CONF_SITE_NAME = "site_name" CONF_SITE_NAME = "site_name"
CONF_SITE_ID = "site_id" CONF_SITE_ID = "site_id"
ATTR_CONFIG_ENTRY_ID = "config_entry_id"
ATTR_CHANNEL_TYPE = "channel_type" ATTR_CHANNEL_TYPE = "channel_type"
ATTRIBUTION = "Data provided by Amber Electric" ATTRIBUTION = "Data provided by Amber Electric"

View File

@@ -4,6 +4,7 @@ from amberelectric.models.channel import ChannelType
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntryState from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_CONFIG_ENTRY_ID
from homeassistant.core import ( from homeassistant.core import (
HomeAssistant, HomeAssistant,
ServiceCall, ServiceCall,
@@ -16,7 +17,6 @@ from homeassistant.util.json import JsonValueType
from .const import ( from .const import (
ATTR_CHANNEL_TYPE, ATTR_CHANNEL_TYPE,
ATTR_CONFIG_ENTRY_ID,
CONTROLLED_LOAD_CHANNEL, CONTROLLED_LOAD_CHANNEL,
DOMAIN, DOMAIN,
FEED_IN_CHANNEL, FEED_IN_CHANNEL,

View File

@@ -81,11 +81,15 @@ async def async_update_options(
async def async_migrate_integration(hass: HomeAssistant) -> None: async def async_migrate_integration(hass: HomeAssistant) -> None:
"""Migrate integration entry structure.""" """Migrate integration entry structure."""
entries = hass.config_entries.async_entries(DOMAIN) # Make sure we get enabled config entries first
entries = sorted(
hass.config_entries.async_entries(DOMAIN),
key=lambda e: e.disabled_by is not None,
)
if not any(entry.version == 1 for entry in entries): if not any(entry.version == 1 for entry in entries):
return return
api_keys_entries: dict[str, ConfigEntry] = {} api_keys_entries: dict[str, tuple[ConfigEntry, bool]] = {}
entity_registry = er.async_get(hass) entity_registry = er.async_get(hass)
device_registry = dr.async_get(hass) device_registry = dr.async_get(hass)
@@ -99,30 +103,61 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
) )
if entry.data[CONF_API_KEY] not in api_keys_entries: if entry.data[CONF_API_KEY] not in api_keys_entries:
use_existing = True use_existing = True
api_keys_entries[entry.data[CONF_API_KEY]] = entry all_disabled = all(
e.disabled_by is not None
for e in entries
if e.data[CONF_API_KEY] == entry.data[CONF_API_KEY]
)
api_keys_entries[entry.data[CONF_API_KEY]] = (entry, all_disabled)
parent_entry = api_keys_entries[entry.data[CONF_API_KEY]] parent_entry, all_disabled = api_keys_entries[entry.data[CONF_API_KEY]]
hass.config_entries.async_add_subentry(parent_entry, subentry) hass.config_entries.async_add_subentry(parent_entry, subentry)
conversation_entity = entity_registry.async_get_entity_id( conversation_entity_id = entity_registry.async_get_entity_id(
"conversation", "conversation",
DOMAIN, DOMAIN,
entry.entry_id, entry.entry_id,
) )
if conversation_entity is not None:
entity_registry.async_update_entity(
conversation_entity,
config_entry_id=parent_entry.entry_id,
config_subentry_id=subentry.subentry_id,
new_unique_id=subentry.subentry_id,
)
device = device_registry.async_get_device( device = device_registry.async_get_device(
identifiers={(DOMAIN, entry.entry_id)} identifiers={(DOMAIN, entry.entry_id)}
) )
if conversation_entity_id is not None:
conversation_entity_entry = entity_registry.entities[conversation_entity_id]
entity_disabled_by = conversation_entity_entry.disabled_by
if (
entity_disabled_by is er.RegistryEntryDisabler.CONFIG_ENTRY
and not all_disabled
):
# Device and entity registries don't update the disabled_by flag
# when moving a device or entity from one config entry to another,
# so we need to do it manually.
entity_disabled_by = (
er.RegistryEntryDisabler.DEVICE
if device
else er.RegistryEntryDisabler.USER
)
entity_registry.async_update_entity(
conversation_entity_id,
config_entry_id=parent_entry.entry_id,
config_subentry_id=subentry.subentry_id,
disabled_by=entity_disabled_by,
new_unique_id=subentry.subentry_id,
)
if device is not None: if device is not None:
# Device and entity registries don't update the disabled_by flag when
# moving a device or entity from one config entry to another, so we
# need to do it manually.
device_disabled_by = device.disabled_by
if (
device.disabled_by is dr.DeviceEntryDisabler.CONFIG_ENTRY
and not all_disabled
):
device_disabled_by = dr.DeviceEntryDisabler.USER
device_registry.async_update_device( device_registry.async_update_device(
device.id, device.id,
disabled_by=device_disabled_by,
new_identifiers={(DOMAIN, subentry.subentry_id)}, new_identifiers={(DOMAIN, subentry.subentry_id)},
add_config_subentry_id=subentry.subentry_id, add_config_subentry_id=subentry.subentry_id,
add_config_entry_id=parent_entry.entry_id, add_config_entry_id=parent_entry.entry_id,
@@ -147,7 +182,7 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
title=DEFAULT_CONVERSATION_NAME, title=DEFAULT_CONVERSATION_NAME,
options={}, options={},
version=2, version=2,
minor_version=2, minor_version=3,
) )
@@ -173,6 +208,38 @@ async def async_migrate_entry(hass: HomeAssistant, entry: AnthropicConfigEntry)
hass.config_entries.async_update_entry(entry, minor_version=2) hass.config_entries.async_update_entry(entry, minor_version=2)
if entry.version == 2 and entry.minor_version == 2:
# Fix migration where the disabled_by flag was not set correctly.
# We can currently only correct this for enabled config entries,
# because migration does not run for disabled config entries. This
# is asserted in tests, and if that behavior is changed, we should
# correct also disabled config entries.
device_registry = dr.async_get(hass)
entity_registry = er.async_get(hass)
devices = dr.async_entries_for_config_entry(device_registry, entry.entry_id)
entity_entries = er.async_entries_for_config_entry(
entity_registry, entry.entry_id
)
if entry.disabled_by is None:
# If the config entry is not disabled, we need to set the disabled_by
# flag on devices to USER, and on entities to DEVICE, if they are set
# to CONFIG_ENTRY.
for device in devices:
if device.disabled_by is not dr.DeviceEntryDisabler.CONFIG_ENTRY:
continue
device_registry.async_update_device(
device.id,
disabled_by=dr.DeviceEntryDisabler.USER,
)
for entity in entity_entries:
if entity.disabled_by is not er.RegistryEntryDisabler.CONFIG_ENTRY:
continue
entity_registry.async_update_entity(
entity.entity_id,
disabled_by=er.RegistryEntryDisabler.DEVICE,
)
hass.config_entries.async_update_entry(entry, minor_version=3)
LOGGER.debug( LOGGER.debug(
"Migration to version %s:%s successful", entry.version, entry.minor_version "Migration to version %s:%s successful", entry.version, entry.minor_version
) )

View File

@@ -75,7 +75,7 @@ class AnthropicConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Anthropic.""" """Handle a config flow for Anthropic."""
VERSION = 2 VERSION = 2
MINOR_VERSION = 2 MINOR_VERSION = 3
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None

View File

@@ -28,5 +28,5 @@
"documentation": "https://www.home-assistant.io/integrations/august", "documentation": "https://www.home-assistant.io/integrations/august",
"iot_class": "cloud_push", "iot_class": "cloud_push",
"loggers": ["pubnub", "yalexs"], "loggers": ["pubnub", "yalexs"],
"requirements": ["yalexs==8.10.0", "yalexs-ble==3.1.2"] "requirements": ["yalexs==8.11.1", "yalexs-ble==3.1.2"]
} }

View File

@@ -29,7 +29,7 @@
"integration_type": "device", "integration_type": "device",
"iot_class": "local_push", "iot_class": "local_push",
"loggers": ["axis"], "loggers": ["axis"],
"requirements": ["axis==64"], "requirements": ["axis==65"],
"ssdp": [ "ssdp": [
{ {
"manufacturer": "AXIS" "manufacturer": "AXIS"

View File

@@ -25,7 +25,6 @@ SERVICE_TRIGGER = "trigger_camera"
SERVICE_SAVE_VIDEO = "save_video" SERVICE_SAVE_VIDEO = "save_video"
SERVICE_SAVE_RECENT_CLIPS = "save_recent_clips" SERVICE_SAVE_RECENT_CLIPS = "save_recent_clips"
SERVICE_SEND_PIN = "send_pin" SERVICE_SEND_PIN = "send_pin"
ATTR_CONFIG_ENTRY_ID = "config_entry_id"
PLATFORMS = [ PLATFORMS = [
Platform.ALARM_CONTROL_PANEL, Platform.ALARM_CONTROL_PANEL,

View File

@@ -5,12 +5,12 @@ from __future__ import annotations
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntryState from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import CONF_PIN from homeassistant.const import ATTR_CONFIG_ENTRY_ID, CONF_PIN
from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from .const import ATTR_CONFIG_ENTRY_ID, DOMAIN, SERVICE_SEND_PIN from .const import DOMAIN, SERVICE_SEND_PIN
from .coordinator import BlinkConfigEntry from .coordinator import BlinkConfigEntry
SERVICE_SEND_PIN_SCHEMA = vol.Schema( SERVICE_SEND_PIN_SCHEMA = vol.Schema(

View File

@@ -21,6 +21,6 @@
"bluetooth-auto-recovery==1.5.2", "bluetooth-auto-recovery==1.5.2",
"bluetooth-data-tools==1.28.2", "bluetooth-data-tools==1.28.2",
"dbus-fast==2.44.3", "dbus-fast==2.44.3",
"habluetooth==4.0.1" "habluetooth==4.0.2"
] ]
} }

View File

@@ -6,4 +6,3 @@ CONF_INSTALLER_CODE = "installer_code"
CONF_USER_CODE = "user_code" CONF_USER_CODE = "user_code"
ATTR_DATETIME = "datetime" ATTR_DATETIME = "datetime"
SERVICE_SET_DATE_TIME = "set_date_time" SERVICE_SET_DATE_TIME = "set_date_time"
ATTR_CONFIG_ENTRY_ID = "config_entry_id"

View File

@@ -9,12 +9,13 @@ from typing import Any
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntryState from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_CONFIG_ENTRY_ID
from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from homeassistant.util import dt as dt_util from homeassistant.util import dt as dt_util
from .const import ATTR_CONFIG_ENTRY_ID, ATTR_DATETIME, DOMAIN, SERVICE_SET_DATE_TIME from .const import ATTR_DATETIME, DOMAIN, SERVICE_SET_DATE_TIME
from .types import BoschAlarmConfigEntry from .types import BoschAlarmConfigEntry

View File

@@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/caldav", "documentation": "https://www.home-assistant.io/integrations/caldav",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["caldav", "vobject"], "loggers": ["caldav", "vobject"],
"requirements": ["caldav==1.6.0", "icalendar==6.1.0"] "requirements": ["caldav==1.6.0", "icalendar==6.3.1"]
} }

View File

@@ -100,16 +100,10 @@ set_hvac_mode:
fields: fields:
hvac_mode: hvac_mode:
selector: selector:
select: state:
options: hide_states:
- "off" - unavailable
- "auto" - unknown
- "cool"
- "dry"
- "fan_only"
- "heat_cool"
- "heat"
translation_key: hvac_mode
set_swing_mode: set_swing_mode:
target: target:
entity: entity:

View File

@@ -13,6 +13,6 @@
"integration_type": "system", "integration_type": "system",
"iot_class": "cloud_push", "iot_class": "cloud_push",
"loggers": ["acme", "hass_nabucasa", "snitun"], "loggers": ["acme", "hass_nabucasa", "snitun"],
"requirements": ["hass-nabucasa==0.110.1"], "requirements": ["hass-nabucasa==0.111.1"],
"single_config_entry": true "single_config_entry": true
} }

View File

@@ -61,7 +61,7 @@ class DeviceCondition(Condition):
self._hass = hass self._hass = hass
@classmethod @classmethod
async def async_validate_condition_config( async def async_validate_config(
cls, hass: HomeAssistant, config: ConfigType cls, hass: HomeAssistant, config: ConfigType
) -> ConfigType: ) -> ConfigType:
"""Validate device condition config.""" """Validate device condition config."""
@@ -69,7 +69,7 @@ class DeviceCondition(Condition):
hass, config, cv.DEVICE_CONDITION_SCHEMA, DeviceAutomationType.CONDITION hass, config, cv.DEVICE_CONDITION_SCHEMA, DeviceAutomationType.CONDITION
) )
async def async_condition_from_config(self) -> condition.ConditionCheckerType: async def async_get_checker(self) -> condition.ConditionCheckerType:
"""Test a device condition.""" """Test a device condition."""
platform = await async_get_device_automation_platform( platform = await async_get_device_automation_platform(
self._hass, self._config[CONF_DOMAIN], DeviceAutomationType.CONDITION self._hass, self._config[CONF_DOMAIN], DeviceAutomationType.CONDITION
@@ -80,7 +80,7 @@ class DeviceCondition(Condition):
CONDITIONS: dict[str, type[Condition]] = { CONDITIONS: dict[str, type[Condition]] = {
"device": DeviceCondition, "_device": DeviceCondition,
} }

View File

@@ -18,6 +18,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
# If path is relative, we assume relative to Home Assistant config dir # If path is relative, we assume relative to Home Assistant config dir
if not os.path.isabs(download_path): if not os.path.isabs(download_path):
download_path = hass.config.path(download_path) download_path = hass.config.path(download_path)
hass.config_entries.async_update_entry(
entry, data={**entry.data, CONF_DOWNLOAD_DIR: download_path}
)
if not await hass.async_add_executor_job(os.path.isdir, download_path): if not await hass.async_add_executor_job(os.path.isdir, download_path):
_LOGGER.error( _LOGGER.error(

View File

@@ -11,6 +11,7 @@ import requests
import voluptuous as vol import voluptuous as vol
from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.exceptions import ServiceValidationError
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.service import async_register_admin_service from homeassistant.helpers.service import async_register_admin_service
from homeassistant.util import raise_if_invalid_filename, raise_if_invalid_path from homeassistant.util import raise_if_invalid_filename, raise_if_invalid_path
@@ -34,24 +35,33 @@ def download_file(service: ServiceCall) -> None:
entry = service.hass.config_entries.async_loaded_entries(DOMAIN)[0] entry = service.hass.config_entries.async_loaded_entries(DOMAIN)[0]
download_path = entry.data[CONF_DOWNLOAD_DIR] download_path = entry.data[CONF_DOWNLOAD_DIR]
url: str = service.data[ATTR_URL]
subdir: str | None = service.data.get(ATTR_SUBDIR)
target_filename: str | None = service.data.get(ATTR_FILENAME)
overwrite: bool = service.data[ATTR_OVERWRITE]
if subdir:
# Check the path
try:
raise_if_invalid_path(subdir)
except ValueError as err:
raise ServiceValidationError(
translation_domain=DOMAIN,
translation_key="subdir_invalid",
translation_placeholders={"subdir": subdir},
) from err
if os.path.isabs(subdir):
raise ServiceValidationError(
translation_domain=DOMAIN,
translation_key="subdir_not_relative",
translation_placeholders={"subdir": subdir},
)
def do_download() -> None: def do_download() -> None:
"""Download the file.""" """Download the file."""
final_path = None
filename = target_filename
try: try:
url = service.data[ATTR_URL]
subdir = service.data.get(ATTR_SUBDIR)
filename = service.data.get(ATTR_FILENAME)
overwrite = service.data.get(ATTR_OVERWRITE)
if subdir:
# Check the path
raise_if_invalid_path(subdir)
final_path = None
req = requests.get(url, stream=True, timeout=10) req = requests.get(url, stream=True, timeout=10)
if req.status_code != HTTPStatus.OK: if req.status_code != HTTPStatus.OK:

View File

@@ -12,6 +12,14 @@
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]" "single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
} }
}, },
"exceptions": {
"subdir_invalid": {
"message": "Invalid subdirectory, got: {subdir}"
},
"subdir_not_relative": {
"message": "Subdirectory must be relative, got: {subdir}"
}
},
"services": { "services": {
"download_file": { "download_file": {
"name": "Download file", "name": "Download file",

View File

@@ -20,7 +20,6 @@ from homeassistant.const import Platform
_LOGGER = logging.getLogger(__package__) _LOGGER = logging.getLogger(__package__)
DOMAIN = "ecobee" DOMAIN = "ecobee"
ATTR_CONFIG_ENTRY_ID = "entry_id"
ATTR_AVAILABLE_SENSORS = "available_sensors" ATTR_AVAILABLE_SENSORS = "available_sensors"
ATTR_ACTIVE_SENSORS = "active_sensors" ATTR_ACTIVE_SENSORS = "active_sensors"

View File

@@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/ecovacs", "documentation": "https://www.home-assistant.io/integrations/ecovacs",
"iot_class": "cloud_push", "iot_class": "cloud_push",
"loggers": ["sleekxmppfs", "sucks", "deebot_client"], "loggers": ["sleekxmppfs", "sucks", "deebot_client"],
"requirements": ["py-sucks==0.9.11", "deebot-client==13.5.0"] "requirements": ["py-sucks==0.9.11", "deebot-client==13.6.0"]
} }

View File

@@ -20,5 +20,5 @@
"documentation": "https://www.home-assistant.io/integrations/frontend", "documentation": "https://www.home-assistant.io/integrations/frontend",
"integration_type": "system", "integration_type": "system",
"quality_scale": "internal", "quality_scale": "internal",
"requirements": ["home-assistant-frontend==20250731.0"] "requirements": ["home-assistant-frontend==20250806.0"]
} }

View File

@@ -123,10 +123,10 @@
}, },
"ai_task_data": { "ai_task_data": {
"initiate_flow": { "initiate_flow": {
"user": "Add Generate data with AI service", "user": "Add AI task",
"reconfigure": "Reconfigure Generate data with AI service" "reconfigure": "Reconfigure AI task"
}, },
"entry_type": "Generate data with AI service", "entry_type": "AI task",
"step": { "step": {
"set_options": { "set_options": {
"data": { "data": {

View File

@@ -86,9 +86,11 @@ UNSUPPORTED_REASONS = {
UNSUPPORTED_SKIP_REPAIR = {"privileged"} UNSUPPORTED_SKIP_REPAIR = {"privileged"}
UNHEALTHY_REASONS = { UNHEALTHY_REASONS = {
"docker", "docker",
"supervisor", "duplicate_os_installation",
"setup", "oserror_bad_message",
"privileged", "privileged",
"setup",
"supervisor",
"untrusted", "untrusted",
} }

View File

@@ -117,35 +117,43 @@
}, },
"unhealthy": { "unhealthy": {
"title": "Unhealthy system - {reason}", "title": "Unhealthy system - {reason}",
"description": "System is currently unhealthy due to {reason}. Use the link to learn more and how to fix this." "description": "System is currently unhealthy due to {reason}. For troubleshooting information, select Learn more."
}, },
"unhealthy_docker": { "unhealthy_docker": {
"title": "Unhealthy system - Docker misconfigured", "title": "Unhealthy system - Docker misconfigured",
"description": "System is currently unhealthy because Docker is configured incorrectly. Use the link to learn more and how to fix this." "description": "System is currently unhealthy because Docker is configured incorrectly. For troubleshooting information, select Learn more."
}, },
"unhealthy_supervisor": { "unhealthy_duplicate_os_installation": {
"title": "Unhealthy system - Supervisor update failed", "description": "System is currently unhealthy because it has detected multiple Home Assistant OS installations. For troubleshooting information, select Learn more.",
"description": "System is currently unhealthy because an attempt to update Supervisor to the latest version has failed. Use the link to learn more and how to fix this." "title": "Unhealthy system - Duplicate Home Assistant OS installation"
}, },
"unhealthy_setup": { "unhealthy_oserror_bad_message": {
"title": "Unhealthy system - Setup failed", "description": "System is currently unhealthy because the operating system has reported an OS error: Bad message. For troubleshooting information, select Learn more.",
"description": "System is currently unhealthy because setup failed to complete. There are a number of reasons this can occur, use the link to learn more and how to fix this." "title": "Unhealthy system - Operating System error: Bad message"
}, },
"unhealthy_privileged": { "unhealthy_privileged": {
"title": "Unhealthy system - Not privileged", "title": "Unhealthy system - Not privileged",
"description": "System is currently unhealthy because it does not have privileged access to the docker runtime. Use the link to learn more and how to fix this." "description": "System is currently unhealthy because it does not have privileged access to the docker runtime. For troubleshooting information, select Learn more."
},
"unhealthy_setup": {
"title": "Unhealthy system - Setup failed",
"description": "System is currently unhealthy because setup failed to complete. There are a number of reasons this can occur, For troubleshooting information, select Learn more."
},
"unhealthy_supervisor": {
"title": "Unhealthy system - Supervisor update failed",
"description": "System is currently unhealthy because an attempt to update Supervisor to the latest version has failed. For troubleshooting information, select Learn more."
}, },
"unhealthy_untrusted": { "unhealthy_untrusted": {
"title": "Unhealthy system - Untrusted code", "title": "Unhealthy system - Untrusted code",
"description": "System is currently unhealthy because it has detected untrusted code or images in use. Use the link to learn more and how to fix this." "description": "System is currently unhealthy because it has detected untrusted code or images in use. For troubleshooting information, select Learn more."
}, },
"unsupported": { "unsupported": {
"title": "Unsupported system - {reason}", "title": "Unsupported system - {reason}",
"description": "System is unsupported due to {reason}. Use the link to learn more and how to fix this." "description": "System is unsupported due to {reason}. For troubleshooting information, select Learn more."
}, },
"unsupported_apparmor": { "unsupported_apparmor": {
"title": "Unsupported system - AppArmor issues", "title": "Unsupported system - AppArmor issues",
"description": "System is unsupported because AppArmor is working incorrectly and add-ons are running in an unprotected and insecure way. Use the link to learn more and how to fix this." "description": "System is unsupported because AppArmor is working incorrectly and add-ons are running in an unprotected and insecure way. For troubleshooting information, select Learn more."
}, },
"unsupported_cgroup_version": { "unsupported_cgroup_version": {
"title": "Unsupported system - CGroup version", "title": "Unsupported system - CGroup version",
@@ -153,23 +161,23 @@
}, },
"unsupported_connectivity_check": { "unsupported_connectivity_check": {
"title": "Unsupported system - Connectivity check disabled", "title": "Unsupported system - Connectivity check disabled",
"description": "System is unsupported because Home Assistant cannot determine when an Internet connection is available. Use the link to learn more and how to fix this." "description": "System is unsupported because Home Assistant cannot determine when an Internet connection is available. For troubleshooting information, select Learn more."
}, },
"unsupported_content_trust": { "unsupported_content_trust": {
"title": "Unsupported system - Content-trust check disabled", "title": "Unsupported system - Content-trust check disabled",
"description": "System is unsupported because Home Assistant cannot verify content being run is trusted and not modified by attackers. Use the link to learn more and how to fix this." "description": "System is unsupported because Home Assistant cannot verify content being run is trusted and not modified by attackers. For troubleshooting information, select Learn more."
}, },
"unsupported_dbus": { "unsupported_dbus": {
"title": "Unsupported system - D-Bus issues", "title": "Unsupported system - D-Bus issues",
"description": "System is unsupported because D-Bus is working incorrectly. Many things fail without this as Supervisor cannot communicate with the host. Use the link to learn more and how to fix this." "description": "System is unsupported because D-Bus is working incorrectly. Many things fail without this as Supervisor cannot communicate with the host. For troubleshooting information, select Learn more."
}, },
"unsupported_dns_server": { "unsupported_dns_server": {
"title": "Unsupported system - DNS server issues", "title": "Unsupported system - DNS server issues",
"description": "System is unsupported because the provided DNS server does not work correctly and the fallback DNS option has been disabled. Use the link to learn more and how to fix this." "description": "System is unsupported because the provided DNS server does not work correctly and the fallback DNS option has been disabled. For troubleshooting information, select Learn more."
}, },
"unsupported_docker_configuration": { "unsupported_docker_configuration": {
"title": "Unsupported system - Docker misconfigured", "title": "Unsupported system - Docker misconfigured",
"description": "System is unsupported because the Docker daemon is running in an unexpected way. Use the link to learn more and how to fix this." "description": "System is unsupported because the Docker daemon is running in an unexpected way. For troubleshooting information, select Learn more."
}, },
"unsupported_docker_version": { "unsupported_docker_version": {
"title": "Unsupported system - Docker version", "title": "Unsupported system - Docker version",
@@ -177,15 +185,15 @@
}, },
"unsupported_job_conditions": { "unsupported_job_conditions": {
"title": "Unsupported system - Protections disabled", "title": "Unsupported system - Protections disabled",
"description": "System is unsupported because one or more job conditions have been disabled which protect from unexpected failures and breakages. Use the link to learn more and how to fix this." "description": "System is unsupported because one or more job conditions have been disabled which protect from unexpected failures and breakages. For troubleshooting information, select Learn more."
}, },
"unsupported_lxc": { "unsupported_lxc": {
"title": "Unsupported system - LXC detected", "title": "Unsupported system - LXC detected",
"description": "System is unsupported because it is being run in an LXC virtual machine. Use the link to learn more and how to fix this." "description": "System is unsupported because it is being run in an LXC virtual machine. For troubleshooting information, select Learn more."
}, },
"unsupported_network_manager": { "unsupported_network_manager": {
"title": "Unsupported system - Network Manager issues", "title": "Unsupported system - Network Manager issues",
"description": "System is unsupported because Network Manager is missing, inactive or misconfigured. Use the link to learn more and how to fix this." "description": "System is unsupported because Network Manager is missing, inactive or misconfigured. For troubleshooting information, select Learn more."
}, },
"unsupported_os": { "unsupported_os": {
"title": "Unsupported system - Operating System", "title": "Unsupported system - Operating System",
@@ -193,39 +201,43 @@
}, },
"unsupported_os_agent": { "unsupported_os_agent": {
"title": "Unsupported system - OS-Agent issues", "title": "Unsupported system - OS-Agent issues",
"description": "System is unsupported because OS-Agent is missing, inactive or misconfigured. Use the link to learn more and how to fix this." "description": "System is unsupported because OS-Agent is missing, inactive or misconfigured. For troubleshooting information, select Learn more."
}, },
"unsupported_restart_policy": { "unsupported_restart_policy": {
"title": "Unsupported system - Container restart policy", "title": "Unsupported system - Container restart policy",
"description": "System is unsupported because a Docker container has a restart policy set which could cause issues on startup. Use the link to learn more and how to fix this." "description": "System is unsupported because a Docker container has a restart policy set which could cause issues on startup. For troubleshooting information, select Learn more."
}, },
"unsupported_software": { "unsupported_software": {
"title": "Unsupported system - Unsupported software", "title": "Unsupported system - Unsupported software",
"description": "System is unsupported because additional software outside the Home Assistant ecosystem has been detected. Use the link to learn more and how to fix this." "description": "System is unsupported because additional software outside the Home Assistant ecosystem has been detected. For troubleshooting information, select Learn more."
}, },
"unsupported_source_mods": { "unsupported_source_mods": {
"title": "Unsupported system - Supervisor source modifications", "title": "Unsupported system - Supervisor source modifications",
"description": "System is unsupported because Supervisor source code has been modified. Use the link to learn more and how to fix this." "description": "System is unsupported because Supervisor source code has been modified. For troubleshooting information, select Learn more."
}, },
"unsupported_supervisor_version": { "unsupported_supervisor_version": {
"title": "Unsupported system - Supervisor version", "title": "Unsupported system - Supervisor version",
"description": "System is unsupported because an out-of-date version of Supervisor is in use and auto-update has been disabled. Use the link to learn more and how to fix this." "description": "System is unsupported because an out-of-date version of Supervisor is in use and auto-update has been disabled. For troubleshooting information, select Learn more."
}, },
"unsupported_systemd": { "unsupported_systemd": {
"title": "Unsupported system - Systemd issues", "title": "Unsupported system - Systemd issues",
"description": "System is unsupported because Systemd is missing, inactive or misconfigured. Use the link to learn more and how to fix this." "description": "System is unsupported because Systemd is missing, inactive or misconfigured. For troubleshooting information, select Learn more."
}, },
"unsupported_systemd_journal": { "unsupported_systemd_journal": {
"title": "Unsupported system - Systemd Journal issues", "title": "Unsupported system - Systemd Journal issues",
"description": "System is unsupported because Systemd Journal and/or the gateway service is missing, inactive or misconfigured. Use the link to learn more and how to fix this." "description": "System is unsupported because Systemd Journal and/or the gateway service is missing, inactive or misconfigured. For troubleshooting information, select Learn more."
}, },
"unsupported_systemd_resolved": { "unsupported_systemd_resolved": {
"title": "Unsupported system - Systemd-Resolved issues", "title": "Unsupported system - Systemd-Resolved issues",
"description": "System is unsupported because Systemd Resolved is missing, inactive or misconfigured. Use the link to learn more and how to fix this." "description": "System is unsupported because Systemd Resolved is missing, inactive or misconfigured. For troubleshooting information, select Learn more."
}, },
"unsupported_virtualization_image": { "unsupported_virtualization_image": {
"title": "Unsupported system - Incorrect OS image for virtualization", "title": "Unsupported system - Incorrect OS image for virtualization",
"description": "System is unsupported because the Home Assistant OS image in use is not intended for use in a virtualized environment. Use the link to learn more and how to fix this." "description": "System is unsupported because the Home Assistant OS image in use is not intended for use in a virtualized environment. For troubleshooting information, select Learn more."
},
"unsupported_os_version": {
"title": "Unsupported system - Home Assistant OS version",
"description": "System is unsupported because the Home Assistant OS version in use is not supported. For troubleshooting information, select Learn more."
} }
}, },
"entity": { "entity": {

View File

@@ -5,5 +5,5 @@
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/holiday", "documentation": "https://www.home-assistant.io/integrations/holiday",
"iot_class": "local_polling", "iot_class": "local_polling",
"requirements": ["holidays==0.77", "babel==2.15.0"] "requirements": ["holidays==0.78", "babel==2.15.0"]
} }

View File

@@ -24,6 +24,7 @@ import voluptuous as vol
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (
ATTR_CONFIG_ENTRY_ID,
ATTR_HW_VERSION, ATTR_HW_VERSION,
ATTR_MODEL, ATTR_MODEL,
ATTR_SW_VERSION, ATTR_SW_VERSION,
@@ -54,7 +55,6 @@ from homeassistant.helpers.typing import ConfigType
from .const import ( from .const import (
ADMIN_SERVICES, ADMIN_SERVICES,
ALL_KEYS, ALL_KEYS,
ATTR_CONFIG_ENTRY_ID,
CONF_MANUFACTURER, CONF_MANUFACTURER,
CONF_UNAUTHENTICATED_MODE, CONF_UNAUTHENTICATED_MODE,
CONF_UPNP_UDN, CONF_UPNP_UDN,

View File

@@ -2,8 +2,6 @@
DOMAIN = "huawei_lte" DOMAIN = "huawei_lte"
ATTR_CONFIG_ENTRY_ID = "config_entry_id"
CONF_MANUFACTURER = "manufacturer" CONF_MANUFACTURER = "manufacturer"
CONF_TRACK_WIRED_CLIENTS = "track_wired_clients" CONF_TRACK_WIRED_CLIENTS = "track_wired_clients"
CONF_UNAUTHENTICATED_MODE = "unauthenticated_mode" CONF_UNAUTHENTICATED_MODE = "unauthenticated_mode"

View File

@@ -8,12 +8,12 @@ from typing import Any
from huawei_lte_api.exceptions import ResponseErrorException from huawei_lte_api.exceptions import ResponseErrorException
from homeassistant.components.notify import ATTR_TARGET, BaseNotificationService from homeassistant.components.notify import ATTR_TARGET, BaseNotificationService
from homeassistant.const import CONF_RECIPIENT from homeassistant.const import ATTR_CONFIG_ENTRY_ID, CONF_RECIPIENT
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import Router from . import Router
from .const import ATTR_CONFIG_ENTRY_ID, DOMAIN from .const import DOMAIN
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@@ -21,6 +21,20 @@ _LOGGER = logging.getLogger(__name__)
PARALLEL_UPDATES = 1 PARALLEL_UPDATES = 1
async def async_reset_cutting_blade_usage_time(
session: AutomowerSession,
mower_id: str,
) -> None:
"""Reset cutting blade usage time."""
await session.commands.reset_cutting_blade_usage_time(mower_id)
def reset_cutting_blade_usage_time_availability(data: MowerAttributes) -> bool:
"""Return True if blade usage time is greater than 0."""
value = data.statistics.cutting_blade_usage_time
return value is not None and value > 0
@dataclass(frozen=True, kw_only=True) @dataclass(frozen=True, kw_only=True)
class AutomowerButtonEntityDescription(ButtonEntityDescription): class AutomowerButtonEntityDescription(ButtonEntityDescription):
"""Describes Automower button entities.""" """Describes Automower button entities."""
@@ -28,6 +42,7 @@ class AutomowerButtonEntityDescription(ButtonEntityDescription):
available_fn: Callable[[MowerAttributes], bool] = lambda _: True available_fn: Callable[[MowerAttributes], bool] = lambda _: True
exists_fn: Callable[[MowerAttributes], bool] = lambda _: True exists_fn: Callable[[MowerAttributes], bool] = lambda _: True
press_fn: Callable[[AutomowerSession, str], Awaitable[Any]] press_fn: Callable[[AutomowerSession, str], Awaitable[Any]]
poll_after_sending: bool = False
MOWER_BUTTON_TYPES: tuple[AutomowerButtonEntityDescription, ...] = ( MOWER_BUTTON_TYPES: tuple[AutomowerButtonEntityDescription, ...] = (
@@ -43,6 +58,14 @@ MOWER_BUTTON_TYPES: tuple[AutomowerButtonEntityDescription, ...] = (
translation_key="sync_clock", translation_key="sync_clock",
press_fn=lambda session, mower_id: session.commands.set_datetime(mower_id), press_fn=lambda session, mower_id: session.commands.set_datetime(mower_id),
), ),
AutomowerButtonEntityDescription(
key="reset_cutting_blade_usage_time",
translation_key="reset_cutting_blade_usage_time",
available_fn=reset_cutting_blade_usage_time_availability,
exists_fn=lambda data: data.statistics.cutting_blade_usage_time is not None,
press_fn=async_reset_cutting_blade_usage_time,
poll_after_sending=True,
),
) )
@@ -93,3 +116,5 @@ class AutomowerButtonEntity(AutomowerControlEntity, ButtonEntity):
async def async_press(self) -> None: async def async_press(self) -> None:
"""Send a command to the mower.""" """Send a command to the mower."""
await self.entity_description.press_fn(self.coordinator.api, self.mower_id) await self.entity_description.press_fn(self.coordinator.api, self.mower_id)
if self.entity_description.poll_after_sending:
await self.coordinator.async_request_refresh()

View File

@@ -4,7 +4,7 @@ from __future__ import annotations
import asyncio import asyncio
from collections.abc import Callable from collections.abc import Callable
from datetime import timedelta from datetime import datetime, timedelta
import logging import logging
from typing import override from typing import override
@@ -14,7 +14,7 @@ from aioautomower.exceptions import (
HusqvarnaTimeoutError, HusqvarnaTimeoutError,
HusqvarnaWSServerHandshakeError, HusqvarnaWSServerHandshakeError,
) )
from aioautomower.model import MowerDictionary from aioautomower.model import MowerDictionary, MowerStates
from aioautomower.session import AutomowerSession from aioautomower.session import AutomowerSession
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
@@ -29,7 +29,9 @@ _LOGGER = logging.getLogger(__name__)
MAX_WS_RECONNECT_TIME = 600 MAX_WS_RECONNECT_TIME = 600
SCAN_INTERVAL = timedelta(minutes=8) SCAN_INTERVAL = timedelta(minutes=8)
DEFAULT_RECONNECT_TIME = 2 # Define a default reconnect time DEFAULT_RECONNECT_TIME = 2 # Define a default reconnect time
PONG_TIMEOUT = timedelta(seconds=90)
PING_INTERVAL = timedelta(seconds=10)
PING_TIMEOUT = timedelta(seconds=5)
type AutomowerConfigEntry = ConfigEntry[AutomowerDataUpdateCoordinator] type AutomowerConfigEntry = ConfigEntry[AutomowerDataUpdateCoordinator]
@@ -58,6 +60,9 @@ class AutomowerDataUpdateCoordinator(DataUpdateCoordinator[MowerDictionary]):
self.new_devices_callbacks: list[Callable[[set[str]], None]] = [] self.new_devices_callbacks: list[Callable[[set[str]], None]] = []
self.new_zones_callbacks: list[Callable[[str, set[str]], None]] = [] self.new_zones_callbacks: list[Callable[[str, set[str]], None]] = []
self.new_areas_callbacks: list[Callable[[str, set[int]], None]] = [] self.new_areas_callbacks: list[Callable[[str, set[int]], None]] = []
self.pong: datetime | None = None
self.websocket_alive: bool = False
self._watchdog_task: asyncio.Task | None = None
@override @override
@callback @callback
@@ -71,6 +76,18 @@ class AutomowerDataUpdateCoordinator(DataUpdateCoordinator[MowerDictionary]):
await self.api.connect() await self.api.connect()
self.api.register_data_callback(self.handle_websocket_updates) self.api.register_data_callback(self.handle_websocket_updates)
self.ws_connected = True self.ws_connected = True
def start_watchdog() -> None:
if self._watchdog_task is not None and not self._watchdog_task.done():
_LOGGER.debug("Cancelling previous watchdog task")
self._watchdog_task.cancel()
self._watchdog_task = self.config_entry.async_create_background_task(
self.hass,
self._pong_watchdog(),
"websocket_watchdog",
)
self.api.register_ws_ready_callback(start_watchdog)
try: try:
data = await self.api.get_status() data = await self.api.get_status()
except ApiError as err: except ApiError as err:
@@ -93,6 +110,19 @@ class AutomowerDataUpdateCoordinator(DataUpdateCoordinator[MowerDictionary]):
mower_data.capabilities.work_areas for mower_data in self.data.values() mower_data.capabilities.work_areas for mower_data in self.data.values()
): ):
self._async_add_remove_work_areas() self._async_add_remove_work_areas()
if (
not self._should_poll()
and self.update_interval is not None
and self.websocket_alive
):
_LOGGER.debug("All mowers inactive and websocket alive: stop polling")
self.update_interval = None
if self.update_interval is None and self._should_poll():
_LOGGER.debug(
"Polling re-enabled via WebSocket: at least one mower active"
)
self.update_interval = SCAN_INTERVAL
self.hass.async_create_task(self.async_request_refresh())
@callback @callback
def handle_websocket_updates(self, ws_data: MowerDictionary) -> None: def handle_websocket_updates(self, ws_data: MowerDictionary) -> None:
@@ -161,6 +191,30 @@ class AutomowerDataUpdateCoordinator(DataUpdateCoordinator[MowerDictionary]):
"reconnect_task", "reconnect_task",
) )
def _should_poll(self) -> bool:
"""Return True if at least one mower is connected and at least one is not OFF."""
return any(mower.metadata.connected for mower in self.data.values()) and any(
mower.mower.state != MowerStates.OFF for mower in self.data.values()
)
async def _pong_watchdog(self) -> None:
_LOGGER.debug("Watchdog started")
try:
while True:
_LOGGER.debug("Sending ping")
self.websocket_alive = await self.api.send_empty_message()
_LOGGER.debug("Ping result: %s", self.websocket_alive)
await asyncio.sleep(60)
_LOGGER.debug("Websocket alive %s", self.websocket_alive)
if not self.websocket_alive:
_LOGGER.debug("No pong received → restart polling")
if self.update_interval is None:
self.update_interval = SCAN_INTERVAL
await self.async_request_refresh()
except asyncio.CancelledError:
_LOGGER.debug("Watchdog cancelled")
def _async_add_remove_devices(self) -> None: def _async_add_remove_devices(self) -> None:
"""Add new devices and remove orphaned devices from the registry.""" """Add new devices and remove orphaned devices from the registry."""
current_devices = set(self.data) current_devices = set(self.data)

View File

@@ -8,6 +8,9 @@
"button": { "button": {
"sync_clock": { "sync_clock": {
"default": "mdi:clock-check-outline" "default": "mdi:clock-check-outline"
},
"reset_cutting_blade_usage_time": {
"default": "mdi:saw-blade"
} }
}, },
"number": { "number": {

View File

@@ -8,5 +8,5 @@
"iot_class": "cloud_push", "iot_class": "cloud_push",
"loggers": ["aioautomower"], "loggers": ["aioautomower"],
"quality_scale": "silver", "quality_scale": "silver",
"requirements": ["aioautomower==2.1.1"] "requirements": ["aioautomower==2.1.2"]
} }

View File

@@ -53,6 +53,9 @@
}, },
"sync_clock": { "sync_clock": {
"name": "Sync clock" "name": "Sync clock"
},
"reset_cutting_blade_usage_time": {
"name": "Reset cutting blade usage time"
} }
}, },
"number": { "number": {

View File

@@ -42,10 +42,19 @@
"local_name": "Ink@IAM-T1", "local_name": "Ink@IAM-T1",
"connectable": true "connectable": true
}, },
{
"local_name": "Ink@IAM-T2",
"connectable": true
},
{ {
"manufacturer_id": 12628, "manufacturer_id": 12628,
"manufacturer_data_start": [65, 67, 45], "manufacturer_data_start": [65, 67, 45],
"connectable": true "connectable": true
},
{
"manufacturer_id": 12884,
"manufacturer_data_start": [0, 98, 0],
"connectable": false
} }
], ],
"codeowners": ["@bdraco"], "codeowners": ["@bdraco"],
@@ -53,5 +62,5 @@
"dependencies": ["bluetooth_adapters"], "dependencies": ["bluetooth_adapters"],
"documentation": "https://www.home-assistant.io/integrations/inkbird", "documentation": "https://www.home-assistant.io/integrations/inkbird",
"iot_class": "local_push", "iot_class": "local_push",
"requirements": ["inkbird-ble==0.16.2"] "requirements": ["inkbird-ble==1.1.0"]
} }

View File

@@ -13,7 +13,7 @@
"requirements": [ "requirements": [
"xknx==3.8.0", "xknx==3.8.0",
"xknxproject==3.8.2", "xknxproject==3.8.2",
"knx-frontend==2025.7.23.50952" "knx-frontend==2025.8.6.52906"
], ],
"single_config_entry": true "single_config_entry": true
} }

View File

@@ -8,5 +8,5 @@
"iot_class": "cloud_push", "iot_class": "cloud_push",
"loggers": ["letpot"], "loggers": ["letpot"],
"quality_scale": "bronze", "quality_scale": "bronze",
"requirements": ["letpot==0.5.0"] "requirements": ["letpot==0.6.1"]
} }

View File

@@ -12,7 +12,6 @@ DATA_HASS_CONFIG = "mastodon_hass_config"
DEFAULT_URL: Final = "https://mastodon.social" DEFAULT_URL: Final = "https://mastodon.social"
DEFAULT_NAME: Final = "Mastodon" DEFAULT_NAME: Final = "Mastodon"
ATTR_CONFIG_ENTRY_ID = "config_entry_id"
ATTR_STATUS = "status" ATTR_STATUS = "status"
ATTR_VISIBILITY = "visibility" ATTR_VISIBILITY = "visibility"
ATTR_CONTENT_WARNING = "content_warning" ATTR_CONTENT_WARNING = "content_warning"

View File

@@ -9,11 +9,11 @@ from mastodon.Mastodon import MastodonAPIError, MediaAttachment
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntryState from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_CONFIG_ENTRY_ID
from homeassistant.core import HomeAssistant, ServiceCall, ServiceResponse from homeassistant.core import HomeAssistant, ServiceCall, ServiceResponse
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
from .const import ( from .const import (
ATTR_CONFIG_ENTRY_ID,
ATTR_CONTENT_WARNING, ATTR_CONTENT_WARNING,
ATTR_MEDIA, ATTR_MEDIA,
ATTR_MEDIA_DESCRIPTION, ATTR_MEDIA_DESCRIPTION,

View File

@@ -99,6 +99,9 @@
"esa_opt_out_state": { "esa_opt_out_state": {
"default": "mdi:home-lightning-bolt" "default": "mdi:home-lightning-bolt"
}, },
"esa_state": {
"default": "mdi:home-lightning-bolt"
},
"evse_state": { "evse_state": {
"default": "mdi:ev-station" "default": "mdi:ev-station"
}, },

View File

@@ -285,7 +285,9 @@ DISCOVERY_SCHEMAS = [
native_min_value=0.5, native_min_value=0.5,
native_step=0.5, native_step=0.5,
device_to_ha=( device_to_ha=(
lambda x: None if x is None else x / 2 # Matter range (1-200) lambda x: None
if x is None
else min(x, 200) / 2 # Matter range (1-200, capped at 200)
), ),
ha_to_device=lambda x: round(x * 2), # HA range 0.5100.0% ha_to_device=lambda x: round(x * 2), # HA range 0.5100.0%
mode=NumberMode.SLIDER, mode=NumberMode.SLIDER,

View File

@@ -140,11 +140,6 @@ class MatterVacuum(MatterEntity, StateVacuumEntity):
def _update_from_device(self) -> None: def _update_from_device(self) -> None:
"""Update from device.""" """Update from device."""
self._calculate_features() self._calculate_features()
# optional battery level
if VacuumEntityFeature.BATTERY & self._attr_supported_features:
self._attr_battery_level = self.get_matter_attribute_value(
clusters.PowerSource.Attributes.BatPercentRemaining
)
# derive state from the run mode + operational state # derive state from the run mode + operational state
run_mode_raw: int = self.get_matter_attribute_value( run_mode_raw: int = self.get_matter_attribute_value(
clusters.RvcRunMode.Attributes.CurrentMode clusters.RvcRunMode.Attributes.CurrentMode
@@ -188,11 +183,6 @@ class MatterVacuum(MatterEntity, StateVacuumEntity):
supported_features |= VacuumEntityFeature.STATE supported_features |= VacuumEntityFeature.STATE
supported_features |= VacuumEntityFeature.STOP supported_features |= VacuumEntityFeature.STOP
# optional battery attribute = battery feature
if self.get_matter_attribute_value(
clusters.PowerSource.Attributes.BatPercentRemaining
):
supported_features |= VacuumEntityFeature.BATTERY
# optional identify cluster = locate feature (value must be not None or 0) # optional identify cluster = locate feature (value must be not None or 0)
if self.get_matter_attribute_value(clusters.Identify.Attributes.IdentifyType): if self.get_matter_attribute_value(clusters.Identify.Attributes.IdentifyType):
supported_features |= VacuumEntityFeature.LOCATE supported_features |= VacuumEntityFeature.LOCATE
@@ -230,7 +220,6 @@ DISCOVERY_SCHEMAS = [
clusters.RvcRunMode.Attributes.CurrentMode, clusters.RvcRunMode.Attributes.CurrentMode,
clusters.RvcOperationalState.Attributes.OperationalState, clusters.RvcOperationalState.Attributes.OperationalState,
), ),
optional_attributes=(clusters.PowerSource.Attributes.BatPercentRemaining,),
device_type=(device_types.RoboticVacuumCleaner,), device_type=(device_types.RoboticVacuumCleaner,),
allow_none_value=True, allow_none_value=True,
), ),

View File

@@ -8,7 +8,6 @@ DOMAIN = "mealie"
LOGGER = logging.getLogger(__package__) LOGGER = logging.getLogger(__package__)
ATTR_CONFIG_ENTRY_ID = "config_entry_id"
ATTR_START_DATE = "start_date" ATTR_START_DATE = "start_date"
ATTR_END_DATE = "end_date" ATTR_END_DATE = "end_date"
ATTR_RECIPE_ID = "recipe_id" ATTR_RECIPE_ID = "recipe_id"

View File

@@ -13,7 +13,7 @@ from aiomealie import (
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntryState from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_DATE from homeassistant.const import ATTR_CONFIG_ENTRY_ID, ATTR_DATE
from homeassistant.core import ( from homeassistant.core import (
HomeAssistant, HomeAssistant,
ServiceCall, ServiceCall,
@@ -25,7 +25,6 @@ from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from .const import ( from .const import (
ATTR_CONFIG_ENTRY_ID,
ATTR_END_DATE, ATTR_END_DATE,
ATTR_ENTRY_TYPE, ATTR_ENTRY_TYPE,
ATTR_INCLUDE_TAGS, ATTR_INCLUDE_TAGS,

View File

@@ -130,6 +130,7 @@ class MealieShoppingListTodoListEntity(MealieEntity, TodoListEntity):
list_id=self._shopping_list_id, list_id=self._shopping_list_id,
note=item.summary.strip() if item.summary else item.summary, note=item.summary.strip() if item.summary else item.summary,
position=position, position=position,
quantity=0.0,
) )
try: try:
await self.coordinator.client.add_shopping_item(new_shopping_item) await self.coordinator.client.add_shopping_item(new_shopping_item)

View File

@@ -25,7 +25,6 @@ ATTR_APP_DATA = "app_data"
ATTR_APP_ID = "app_id" ATTR_APP_ID = "app_id"
ATTR_APP_NAME = "app_name" ATTR_APP_NAME = "app_name"
ATTR_APP_VERSION = "app_version" ATTR_APP_VERSION = "app_version"
ATTR_CONFIG_ENTRY_ID = "entry_id"
ATTR_DEVICE_NAME = "device_name" ATTR_DEVICE_NAME = "device_name"
ATTR_MANUFACTURER = "manufacturer" ATTR_MANUFACTURER = "manufacturer"
ATTR_MODEL = "model" ATTR_MODEL = "model"

View File

@@ -5,5 +5,5 @@
"documentation": "https://www.home-assistant.io/integrations/modbus", "documentation": "https://www.home-assistant.io/integrations/modbus",
"iot_class": "local_polling", "iot_class": "local_polling",
"loggers": ["pymodbus"], "loggers": ["pymodbus"],
"requirements": ["pymodbus==3.9.2"] "requirements": ["pymodbus==3.11.0"]
} }

View File

@@ -11,7 +11,7 @@
} }
}, },
"triggers": { "triggers": {
"mqtt": { "_": {
"trigger": "mdi:swap-horizontal" "trigger": "mdi:swap-horizontal"
} }
} }

View File

@@ -1,5 +1,9 @@
{ {
"issues": { "issues": {
"deprecated_vacuum_battery_feature": {
"title": "Deprecated battery feature used",
"description": "Vacuum entity {entity_id} implements the battery feature which is deprecated. This will stop working in Home Assistant 2026.2. Implement a separate entity for the battery state instead. To fix the issue, remove the `battery` feature from the configured supported features, and restart Home Assistant."
},
"invalid_platform_config": { "invalid_platform_config": {
"title": "Invalid config found for MQTT {domain} item", "title": "Invalid config found for MQTT {domain} item",
"description": "Home Assistant detected an invalid config for a manually configured item.\n\nPlatform domain: **{domain}**\nConfiguration file: **{config_file}**\nNear line: **{line}**\nConfiguration found:\n```yaml\n{config}\n```\nError: **{error}**.\n\nMake sure the configuration is valid and [reload](/developer-tools/yaml) the manually configured MQTT items or restart Home Assistant to fix this issue." "description": "Home Assistant detected an invalid config for a manually configured item.\n\nPlatform domain: **{domain}**\nConfiguration file: **{config_file}**\nNear line: **{line}**\nConfiguration found:\n```yaml\n{config}\n```\nError: **{error}**.\n\nMake sure the configuration is valid and [reload](/developer-tools/yaml) the manually configured MQTT items or restart Home Assistant to fix this issue."
@@ -1285,7 +1289,7 @@
} }
}, },
"triggers": { "triggers": {
"mqtt": { "_": {
"name": "MQTT", "name": "MQTT",
"description": "When a specific message is received on a given MQTT topic.", "description": "When a specific message is received on a given MQTT topic.",
"description_configured": "When an MQTT message has been received", "description_configured": "When an MQTT message has been received",

View File

@@ -1,6 +1,6 @@
# Describes the format for MQTT triggers # Describes the format for MQTT triggers
mqtt: _:
fields: fields:
payload: payload:
example: "on" example: "on"

View File

@@ -17,7 +17,7 @@ from homeassistant.components.vacuum import (
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_SUPPORTED_FEATURES, CONF_NAME from homeassistant.const import ATTR_SUPPORTED_FEATURES, CONF_NAME
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv, issue_registry as ir
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from homeassistant.helpers.json import json_dumps from homeassistant.helpers.json import json_dumps
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, VolSchemaType from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, VolSchemaType
@@ -25,11 +25,11 @@ from homeassistant.util.json import json_loads_object
from . import subscription from . import subscription
from .config import MQTT_BASE_SCHEMA from .config import MQTT_BASE_SCHEMA
from .const import CONF_COMMAND_TOPIC, CONF_RETAIN, CONF_STATE_TOPIC from .const import CONF_COMMAND_TOPIC, CONF_RETAIN, CONF_STATE_TOPIC, DOMAIN
from .entity import MqttEntity, async_setup_entity_entry_helper from .entity import IssueSeverity, MqttEntity, async_setup_entity_entry_helper
from .models import ReceiveMessage from .models import ReceiveMessage
from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .schemas import MQTT_ENTITY_COMMON_SCHEMA
from .util import valid_publish_topic from .util import learn_more_url, valid_publish_topic
PARALLEL_UPDATES = 0 PARALLEL_UPDATES = 0
@@ -84,6 +84,8 @@ SERVICE_TO_STRING: dict[VacuumEntityFeature, str] = {
VacuumEntityFeature.STOP: "stop", VacuumEntityFeature.STOP: "stop",
VacuumEntityFeature.RETURN_HOME: "return_home", VacuumEntityFeature.RETURN_HOME: "return_home",
VacuumEntityFeature.FAN_SPEED: "fan_speed", VacuumEntityFeature.FAN_SPEED: "fan_speed",
# Use of the battery feature was deprecated in HA Core 2025.8
# and will be removed with HA Core 2026.2
VacuumEntityFeature.BATTERY: "battery", VacuumEntityFeature.BATTERY: "battery",
VacuumEntityFeature.STATUS: "status", VacuumEntityFeature.STATUS: "status",
VacuumEntityFeature.SEND_COMMAND: "send_command", VacuumEntityFeature.SEND_COMMAND: "send_command",
@@ -96,7 +98,6 @@ DEFAULT_SERVICES = (
VacuumEntityFeature.START VacuumEntityFeature.START
| VacuumEntityFeature.STOP | VacuumEntityFeature.STOP
| VacuumEntityFeature.RETURN_HOME | VacuumEntityFeature.RETURN_HOME
| VacuumEntityFeature.BATTERY
| VacuumEntityFeature.CLEAN_SPOT | VacuumEntityFeature.CLEAN_SPOT
) )
ALL_SERVICES = ( ALL_SERVICES = (
@@ -251,10 +252,35 @@ class MqttStateVacuum(MqttEntity, StateVacuumEntity):
) )
} }
async def mqtt_async_added_to_hass(self) -> None:
"""Check for use of deprecated battery features."""
if self.supported_features & VacuumEntityFeature.BATTERY:
ir.async_create_issue(
self.hass,
DOMAIN,
f"deprecated_vacuum_battery_feature_{self.entity_id}",
issue_domain=vacuum.DOMAIN,
breaks_in_ha_version="2026.2",
is_fixable=False,
severity=IssueSeverity.WARNING,
learn_more_url=learn_more_url(vacuum.DOMAIN),
translation_placeholders={"entity_id": self.entity_id},
translation_key="deprecated_vacuum_battery_feature",
)
_LOGGER.warning(
"MQTT vacuum entity %s implements the battery feature "
"which is deprecated. This will stop working "
"in Home Assistant 2026.2. Implement a separate entity "
"for the battery status instead",
self.entity_id,
)
def _update_state_attributes(self, payload: dict[str, Any]) -> None: def _update_state_attributes(self, payload: dict[str, Any]) -> None:
"""Update the entity state attributes.""" """Update the entity state attributes."""
self._state_attrs.update(payload) self._state_attrs.update(payload)
self._attr_fan_speed = self._state_attrs.get(FAN_SPEED, 0) self._attr_fan_speed = self._state_attrs.get(FAN_SPEED, 0)
# Use of the battery feature was deprecated in HA Core 2025.8
# and will be removed with HA Core 2026.2
self._attr_battery_level = max(0, min(100, self._state_attrs.get(BATTERY, 0))) self._attr_battery_level = max(0, min(100, self._state_attrs.get(BATTERY, 0)))
@callback @callback

View File

@@ -8,6 +8,7 @@ from music_assistant_models.enums import MediaType
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntryState from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_CONFIG_ENTRY_ID
from homeassistant.core import ( from homeassistant.core import (
HomeAssistant, HomeAssistant,
ServiceCall, ServiceCall,
@@ -24,7 +25,6 @@ from .const import (
ATTR_ALBUMS, ATTR_ALBUMS,
ATTR_ARTISTS, ATTR_ARTISTS,
ATTR_AUDIOBOOKS, ATTR_AUDIOBOOKS,
ATTR_CONFIG_ENTRY_ID,
ATTR_FAVORITE, ATTR_FAVORITE,
ATTR_ITEMS, ATTR_ITEMS,
ATTR_LIBRARY_ONLY, ATTR_LIBRARY_ONLY,

View File

@@ -26,7 +26,6 @@ ATTR_OFFSET = "offset"
ATTR_ORDER_BY = "order_by" ATTR_ORDER_BY = "order_by"
ATTR_ALBUM_TYPE = "album_type" ATTR_ALBUM_TYPE = "album_type"
ATTR_ALBUM_ARTISTS_ONLY = "album_artists_only" ATTR_ALBUM_ARTISTS_ONLY = "album_artists_only"
ATTR_CONFIG_ENTRY_ID = "config_entry_id"
ATTR_URI = "uri" ATTR_URI = "uri"
ATTR_IMAGE = "image" ATTR_IMAGE = "image"
ATTR_VERSION = "version" ATTR_VERSION = "version"

View File

@@ -92,11 +92,15 @@ async def async_update_options(hass: HomeAssistant, entry: OllamaConfigEntry) ->
async def async_migrate_integration(hass: HomeAssistant) -> None: async def async_migrate_integration(hass: HomeAssistant) -> None:
"""Migrate integration entry structure.""" """Migrate integration entry structure."""
entries = hass.config_entries.async_entries(DOMAIN) # Make sure we get enabled config entries first
entries = sorted(
hass.config_entries.async_entries(DOMAIN),
key=lambda e: e.disabled_by is not None,
)
if not any(entry.version == 1 for entry in entries): if not any(entry.version == 1 for entry in entries):
return return
api_keys_entries: dict[str, ConfigEntry] = {} url_entries: dict[str, tuple[ConfigEntry, bool]] = {}
entity_registry = er.async_get(hass) entity_registry = er.async_get(hass)
device_registry = dr.async_get(hass) device_registry = dr.async_get(hass)
@@ -112,33 +116,64 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
title=entry.title, title=entry.title,
unique_id=None, unique_id=None,
) )
if entry.data[CONF_URL] not in api_keys_entries: if entry.data[CONF_URL] not in url_entries:
use_existing = True use_existing = True
api_keys_entries[entry.data[CONF_URL]] = entry all_disabled = all(
e.disabled_by is not None
for e in entries
if e.data[CONF_URL] == entry.data[CONF_URL]
)
url_entries[entry.data[CONF_URL]] = (entry, all_disabled)
parent_entry = api_keys_entries[entry.data[CONF_URL]] parent_entry, all_disabled = url_entries[entry.data[CONF_URL]]
hass.config_entries.async_add_subentry(parent_entry, subentry) hass.config_entries.async_add_subentry(parent_entry, subentry)
conversation_entity = entity_registry.async_get_entity_id( conversation_entity_id = entity_registry.async_get_entity_id(
"conversation", "conversation",
DOMAIN, DOMAIN,
entry.entry_id, entry.entry_id,
) )
if conversation_entity is not None:
entity_registry.async_update_entity(
conversation_entity,
config_entry_id=parent_entry.entry_id,
config_subentry_id=subentry.subentry_id,
new_unique_id=subentry.subentry_id,
)
device = device_registry.async_get_device( device = device_registry.async_get_device(
identifiers={(DOMAIN, entry.entry_id)} identifiers={(DOMAIN, entry.entry_id)}
) )
if conversation_entity_id is not None:
conversation_entity_entry = entity_registry.entities[conversation_entity_id]
entity_disabled_by = conversation_entity_entry.disabled_by
if (
entity_disabled_by is er.RegistryEntryDisabler.CONFIG_ENTRY
and not all_disabled
):
# Device and entity registries don't update the disabled_by flag
# when moving a device or entity from one config entry to another,
# so we need to do it manually.
entity_disabled_by = (
er.RegistryEntryDisabler.DEVICE
if device
else er.RegistryEntryDisabler.USER
)
entity_registry.async_update_entity(
conversation_entity_id,
config_entry_id=parent_entry.entry_id,
config_subentry_id=subentry.subentry_id,
disabled_by=entity_disabled_by,
new_unique_id=subentry.subentry_id,
)
if device is not None: if device is not None:
# Device and entity registries don't update the disabled_by flag when
# moving a device or entity from one config entry to another, so we
# need to do it manually.
device_disabled_by = device.disabled_by
if (
device.disabled_by is dr.DeviceEntryDisabler.CONFIG_ENTRY
and not all_disabled
):
device_disabled_by = dr.DeviceEntryDisabler.USER
device_registry.async_update_device( device_registry.async_update_device(
device.id, device.id,
disabled_by=device_disabled_by,
new_identifiers={(DOMAIN, subentry.subentry_id)}, new_identifiers={(DOMAIN, subentry.subentry_id)},
add_config_subentry_id=subentry.subentry_id, add_config_subentry_id=subentry.subentry_id,
add_config_entry_id=parent_entry.entry_id, add_config_entry_id=parent_entry.entry_id,
@@ -158,6 +193,7 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
if not use_existing: if not use_existing:
await hass.config_entries.async_remove(entry.entry_id) await hass.config_entries.async_remove(entry.entry_id)
else: else:
_add_ai_task_subentry(hass, entry)
hass.config_entries.async_update_entry( hass.config_entries.async_update_entry(
entry, entry,
title=DEFAULT_NAME, title=DEFAULT_NAME,
@@ -165,7 +201,7 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
data={CONF_URL: entry.data[CONF_URL]}, data={CONF_URL: entry.data[CONF_URL]},
options={}, options={},
version=3, version=3,
minor_version=1, minor_version=3,
) )
@@ -211,32 +247,69 @@ async def async_migrate_entry(hass: HomeAssistant, entry: OllamaConfigEntry) ->
) )
if entry.version == 3 and entry.minor_version == 1: if entry.version == 3 and entry.minor_version == 1:
# Add AI Task subentry with default options. We can only create a new _add_ai_task_subentry(hass, entry)
# subentry if we can find an existing model in the entry. The model
# was removed in the previous migration step, so we need to
# check the subentries for an existing model.
existing_model = next(
iter(
model
for subentry in entry.subentries.values()
if (model := subentry.data.get(CONF_MODEL)) is not None
),
None,
)
if existing_model:
hass.config_entries.async_add_subentry(
entry,
ConfigSubentry(
data=MappingProxyType({CONF_MODEL: existing_model}),
subentry_type="ai_task_data",
title=DEFAULT_AI_TASK_NAME,
unique_id=None,
),
)
hass.config_entries.async_update_entry(entry, minor_version=2) hass.config_entries.async_update_entry(entry, minor_version=2)
if entry.version == 3 and entry.minor_version == 2:
# Fix migration where the disabled_by flag was not set correctly.
# We can currently only correct this for enabled config entries,
# because migration does not run for disabled config entries. This
# is asserted in tests, and if that behavior is changed, we should
# correct also disabled config entries.
device_registry = dr.async_get(hass)
entity_registry = er.async_get(hass)
devices = dr.async_entries_for_config_entry(device_registry, entry.entry_id)
entity_entries = er.async_entries_for_config_entry(
entity_registry, entry.entry_id
)
if entry.disabled_by is None:
# If the config entry is not disabled, we need to set the disabled_by
# flag on devices to USER, and on entities to DEVICE, if they are set
# to CONFIG_ENTRY.
for device in devices:
if device.disabled_by is not dr.DeviceEntryDisabler.CONFIG_ENTRY:
continue
device_registry.async_update_device(
device.id,
disabled_by=dr.DeviceEntryDisabler.USER,
)
for entity in entity_entries:
if entity.disabled_by is not er.RegistryEntryDisabler.CONFIG_ENTRY:
continue
entity_registry.async_update_entity(
entity.entity_id,
disabled_by=er.RegistryEntryDisabler.DEVICE,
)
hass.config_entries.async_update_entry(entry, minor_version=3)
_LOGGER.debug( _LOGGER.debug(
"Migration to version %s:%s successful", entry.version, entry.minor_version "Migration to version %s:%s successful", entry.version, entry.minor_version
) )
return True return True
def _add_ai_task_subentry(hass: HomeAssistant, entry: OllamaConfigEntry) -> None:
"""Add AI Task subentry to the config entry."""
# Add AI Task subentry with default options. We can only create a new
# subentry if we can find an existing model in the entry. The model
# was removed in the previous migration step, so we need to
# check the subentries for an existing model.
existing_model = next(
iter(
model
for subentry in entry.subentries.values()
if (model := subentry.data.get(CONF_MODEL)) is not None
),
None,
)
if existing_model:
hass.config_entries.async_add_subentry(
entry,
ConfigSubentry(
data=MappingProxyType({CONF_MODEL: existing_model}),
subentry_type="ai_task_data",
title=DEFAULT_AI_TASK_NAME,
unique_id=None,
),
)

View File

@@ -76,7 +76,7 @@ class OllamaConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Ollama.""" """Handle a config flow for Ollama."""
VERSION = 3 VERSION = 3
MINOR_VERSION = 2 MINOR_VERSION = 3
def __init__(self) -> None: def __init__(self) -> None:
"""Initialize config flow.""" """Initialize config flow."""

View File

@@ -58,10 +58,10 @@
}, },
"ai_task_data": { "ai_task_data": {
"initiate_flow": { "initiate_flow": {
"user": "Add Generate data with AI service", "user": "Add AI task",
"reconfigure": "Reconfigure Generate data with AI service" "reconfigure": "Reconfigure AI task"
}, },
"entry_type": "Generate data with AI service", "entry_type": "AI task",
"step": { "step": {
"set_options": { "set_options": {
"data": { "data": {

View File

@@ -53,8 +53,6 @@ class OneWireEntity(Entity):
"""Return the state attributes of the entity.""" """Return the state attributes of the entity."""
return { return {
"device_file": self._device_file, "device_file": self._device_file,
# raw_value attribute is deprecated and can be removed in 2025.8
"raw_value": self._value_raw,
} }
def _read_value(self) -> str: def _read_value(self) -> str:

View File

@@ -52,9 +52,9 @@
} }
}, },
"initiate_flow": { "initiate_flow": {
"user": "Add Generate data with AI service" "user": "Add AI task"
}, },
"entry_type": "Generate data with AI service", "entry_type": "AI task",
"abort": { "abort": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"unknown": "[%key:common::config_flow::error::unknown%]" "unknown": "[%key:common::config_flow::error::unknown%]"

View File

@@ -272,11 +272,15 @@ async def async_update_options(hass: HomeAssistant, entry: OpenAIConfigEntry) ->
async def async_migrate_integration(hass: HomeAssistant) -> None: async def async_migrate_integration(hass: HomeAssistant) -> None:
"""Migrate integration entry structure.""" """Migrate integration entry structure."""
entries = hass.config_entries.async_entries(DOMAIN) # Make sure we get enabled config entries first
entries = sorted(
hass.config_entries.async_entries(DOMAIN),
key=lambda e: e.disabled_by is not None,
)
if not any(entry.version == 1 for entry in entries): if not any(entry.version == 1 for entry in entries):
return return
api_keys_entries: dict[str, ConfigEntry] = {} api_keys_entries: dict[str, tuple[ConfigEntry, bool]] = {}
entity_registry = er.async_get(hass) entity_registry = er.async_get(hass)
device_registry = dr.async_get(hass) device_registry = dr.async_get(hass)
@@ -290,30 +294,61 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
) )
if entry.data[CONF_API_KEY] not in api_keys_entries: if entry.data[CONF_API_KEY] not in api_keys_entries:
use_existing = True use_existing = True
api_keys_entries[entry.data[CONF_API_KEY]] = entry all_disabled = all(
e.disabled_by is not None
for e in entries
if e.data[CONF_API_KEY] == entry.data[CONF_API_KEY]
)
api_keys_entries[entry.data[CONF_API_KEY]] = (entry, all_disabled)
parent_entry = api_keys_entries[entry.data[CONF_API_KEY]] parent_entry, all_disabled = api_keys_entries[entry.data[CONF_API_KEY]]
hass.config_entries.async_add_subentry(parent_entry, subentry) hass.config_entries.async_add_subentry(parent_entry, subentry)
conversation_entity = entity_registry.async_get_entity_id( conversation_entity_id = entity_registry.async_get_entity_id(
"conversation", "conversation",
DOMAIN, DOMAIN,
entry.entry_id, entry.entry_id,
) )
if conversation_entity is not None:
entity_registry.async_update_entity(
conversation_entity,
config_entry_id=parent_entry.entry_id,
config_subentry_id=subentry.subentry_id,
new_unique_id=subentry.subentry_id,
)
device = device_registry.async_get_device( device = device_registry.async_get_device(
identifiers={(DOMAIN, entry.entry_id)} identifiers={(DOMAIN, entry.entry_id)}
) )
if conversation_entity_id is not None:
conversation_entity_entry = entity_registry.entities[conversation_entity_id]
entity_disabled_by = conversation_entity_entry.disabled_by
if (
entity_disabled_by is er.RegistryEntryDisabler.CONFIG_ENTRY
and not all_disabled
):
# Device and entity registries don't update the disabled_by flag
# when moving a device or entity from one config entry to another,
# so we need to do it manually.
entity_disabled_by = (
er.RegistryEntryDisabler.DEVICE
if device
else er.RegistryEntryDisabler.USER
)
entity_registry.async_update_entity(
conversation_entity_id,
config_entry_id=parent_entry.entry_id,
config_subentry_id=subentry.subentry_id,
disabled_by=entity_disabled_by,
new_unique_id=subentry.subentry_id,
)
if device is not None: if device is not None:
# Device and entity registries don't update the disabled_by flag when
# moving a device or entity from one config entry to another, so we
# need to do it manually.
device_disabled_by = device.disabled_by
if (
device.disabled_by is dr.DeviceEntryDisabler.CONFIG_ENTRY
and not all_disabled
):
device_disabled_by = dr.DeviceEntryDisabler.USER
device_registry.async_update_device( device_registry.async_update_device(
device.id, device.id,
disabled_by=device_disabled_by,
new_identifiers={(DOMAIN, subentry.subentry_id)}, new_identifiers={(DOMAIN, subentry.subentry_id)},
add_config_subentry_id=subentry.subentry_id, add_config_subentry_id=subentry.subentry_id,
add_config_entry_id=parent_entry.entry_id, add_config_entry_id=parent_entry.entry_id,
@@ -333,12 +368,13 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
if not use_existing: if not use_existing:
await hass.config_entries.async_remove(entry.entry_id) await hass.config_entries.async_remove(entry.entry_id)
else: else:
_add_ai_task_subentry(hass, entry)
hass.config_entries.async_update_entry( hass.config_entries.async_update_entry(
entry, entry,
title=DEFAULT_NAME, title=DEFAULT_NAME,
options={}, options={},
version=2, version=2,
minor_version=2, minor_version=4,
) )
@@ -365,19 +401,56 @@ async def async_migrate_entry(hass: HomeAssistant, entry: OpenAIConfigEntry) ->
hass.config_entries.async_update_entry(entry, minor_version=2) hass.config_entries.async_update_entry(entry, minor_version=2)
if entry.version == 2 and entry.minor_version == 2: if entry.version == 2 and entry.minor_version == 2:
hass.config_entries.async_add_subentry( _add_ai_task_subentry(hass, entry)
entry,
ConfigSubentry(
data=MappingProxyType(RECOMMENDED_AI_TASK_OPTIONS),
subentry_type="ai_task_data",
title=DEFAULT_AI_TASK_NAME,
unique_id=None,
),
)
hass.config_entries.async_update_entry(entry, minor_version=3) hass.config_entries.async_update_entry(entry, minor_version=3)
if entry.version == 2 and entry.minor_version == 3:
# Fix migration where the disabled_by flag was not set correctly.
# We can currently only correct this for enabled config entries,
# because migration does not run for disabled config entries. This
# is asserted in tests, and if that behavior is changed, we should
# correct also disabled config entries.
device_registry = dr.async_get(hass)
entity_registry = er.async_get(hass)
devices = dr.async_entries_for_config_entry(device_registry, entry.entry_id)
entity_entries = er.async_entries_for_config_entry(
entity_registry, entry.entry_id
)
if entry.disabled_by is None:
# If the config entry is not disabled, we need to set the disabled_by
# flag on devices to USER, and on entities to DEVICE, if they are set
# to CONFIG_ENTRY.
for device in devices:
if device.disabled_by is not dr.DeviceEntryDisabler.CONFIG_ENTRY:
continue
device_registry.async_update_device(
device.id,
disabled_by=dr.DeviceEntryDisabler.USER,
)
for entity in entity_entries:
if entity.disabled_by is not er.RegistryEntryDisabler.CONFIG_ENTRY:
continue
entity_registry.async_update_entity(
entity.entity_id,
disabled_by=er.RegistryEntryDisabler.DEVICE,
)
hass.config_entries.async_update_entry(entry, minor_version=4)
LOGGER.debug( LOGGER.debug(
"Migration to version %s:%s successful", entry.version, entry.minor_version "Migration to version %s:%s successful", entry.version, entry.minor_version
) )
return True return True
def _add_ai_task_subentry(hass: HomeAssistant, entry: OpenAIConfigEntry) -> None:
"""Add AI Task subentry to the config entry."""
hass.config_entries.async_add_subentry(
entry,
ConfigSubentry(
data=MappingProxyType(RECOMMENDED_AI_TASK_OPTIONS),
subentry_type="ai_task_data",
title=DEFAULT_AI_TASK_NAME,
unique_id=None,
),
)

View File

@@ -98,7 +98,7 @@ class OpenAIConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for OpenAI Conversation.""" """Handle a config flow for OpenAI Conversation."""
VERSION = 2 VERSION = 2
MINOR_VERSION = 3 MINOR_VERSION = 4
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None

View File

@@ -73,10 +73,10 @@
}, },
"ai_task_data": { "ai_task_data": {
"initiate_flow": { "initiate_flow": {
"user": "Add Generate data with AI service", "user": "Add AI task",
"reconfigure": "Reconfigure Generate data with AI service" "reconfigure": "Reconfigure AI task"
}, },
"entry_type": "Generate data with AI service", "entry_type": "AI task",
"step": { "step": {
"init": { "init": {
"data": { "data": {

View File

@@ -9,6 +9,8 @@ from typing import Any
from opower import ( from opower import (
CannotConnect, CannotConnect,
InvalidAuth, InvalidAuth,
MfaChallenge,
MfaHandlerBase,
Opower, Opower,
create_cookie_jar, create_cookie_jar,
get_supported_utility_names, get_supported_utility_names,
@@ -16,49 +18,34 @@ from opower import (
) )
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_NAME, CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_NAME, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.aiohttp_client import async_create_clientsession from homeassistant.helpers.aiohttp_client import async_create_clientsession
from homeassistant.helpers.typing import VolDictType from homeassistant.helpers.typing import VolDictType
from .const import CONF_TOTP_SECRET, CONF_UTILITY, DOMAIN from .const import CONF_LOGIN_DATA, CONF_TOTP_SECRET, CONF_UTILITY, DOMAIN
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
CONF_MFA_CODE = "mfa_code"
STEP_USER_DATA_SCHEMA = vol.Schema( CONF_MFA_METHOD = "mfa_method"
{
vol.Required(CONF_UTILITY): vol.In(get_supported_utility_names()),
vol.Required(CONF_USERNAME): str,
vol.Required(CONF_PASSWORD): str,
}
)
async def _validate_login( async def _validate_login(
hass: HomeAssistant, login_data: dict[str, str] hass: HomeAssistant,
) -> dict[str, str]: data: Mapping[str, Any],
"""Validate login data and return any errors.""" ) -> None:
"""Validate login data and raise exceptions on failure."""
api = Opower( api = Opower(
async_create_clientsession(hass, cookie_jar=create_cookie_jar()), async_create_clientsession(hass, cookie_jar=create_cookie_jar()),
login_data[CONF_UTILITY], data[CONF_UTILITY],
login_data[CONF_USERNAME], data[CONF_USERNAME],
login_data[CONF_PASSWORD], data[CONF_PASSWORD],
login_data.get(CONF_TOTP_SECRET), data.get(CONF_TOTP_SECRET),
data.get(CONF_LOGIN_DATA),
) )
errors: dict[str, str] = {} await api.async_login()
try:
await api.async_login()
except InvalidAuth:
_LOGGER.exception(
"Invalid auth when connecting to %s", login_data[CONF_UTILITY]
)
errors["base"] = "invalid_auth"
except CannotConnect:
_LOGGER.exception("Could not connect to %s", login_data[CONF_UTILITY])
errors["base"] = "cannot_connect"
return errors
class OpowerConfigFlow(ConfigFlow, domain=DOMAIN): class OpowerConfigFlow(ConfigFlow, domain=DOMAIN):
@@ -68,81 +55,147 @@ class OpowerConfigFlow(ConfigFlow, domain=DOMAIN):
def __init__(self) -> None: def __init__(self) -> None:
"""Initialize a new OpowerConfigFlow.""" """Initialize a new OpowerConfigFlow."""
self.utility_info: dict[str, Any] | None = None self._data: dict[str, Any] = {}
self.mfa_handler: MfaHandlerBase | None = None
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step (select utility)."""
errors: dict[str, str] = {}
if user_input is not None: if user_input is not None:
self._async_abort_entries_match( self._data[CONF_UTILITY] = user_input[CONF_UTILITY]
{ return await self.async_step_credentials()
CONF_UTILITY: user_input[CONF_UTILITY],
CONF_USERNAME: user_input[CONF_USERNAME],
}
)
if select_utility(user_input[CONF_UTILITY]).accepts_mfa():
self.utility_info = user_input
return await self.async_step_mfa()
errors = await _validate_login(self.hass, user_input)
if not errors:
return self._async_create_opower_entry(user_input)
else:
user_input = {}
user_input.pop(CONF_PASSWORD, None)
return self.async_show_form( return self.async_show_form(
step_id="user", step_id="user",
data_schema=vol.Schema(
{vol.Required(CONF_UTILITY): vol.In(get_supported_utility_names())}
),
)
async def async_step_credentials(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle credentials step."""
errors: dict[str, str] = {}
utility = select_utility(self._data[CONF_UTILITY])
if user_input is not None:
self._data.update(user_input)
self._async_abort_entries_match(
{
CONF_UTILITY: self._data[CONF_UTILITY],
CONF_USERNAME: self._data[CONF_USERNAME],
}
)
try:
await _validate_login(self.hass, self._data)
except MfaChallenge as exc:
self.mfa_handler = exc.handler
return await self.async_step_mfa_options()
except InvalidAuth:
errors["base"] = "invalid_auth"
except CannotConnect:
errors["base"] = "cannot_connect"
else:
return self._async_create_opower_entry(self._data)
schema_dict: VolDictType = {
vol.Required(CONF_USERNAME): str,
vol.Required(CONF_PASSWORD): str,
}
if utility.accepts_totp_secret():
schema_dict[vol.Optional(CONF_TOTP_SECRET)] = str
return self.async_show_form(
step_id="credentials",
data_schema=self.add_suggested_values_to_schema( data_schema=self.add_suggested_values_to_schema(
STEP_USER_DATA_SCHEMA, user_input vol.Schema(schema_dict), user_input
), ),
errors=errors, errors=errors,
) )
async def async_step_mfa( async def async_step_mfa_options(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle MFA step.""" """Handle MFA options step."""
assert self.utility_info is not None errors: dict[str, str] = {}
assert self.mfa_handler is not None
if user_input is not None:
method = user_input[CONF_MFA_METHOD]
try:
await self.mfa_handler.async_select_mfa_option(method)
except CannotConnect:
errors["base"] = "cannot_connect"
else:
return await self.async_step_mfa_code()
mfa_options = await self.mfa_handler.async_get_mfa_options()
if not mfa_options:
return await self.async_step_mfa_code()
return self.async_show_form(
step_id="mfa_options",
data_schema=self.add_suggested_values_to_schema(
vol.Schema({vol.Required(CONF_MFA_METHOD): vol.In(mfa_options)}),
user_input,
),
errors=errors,
)
async def async_step_mfa_code(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle MFA code submission step."""
assert self.mfa_handler is not None
errors: dict[str, str] = {} errors: dict[str, str] = {}
if user_input is not None: if user_input is not None:
data = {**self.utility_info, **user_input} code = user_input[CONF_MFA_CODE]
errors = await _validate_login(self.hass, data) try:
if not errors: login_data = await self.mfa_handler.async_submit_mfa_code(code)
return self._async_create_opower_entry(data) except InvalidAuth:
errors["base"] = "invalid_mfa_code"
if errors: except CannotConnect:
schema = { errors["base"] = "cannot_connect"
vol.Required( else:
CONF_USERNAME, default=self.utility_info[CONF_USERNAME] self._data[CONF_LOGIN_DATA] = login_data
): str, if self.source == SOURCE_REAUTH:
vol.Required(CONF_PASSWORD): str, return self.async_update_reload_and_abort(
} self._get_reauth_entry(), data=self._data
else: )
schema = {} return self._async_create_opower_entry(self._data)
schema[vol.Required(CONF_TOTP_SECRET)] = str
return self.async_show_form( return self.async_show_form(
step_id="mfa", step_id="mfa_code",
data_schema=vol.Schema(schema), data_schema=self.add_suggested_values_to_schema(
vol.Schema({vol.Required(CONF_MFA_CODE): str}), user_input
),
errors=errors, errors=errors,
) )
@callback @callback
def _async_create_opower_entry(self, data: dict[str, Any]) -> ConfigFlowResult: def _async_create_opower_entry(
self, data: dict[str, Any], **kwargs: Any
) -> ConfigFlowResult:
"""Create the config entry.""" """Create the config entry."""
return self.async_create_entry( return self.async_create_entry(
title=f"{data[CONF_UTILITY]} ({data[CONF_USERNAME]})", title=f"{data[CONF_UTILITY]} ({data[CONF_USERNAME]})",
data=data, data=data,
**kwargs,
) )
async def async_step_reauth( async def async_step_reauth(
self, entry_data: Mapping[str, Any] self, entry_data: Mapping[str, Any]
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle configuration by re-auth.""" """Handle configuration by re-auth."""
return await self.async_step_reauth_confirm() reauth_entry = self._get_reauth_entry()
self._data = dict(reauth_entry.data)
return self.async_show_form(
step_id="reauth_confirm",
description_placeholders={CONF_NAME: reauth_entry.title},
)
async def async_step_reauth_confirm( async def async_step_reauth_confirm(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
@@ -150,21 +203,34 @@ class OpowerConfigFlow(ConfigFlow, domain=DOMAIN):
"""Dialog that informs the user that reauth is required.""" """Dialog that informs the user that reauth is required."""
errors: dict[str, str] = {} errors: dict[str, str] = {}
reauth_entry = self._get_reauth_entry() reauth_entry = self._get_reauth_entry()
if user_input is not None:
data = {**reauth_entry.data, **user_input}
errors = await _validate_login(self.hass, data)
if not errors:
return self.async_update_reload_and_abort(reauth_entry, data=data)
schema: VolDictType = { if user_input is not None:
vol.Required(CONF_USERNAME): reauth_entry.data[CONF_USERNAME], self._data.update(user_input)
try:
await _validate_login(self.hass, self._data)
except MfaChallenge as exc:
self.mfa_handler = exc.handler
return await self.async_step_mfa_options()
except InvalidAuth:
errors["base"] = "invalid_auth"
except CannotConnect:
errors["base"] = "cannot_connect"
else:
return self.async_update_reload_and_abort(reauth_entry, data=self._data)
utility = select_utility(self._data[CONF_UTILITY])
schema_dict: VolDictType = {
vol.Required(CONF_USERNAME): str,
vol.Required(CONF_PASSWORD): str, vol.Required(CONF_PASSWORD): str,
} }
if select_utility(reauth_entry.data[CONF_UTILITY]).accepts_mfa(): if utility.accepts_totp_secret():
schema[vol.Optional(CONF_TOTP_SECRET)] = str schema_dict[vol.Optional(CONF_TOTP_SECRET)] = str
return self.async_show_form( return self.async_show_form(
step_id="reauth_confirm", step_id="reauth_confirm",
data_schema=vol.Schema(schema), data_schema=self.add_suggested_values_to_schema(
vol.Schema(schema_dict), self._data
),
errors=errors, errors=errors,
description_placeholders={CONF_NAME: reauth_entry.title}, description_placeholders={CONF_NAME: reauth_entry.title},
) )

View File

@@ -4,3 +4,4 @@ DOMAIN = "opower"
CONF_UTILITY = "utility" CONF_UTILITY = "utility"
CONF_TOTP_SECRET = "totp_secret" CONF_TOTP_SECRET = "totp_secret"
CONF_LOGIN_DATA = "login_data"

View File

@@ -14,7 +14,7 @@ from opower import (
ReadResolution, ReadResolution,
create_cookie_jar, create_cookie_jar,
) )
from opower.exceptions import ApiException, CannotConnect, InvalidAuth from opower.exceptions import ApiException, CannotConnect, InvalidAuth, MfaChallenge
from homeassistant.components.recorder import get_instance from homeassistant.components.recorder import get_instance
from homeassistant.components.recorder.models import ( from homeassistant.components.recorder.models import (
@@ -36,7 +36,7 @@ from homeassistant.helpers.aiohttp_client import async_create_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.util import dt as dt_util from homeassistant.util import dt as dt_util
from .const import CONF_TOTP_SECRET, CONF_UTILITY, DOMAIN from .const import CONF_LOGIN_DATA, CONF_TOTP_SECRET, CONF_UTILITY, DOMAIN
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@@ -69,6 +69,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
config_entry.data[CONF_USERNAME], config_entry.data[CONF_USERNAME],
config_entry.data[CONF_PASSWORD], config_entry.data[CONF_PASSWORD],
config_entry.data.get(CONF_TOTP_SECRET), config_entry.data.get(CONF_TOTP_SECRET),
config_entry.data.get(CONF_LOGIN_DATA),
) )
@callback @callback
@@ -90,7 +91,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
# Given the infrequent updating (every 12h) # Given the infrequent updating (every 12h)
# assume previous session has expired and re-login. # assume previous session has expired and re-login.
await self.api.async_login() await self.api.async_login()
except InvalidAuth as err: except (InvalidAuth, MfaChallenge) as err:
_LOGGER.error("Error during login: %s", err) _LOGGER.error("Error during login: %s", err)
raise ConfigEntryAuthFailed from err raise ConfigEntryAuthFailed from err
except CannotConnect as err: except CannotConnect as err:

View File

@@ -7,5 +7,5 @@
"documentation": "https://www.home-assistant.io/integrations/opower", "documentation": "https://www.home-assistant.io/integrations/opower",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["opower"], "loggers": ["opower"],
"requirements": ["opower==0.12.4"] "requirements": ["opower==0.15.1"]
} }

View File

@@ -3,27 +3,43 @@
"step": { "step": {
"user": { "user": {
"data": { "data": {
"utility": "Utility name", "utility": "Utility name"
"username": "[%key:common::config_flow::data::username%]",
"password": "[%key:common::config_flow::data::password%]"
}, },
"data_description": { "data_description": {
"utility": "The name of your utility provider", "utility": "The name of your utility provider"
"username": "The username for your utility account",
"password": "The password for your utility account"
} }
}, },
"mfa": { "credentials": {
"description": "The TOTP secret below is not one of the 6-digit time-based numeric codes. It is a string of around 16 characters containing the shared secret that enables your authenticator app to generate the correct time-based code at the appropriate time. See the documentation.", "title": "Enter Credentials",
"data": { "data": {
"username": "[%key:common::config_flow::data::username%]", "username": "[%key:common::config_flow::data::username%]",
"password": "[%key:common::config_flow::data::password%]", "password": "[%key:common::config_flow::data::password%]",
"totp_secret": "TOTP secret" "totp_secret": "TOTP secret"
}, },
"data_description": { "data_description": {
"username": "[%key:component::opower::config::step::user::data_description::username%]", "username": "The username for your utility account",
"password": "[%key:component::opower::config::step::user::data_description::password%]", "password": "The password for your utility account",
"totp_secret": "The TOTP secret for your utility account, used for multi-factor authentication (MFA)." "totp_secret": "This is not a 6-digit code. It is a string of around 16 characters containing the shared secret that enables your authenticator app to generate the correct time-based code at the appropriate time. See the documentation."
}
},
"mfa_options": {
"title": "Multi-factor authentication",
"description": "Your account requires multi-factor authentication (MFA). Select a method to receive your security code.",
"data": {
"mfa_method": "MFA method"
},
"data_description": {
"mfa_method": "How to receive your security code"
}
},
"mfa_code": {
"title": "Enter security code",
"description": "A security code has been sent via your selected method. Please enter it below to complete login.",
"data": {
"mfa_code": "Security code"
},
"data_description": {
"mfa_code": "Typically a 6-digit code"
} }
}, },
"reauth_confirm": { "reauth_confirm": {
@@ -31,18 +47,19 @@
"data": { "data": {
"username": "[%key:common::config_flow::data::username%]", "username": "[%key:common::config_flow::data::username%]",
"password": "[%key:common::config_flow::data::password%]", "password": "[%key:common::config_flow::data::password%]",
"totp_secret": "[%key:component::opower::config::step::mfa::data::totp_secret%]" "totp_secret": "[%key:component::opower::config::step::credentials::data::totp_secret%]"
}, },
"data_description": { "data_description": {
"username": "[%key:component::opower::config::step::user::data_description::username%]", "username": "[%key:component::opower::config::step::credentials::data_description::username%]",
"password": "[%key:component::opower::config::step::user::data_description::password%]", "password": "[%key:component::opower::config::step::credentials::data_description::password%]",
"totp_secret": "The TOTP secret for your utility account, used for multi-factor authentication (MFA)." "totp_secret": "[%key:component::opower::config::step::credentials::data_description::totp_secret%]"
} }
} }
}, },
"error": { "error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]" "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"invalid_mfa_code": "The security code is incorrect. Please try again."
}, },
"abort": { "abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]", "already_configured": "[%key:common::config_flow::abort::already_configured_service%]",

View File

@@ -9,7 +9,6 @@ LOGGER = logging.getLogger(__package__)
REQUESTS = "requests" REQUESTS = "requests"
ATTR_CONFIG_ENTRY_ID = "config_entry_id"
ATTR_STATUS = "status" ATTR_STATUS = "status"
ATTR_SORT_ORDER = "sort_order" ATTR_SORT_ORDER = "sort_order"
ATTR_REQUESTED_BY = "requested_by" ATTR_REQUESTED_BY = "requested_by"

View File

@@ -7,6 +7,7 @@ from python_overseerr import OverseerrClient, OverseerrConnectionError
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntryState from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_CONFIG_ENTRY_ID
from homeassistant.core import ( from homeassistant.core import (
HomeAssistant, HomeAssistant,
ServiceCall, ServiceCall,
@@ -17,14 +18,7 @@ from homeassistant.core import (
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
from homeassistant.util.json import JsonValueType from homeassistant.util.json import JsonValueType
from .const import ( from .const import ATTR_REQUESTED_BY, ATTR_SORT_ORDER, ATTR_STATUS, DOMAIN, LOGGER
ATTR_CONFIG_ENTRY_ID,
ATTR_REQUESTED_BY,
ATTR_SORT_ORDER,
ATTR_STATUS,
DOMAIN,
LOGGER,
)
from .coordinator import OverseerrConfigEntry from .coordinator import OverseerrConfigEntry
SERVICE_GET_REQUESTS = "get_requests" SERVICE_GET_REQUESTS = "get_requests"

View File

@@ -9,7 +9,6 @@ CONF_COORDINATOR = "coordinator"
SERVICE_ADD_PRODUCT_TO_CART = "add_product" SERVICE_ADD_PRODUCT_TO_CART = "add_product"
ATTR_CONFIG_ENTRY_ID = "config_entry_id"
ATTR_PRODUCT_ID = "product_id" ATTR_PRODUCT_ID = "product_id"
ATTR_PRODUCT_NAME = "product_name" ATTR_PRODUCT_NAME = "product_name"
ATTR_AMOUNT = "amount" ATTR_AMOUNT = "amount"

View File

@@ -7,12 +7,12 @@ from typing import cast
from python_picnic_api2 import PicnicAPI from python_picnic_api2 import PicnicAPI
import voluptuous as vol import voluptuous as vol
from homeassistant.const import ATTR_CONFIG_ENTRY_ID
from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from .const import ( from .const import (
ATTR_AMOUNT, ATTR_AMOUNT,
ATTR_CONFIG_ENTRY_ID,
ATTR_PRODUCT_ID, ATTR_PRODUCT_ID,
ATTR_PRODUCT_IDENTIFIERS, ATTR_PRODUCT_IDENTIFIERS,
ATTR_PRODUCT_NAME, ATTR_PRODUCT_NAME,

View File

@@ -8,6 +8,5 @@ CONF_SERIAL_NUMBER = "serial_number"
CONF_IMPORTED_NAMES = "imported_names" CONF_IMPORTED_NAMES = "imported_names"
ATTR_DURATION = "duration" ATTR_DURATION = "duration"
ATTR_CONFIG_ENTRY_ID = "config_entry_id"
TIMEOUT_SECONDS = 20 TIMEOUT_SECONDS = 20

View File

@@ -59,7 +59,7 @@ PLATFORMS = [
Platform.UPDATE, Platform.UPDATE,
] ]
DEVICE_UPDATE_INTERVAL = timedelta(seconds=60) DEVICE_UPDATE_INTERVAL = timedelta(seconds=60)
FIRMWARE_UPDATE_INTERVAL = timedelta(hours=12) FIRMWARE_UPDATE_INTERVAL = timedelta(hours=24)
NUM_CRED_ERRORS = 3 NUM_CRED_ERRORS = 3
CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN) CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)

View File

@@ -24,7 +24,7 @@ async def async_get_config_entry_diagnostics(
IPC_cam[ch]["hardware version"] = api.camera_hardware_version(ch) IPC_cam[ch]["hardware version"] = api.camera_hardware_version(ch)
IPC_cam[ch]["firmware version"] = api.camera_sw_version(ch) IPC_cam[ch]["firmware version"] = api.camera_sw_version(ch)
IPC_cam[ch]["encoding main"] = await api.get_encoding(ch) IPC_cam[ch]["encoding main"] = await api.get_encoding(ch)
if (signal := api.wifi_signal(ch)) is not None: if (signal := api.wifi_signal(ch)) is not None and api.wifi_connection(ch):
IPC_cam[ch]["WiFi signal"] = signal IPC_cam[ch]["WiFi signal"] = signal
chimes: dict[int, dict[str, Any]] = {} chimes: dict[int, dict[str, Any]] = {}
@@ -43,7 +43,7 @@ async def async_get_config_entry_diagnostics(
"HTTP(S) port": api.port, "HTTP(S) port": api.port,
"Baichuan port": api.baichuan.port, "Baichuan port": api.baichuan.port,
"Baichuan only": api.baichuan_only, "Baichuan only": api.baichuan_only,
"WiFi connection": api.wifi_connection, "WiFi connection": api.wifi_connection(),
"WiFi signal": api.wifi_signal(), "WiFi signal": api.wifi_signal(),
"RTMP enabled": api.rtmp_enabled, "RTMP enabled": api.rtmp_enabled,
"RTSP enabled": api.rtsp_enabled, "RTSP enabled": api.rtsp_enabled,

View File

@@ -19,5 +19,5 @@
"iot_class": "local_push", "iot_class": "local_push",
"loggers": ["reolink_aio"], "loggers": ["reolink_aio"],
"quality_scale": "platinum", "quality_scale": "platinum",
"requirements": ["reolink-aio==0.14.5"] "requirements": ["reolink-aio==0.14.6"]
} }

View File

@@ -422,9 +422,7 @@ class ReolinkVODMediaSource(MediaSource):
file_name = f"{file.start_time.time()} {file.duration}" file_name = f"{file.start_time.time()} {file.duration}"
if file.triggers != file.triggers.NONE: if file.triggers != file.triggers.NONE:
file_name += " " + " ".join( file_name += " " + " ".join(
str(trigger.name).title() str(trigger.name).title() for trigger in file.triggers
for trigger in file.triggers
if trigger != trigger.NONE
) )
children.append( children.append(

View File

@@ -116,6 +116,7 @@ NUMBER_ENTITIES = (
cmd_id=[289, 438], cmd_id=[289, 438],
translation_key="floodlight_brightness", translation_key="floodlight_brightness",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_step=1, native_step=1,
native_min_value=1, native_min_value=1,
native_max_value=100, native_max_value=100,
@@ -407,8 +408,8 @@ NUMBER_ENTITIES = (
key="auto_track_limit_left", key="auto_track_limit_left",
cmd_key="GetPtzTraceSection", cmd_key="GetPtzTraceSection",
translation_key="auto_track_limit_left", translation_key="auto_track_limit_left",
mode=NumberMode.SLIDER,
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_step=1, native_step=1,
native_min_value=-1, native_min_value=-1,
native_max_value=2700, native_max_value=2700,
@@ -420,8 +421,8 @@ NUMBER_ENTITIES = (
key="auto_track_limit_right", key="auto_track_limit_right",
cmd_key="GetPtzTraceSection", cmd_key="GetPtzTraceSection",
translation_key="auto_track_limit_right", translation_key="auto_track_limit_right",
mode=NumberMode.SLIDER,
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_step=1, native_step=1,
native_min_value=-1, native_min_value=-1,
native_max_value=2700, native_max_value=2700,
@@ -435,6 +436,7 @@ NUMBER_ENTITIES = (
translation_key="auto_track_disappear_time", translation_key="auto_track_disappear_time",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
device_class=NumberDeviceClass.DURATION, device_class=NumberDeviceClass.DURATION,
entity_registry_enabled_default=False,
native_step=1, native_step=1,
native_unit_of_measurement=UnitOfTime.SECONDS, native_unit_of_measurement=UnitOfTime.SECONDS,
native_min_value=1, native_min_value=1,
@@ -451,6 +453,7 @@ NUMBER_ENTITIES = (
translation_key="auto_track_stop_time", translation_key="auto_track_stop_time",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
device_class=NumberDeviceClass.DURATION, device_class=NumberDeviceClass.DURATION,
entity_registry_enabled_default=False,
native_step=1, native_step=1,
native_unit_of_measurement=UnitOfTime.SECONDS, native_unit_of_measurement=UnitOfTime.SECONDS,
native_min_value=1, native_min_value=1,

View File

@@ -148,7 +148,7 @@ HOST_SENSORS = (
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT, native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
value=lambda api: api.wifi_signal(), value=lambda api: api.wifi_signal(),
supported=lambda api: api.supported(None, "wifi") and api.wifi_connection, supported=lambda api: api.supported(None, "wifi") and api.wifi_connection(),
), ),
ReolinkHostSensorEntityDescription( ReolinkHostSensorEntityDescription(
key="cpu_usage", key="cpu_usage",

View File

@@ -109,7 +109,6 @@ class RoborockVacuum(RoborockCoordinatedEntityV1, StateVacuumEntity):
| VacuumEntityFeature.STOP | VacuumEntityFeature.STOP
| VacuumEntityFeature.RETURN_HOME | VacuumEntityFeature.RETURN_HOME
| VacuumEntityFeature.FAN_SPEED | VacuumEntityFeature.FAN_SPEED
| VacuumEntityFeature.BATTERY
| VacuumEntityFeature.SEND_COMMAND | VacuumEntityFeature.SEND_COMMAND
| VacuumEntityFeature.LOCATE | VacuumEntityFeature.LOCATE
| VacuumEntityFeature.CLEAN_SPOT | VacuumEntityFeature.CLEAN_SPOT
@@ -142,11 +141,6 @@ class RoborockVacuum(RoborockCoordinatedEntityV1, StateVacuumEntity):
assert self._device_status.state is not None assert self._device_status.state is not None
return STATE_CODE_TO_STATE.get(self._device_status.state) return STATE_CODE_TO_STATE.get(self._device_status.state)
@property
def battery_level(self) -> int | None:
"""Return the battery level of the vacuum cleaner."""
return self._device_status.battery
@property @property
def fan_speed(self) -> str | None: def fan_speed(self) -> str | None:
"""Return the fan speed of the vacuum cleaner.""" """Return the fan speed of the vacuum cleaner."""

View File

@@ -48,4 +48,3 @@ SERVICE_ARCHIVE_PACKAGE = "archive_package"
ATTR_PACKAGE_STATE = "package_state" ATTR_PACKAGE_STATE = "package_state"
ATTR_PACKAGE_TRACKING_NUMBER = "package_tracking_number" ATTR_PACKAGE_TRACKING_NUMBER = "package_tracking_number"
ATTR_PACKAGE_FRIENDLY_NAME = "package_friendly_name" ATTR_PACKAGE_FRIENDLY_NAME = "package_friendly_name"
ATTR_CONFIG_ENTRY_ID = "config_entry_id"

View File

@@ -6,7 +6,7 @@ from pyseventeentrack.package import PACKAGE_STATUS_MAP, Package
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigEntryState from homeassistant.config_entries import ConfigEntry, ConfigEntryState
from homeassistant.const import ATTR_FRIENDLY_NAME, ATTR_LOCATION from homeassistant.const import ATTR_CONFIG_ENTRY_ID, ATTR_FRIENDLY_NAME, ATTR_LOCATION
from homeassistant.core import ( from homeassistant.core import (
HomeAssistant, HomeAssistant,
ServiceCall, ServiceCall,
@@ -20,7 +20,6 @@ from homeassistant.util import slugify
from . import SeventeenTrackCoordinator from . import SeventeenTrackCoordinator
from .const import ( from .const import (
ATTR_CONFIG_ENTRY_ID,
ATTR_DESTINATION_COUNTRY, ATTR_DESTINATION_COUNTRY,
ATTR_INFO_TEXT, ATTR_INFO_TEXT,
ATTR_ORIGIN_COUNTRY, ATTR_ORIGIN_COUNTRY,

View File

@@ -8,7 +8,7 @@
"documentation": "https://www.home-assistant.io/integrations/sonos", "documentation": "https://www.home-assistant.io/integrations/sonos",
"iot_class": "local_push", "iot_class": "local_push",
"loggers": ["soco", "sonos_websocket"], "loggers": ["soco", "sonos_websocket"],
"requirements": ["soco==0.30.9", "sonos-websocket==0.1.3"], "requirements": ["soco==0.30.11", "sonos-websocket==0.1.3"],
"ssdp": [ "ssdp": [
{ {
"st": "urn:schemas-upnp-org:device:ZonePlayer:1" "st": "urn:schemas-upnp-org:device:ZonePlayer:1"

View File

@@ -6,5 +6,4 @@ from typing import Final
DOMAIN: Final = "stookwijzer" DOMAIN: Final = "stookwijzer"
LOGGER = logging.getLogger(__package__) LOGGER = logging.getLogger(__package__)
ATTR_CONFIG_ENTRY_ID = "config_entry_id"
SERVICE_GET_FORECAST = "get_forecast" SERVICE_GET_FORECAST = "get_forecast"

View File

@@ -5,6 +5,7 @@ from typing import Required, TypedDict, cast
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntryState from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_CONFIG_ENTRY_ID
from homeassistant.core import ( from homeassistant.core import (
HomeAssistant, HomeAssistant,
ServiceCall, ServiceCall,
@@ -13,7 +14,7 @@ from homeassistant.core import (
) )
from homeassistant.exceptions import ServiceValidationError from homeassistant.exceptions import ServiceValidationError
from .const import ATTR_CONFIG_ENTRY_ID, DOMAIN, SERVICE_GET_FORECAST from .const import DOMAIN, SERVICE_GET_FORECAST
from .coordinator import StookwijzerConfigEntry from .coordinator import StookwijzerConfigEntry
SERVICE_GET_FORECAST_SCHEMA = vol.Schema( SERVICE_GET_FORECAST_SCHEMA = vol.Schema(

View File

@@ -131,13 +131,13 @@ class SunCondition(Condition):
self._hass = hass self._hass = hass
@classmethod @classmethod
async def async_validate_condition_config( async def async_validate_config(
cls, hass: HomeAssistant, config: ConfigType cls, hass: HomeAssistant, config: ConfigType
) -> ConfigType: ) -> ConfigType:
"""Validate config.""" """Validate config."""
return _CONDITION_SCHEMA(config) # type: ignore[no-any-return] return _CONDITION_SCHEMA(config) # type: ignore[no-any-return]
async def async_condition_from_config(self) -> ConditionCheckerType: async def async_get_checker(self) -> ConditionCheckerType:
"""Wrap action method with sun based condition.""" """Wrap action method with sun based condition."""
before = self._config.get("before") before = self._config.get("before")
after = self._config.get("after") after = self._config.get("after")
@@ -153,7 +153,7 @@ class SunCondition(Condition):
CONDITIONS: dict[str, type[Condition]] = { CONDITIONS: dict[str, type[Condition]] = {
"sun": SunCondition, "_": SunCondition,
} }

View File

@@ -29,7 +29,6 @@ PLACEHOLDERS = {
"opendata_url": "http://transport.opendata.ch", "opendata_url": "http://transport.opendata.ch",
} }
ATTR_CONFIG_ENTRY_ID: Final = "config_entry_id"
ATTR_LIMIT: Final = "limit" ATTR_LIMIT: Final = "limit"
SERVICE_FETCH_CONNECTIONS = "fetch_connections" SERVICE_FETCH_CONNECTIONS = "fetch_connections"

View File

@@ -3,6 +3,7 @@
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntryState from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_CONFIG_ENTRY_ID
from homeassistant.core import ( from homeassistant.core import (
HomeAssistant, HomeAssistant,
ServiceCall, ServiceCall,
@@ -19,7 +20,6 @@ from homeassistant.helpers.selector import (
from homeassistant.helpers.update_coordinator import UpdateFailed from homeassistant.helpers.update_coordinator import UpdateFailed
from .const import ( from .const import (
ATTR_CONFIG_ENTRY_ID,
ATTR_LIMIT, ATTR_LIMIT,
CONNECTIONS_COUNT, CONNECTIONS_COUNT,
CONNECTIONS_MAX, CONNECTIONS_MAX,

View File

@@ -41,5 +41,5 @@
"iot_class": "local_push", "iot_class": "local_push",
"loggers": ["switchbot"], "loggers": ["switchbot"],
"quality_scale": "gold", "quality_scale": "gold",
"requirements": ["PySwitchbot==0.68.2"] "requirements": ["PySwitchbot==0.68.3"]
} }

View File

@@ -440,6 +440,12 @@
} }
} }
}, },
"issues": {
"deprecated_battery_level": {
"title": "Deprecated battery level option in {entity_name}",
"description": "The template vacuum options `battery_level` and `battery_level_template` are being removed in 2026.8.\n\nPlease remove the `battery_level` or `battery_level_template` option from the YAML configuration for {entity_id} ({entity_name})."
}
},
"options": { "options": {
"step": { "step": {
"alarm_control_panel": { "alarm_control_panel": {
@@ -753,7 +759,7 @@
"data_description": { "data_description": {
"device_id": "[%key:component::template::common::device_id_description%]", "device_id": "[%key:component::template::common::device_id_description%]",
"state": "[%key:component::template::config::step::sensor::data_description::state%]", "state": "[%key:component::template::config::step::sensor::data_description::state%]",
"unit_of_measurement": "[%key:component::template::config::step::sensor::data_description::state%]" "unit_of_measurement": "[%key:component::template::config::step::sensor::data_description::unit_of_measurement%]"
}, },
"sections": { "sections": {
"advanced_options": { "advanced_options": {

View File

@@ -34,11 +34,16 @@ from homeassistant.const import (
) )
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import TemplateError from homeassistant.exceptions import TemplateError
from homeassistant.helpers import config_validation as cv, template from homeassistant.helpers import (
config_validation as cv,
issue_registry as ir,
template,
)
from homeassistant.helpers.entity_platform import ( from homeassistant.helpers.entity_platform import (
AddConfigEntryEntitiesCallback, AddConfigEntryEntitiesCallback,
AddEntitiesCallback, AddEntitiesCallback,
) )
from homeassistant.helpers.issue_registry import IssueSeverity
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from .const import DOMAIN from .const import DOMAIN
@@ -188,6 +193,26 @@ def async_create_preview_vacuum(
) )
def create_issue(
hass: HomeAssistant, supported_features: int, name: str, entity_id: str
) -> None:
"""Create the battery_level issue."""
if supported_features & VacuumEntityFeature.BATTERY:
key = "deprecated_battery_level"
ir.async_create_issue(
hass,
DOMAIN,
f"{key}_{entity_id}",
is_fixable=False,
severity=IssueSeverity.WARNING,
translation_key=key,
translation_placeholders={
"entity_name": name,
"entity_id": entity_id,
},
)
class AbstractTemplateVacuum(AbstractTemplateEntity, StateVacuumEntity): class AbstractTemplateVacuum(AbstractTemplateEntity, StateVacuumEntity):
"""Representation of a template vacuum features.""" """Representation of a template vacuum features."""
@@ -369,6 +394,16 @@ class TemplateStateVacuumEntity(TemplateEntity, AbstractTemplateVacuum):
self.add_script(action_id, action_config, name, DOMAIN) self.add_script(action_id, action_config, name, DOMAIN)
self._attr_supported_features |= supported_feature self._attr_supported_features |= supported_feature
async def async_added_to_hass(self) -> None:
"""Run when entity about to be added to hass."""
await super().async_added_to_hass()
create_issue(
self.hass,
self._attr_supported_features,
self._attr_name or DEFAULT_NAME,
self.entity_id,
)
@callback @callback
def _async_setup_templates(self) -> None: def _async_setup_templates(self) -> None:
"""Set up templates.""" """Set up templates."""
@@ -434,6 +469,16 @@ class TriggerVacuumEntity(TriggerEntity, AbstractTemplateVacuum):
self._to_render_simple.append(key) self._to_render_simple.append(key)
self._parse_result.add(key) self._parse_result.add(key)
async def async_added_to_hass(self) -> None:
"""Run when entity about to be added to hass."""
await super().async_added_to_hass()
create_issue(
self.hass,
self._attr_supported_features,
self._attr_name or DEFAULT_NAME,
self.entity_id,
)
@callback @callback
def _handle_coordinator_update(self) -> None: def _handle_coordinator_update(self) -> None:
"""Handle update of the data.""" """Handle update of the data."""

Some files were not shown because too many files have changed in this diff Show More