Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions homeassistant/components/accuweather/icons.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"entity": {
"sensor": {
"air_quality": {
"default": "mdi:air-filter"
},
"cloud_ceiling": {
"default": "mdi:weather-fog"
},
Expand Down Expand Up @@ -34,9 +37,6 @@
"thunderstorm_probability_night": {
"default": "mdi:weather-lightning"
},
"translation_key": {
"default": "mdi:air-filter"
},
"tree_pollen": {
"default": "mdi:tree-outline"
},
Expand Down
20 changes: 15 additions & 5 deletions homeassistant/components/comelit/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
from aiocomelit import ComelitSerialBridgeObject
from aiocomelit.const import COVER, STATE_COVER, STATE_OFF, STATE_ON

from homeassistant.components.cover import CoverDeviceClass, CoverEntity
from homeassistant.components.cover import (
STATE_CLOSED,
STATE_CLOSING,
STATE_OPEN,
STATE_OPENING,
CoverDeviceClass,
CoverEntity,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity
Expand Down Expand Up @@ -62,7 +69,6 @@ def __init__(
super().__init__(coordinator, device, config_entry_entry_id)
# Device doesn't provide a status so we assume UNKNOWN at first startup
self._last_action: int | None = None
self._last_state: str | None = None

def _current_action(self, action: str) -> bool:
"""Return the current cover action."""
Expand Down Expand Up @@ -98,7 +104,6 @@ def is_opening(self) -> bool:
@bridge_api_call
async def _cover_set_state(self, action: int, state: int) -> None:
"""Set desired cover state."""
self._last_state = self.state
await self.coordinator.api.set_device_status(COVER, self._device.index, action)
self.coordinator.data[COVER][self._device.index].status = state
self.async_write_ha_state()
Expand All @@ -124,5 +129,10 @@ async def async_added_to_hass(self) -> None:

await super().async_added_to_hass()

if last_state := await self.async_get_last_state():
self._last_state = last_state.state
if (state := await self.async_get_last_state()) is not None:
if state.state == STATE_CLOSED:
self._last_action = STATE_COVER.index(STATE_CLOSING)
if state.state == STATE_OPEN:
self._last_action = STATE_COVER.index(STATE_OPENING)

self._attr_is_closed = state.state == STATE_CLOSED
6 changes: 2 additions & 4 deletions homeassistant/components/openweathermap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pyopenweathermap import create_owm_client

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, CONF_LANGUAGE, CONF_MODE, CONF_NAME
from homeassistant.const import CONF_API_KEY, CONF_LANGUAGE, CONF_MODE
from homeassistant.core import HomeAssistant

from .const import CONFIG_FLOW_VERSION, DEFAULT_OWM_MODE, OWM_MODES, PLATFORMS
Expand All @@ -25,7 +25,6 @@
class OpenweathermapData:
"""Runtime data definition."""

name: str
mode: str
coordinator: OWMUpdateCoordinator

Expand All @@ -34,7 +33,6 @@ async def async_setup_entry(
hass: HomeAssistant, entry: OpenweathermapConfigEntry
) -> bool:
"""Set up OpenWeatherMap as config entry."""
name = entry.data[CONF_NAME]
api_key = entry.data[CONF_API_KEY]
language = entry.options[CONF_LANGUAGE]
mode = entry.options[CONF_MODE]
Expand All @@ -51,7 +49,7 @@ async def async_setup_entry(

entry.async_on_unload(entry.add_update_listener(async_update_options))

entry.runtime_data = OpenweathermapData(name, mode, owm_coordinator)
entry.runtime_data = OpenweathermapData(mode, owm_coordinator)

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

Expand Down
39 changes: 27 additions & 12 deletions homeassistant/components/openweathermap/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@
CONF_API_KEY,
CONF_LANGUAGE,
CONF_LATITUDE,
CONF_LOCATION,
CONF_LONGITUDE,
CONF_MODE,
CONF_NAME,
)
from homeassistant.core import callback
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.selector import (
LanguageSelector,
LanguageSelectorConfig,
LocationSelector,
LocationSelectorConfig,
)

from .const import (
CONFIG_FLOW_VERSION,
Expand All @@ -34,18 +39,22 @@

USER_SCHEMA = vol.Schema(
{
vol.Optional(CONF_NAME, default=DEFAULT_NAME): str,
vol.Optional(CONF_LATITUDE): cv.latitude,
vol.Optional(CONF_LONGITUDE): cv.longitude,
vol.Optional(CONF_LANGUAGE, default=DEFAULT_LANGUAGE): vol.In(LANGUAGES),
vol.Required(CONF_LOCATION): LocationSelector(
LocationSelectorConfig(radius=False)
),
vol.Optional(CONF_LANGUAGE, default=DEFAULT_LANGUAGE): LanguageSelector(
LanguageSelectorConfig(languages=LANGUAGES, native_name=True)
),
vol.Required(CONF_API_KEY): str,
vol.Optional(CONF_MODE, default=DEFAULT_OWM_MODE): vol.In(OWM_MODES),
}
)

OPTIONS_SCHEMA = vol.Schema(
{
vol.Optional(CONF_LANGUAGE, default=DEFAULT_LANGUAGE): vol.In(LANGUAGES),
vol.Optional(CONF_LANGUAGE, default=DEFAULT_LANGUAGE): LanguageSelector(
LanguageSelectorConfig(languages=LANGUAGES, native_name=True)
),
vol.Optional(CONF_MODE, default=DEFAULT_OWM_MODE): vol.In(OWM_MODES),
}
)
Expand All @@ -70,8 +79,8 @@ async def async_step_user(self, user_input=None) -> ConfigFlowResult:
description_placeholders = {}

if user_input is not None:
latitude = user_input[CONF_LATITUDE]
longitude = user_input[CONF_LONGITUDE]
latitude = user_input[CONF_LOCATION][CONF_LATITUDE]
longitude = user_input[CONF_LOCATION][CONF_LONGITUDE]
mode = user_input[CONF_MODE]

await self.async_set_unique_id(f"{latitude}-{longitude}")
Expand All @@ -82,15 +91,21 @@ async def async_step_user(self, user_input=None) -> ConfigFlowResult:
)

if not errors:
# Flatten location
location = user_input.pop(CONF_LOCATION)
user_input[CONF_LATITUDE] = location[CONF_LATITUDE]
user_input[CONF_LONGITUDE] = location[CONF_LONGITUDE]
data, options = build_data_and_options(user_input)
return self.async_create_entry(
title=user_input[CONF_NAME], data=data, options=options
title=DEFAULT_NAME, data=data, options=options
)
schema_data = user_input
else:
schema_data = {
CONF_LATITUDE: self.hass.config.latitude,
CONF_LONGITUDE: self.hass.config.longitude,
CONF_LOCATION: {
CONF_LATITUDE: self.hass.config.latitude,
CONF_LONGITUDE: self.hass.config.longitude,
},
CONF_LANGUAGE: self.hass.config.language,
}

Expand Down
7 changes: 2 additions & 5 deletions homeassistant/components/openweathermap/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
native_unit_of_measurement=UnitOfPressure.HPA,
device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
SensorEntityDescription(
key=ATTR_API_CLOUDS,
Expand Down Expand Up @@ -158,6 +159,7 @@
native_unit_of_measurement=UnitOfLength.METERS,
device_class=SensorDeviceClass.DISTANCE,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
SensorEntityDescription(
key=ATTR_API_CONDITION,
Expand Down Expand Up @@ -227,7 +229,6 @@ async def async_setup_entry(
) -> None:
"""Set up OpenWeatherMap sensor entities based on a config entry."""
domain_data = config_entry.runtime_data
name = domain_data.name
unique_id = config_entry.unique_id
assert unique_id is not None
coordinator = domain_data.coordinator
Expand All @@ -242,7 +243,6 @@ async def async_setup_entry(
elif domain_data.mode == OWM_MODE_AIRPOLLUTION:
async_add_entities(
OpenWeatherMapSensor(
name,
unique_id,
description,
coordinator,
Expand All @@ -252,7 +252,6 @@ async def async_setup_entry(
else:
async_add_entities(
OpenWeatherMapSensor(
name,
unique_id,
description,
coordinator,
Expand All @@ -270,7 +269,6 @@ class AbstractOpenWeatherMapSensor(SensorEntity):

def __init__(
self,
name: str,
unique_id: str,
description: SensorEntityDescription,
coordinator: OWMUpdateCoordinator,
Expand All @@ -284,7 +282,6 @@ def __init__(
entry_type=DeviceEntryType.SERVICE,
identifiers={(DOMAIN, unique_id)},
manufacturer=MANUFACTURER,
name=name,
)

@property
Expand Down
6 changes: 2 additions & 4 deletions homeassistant/components/openweathermap/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
"data": {
"api_key": "[%key:common::config_flow::data::api_key%]",
"language": "[%key:common::config_flow::data::language%]",
"latitude": "[%key:common::config_flow::data::latitude%]",
"longitude": "[%key:common::config_flow::data::longitude%]",
"location": "[%key:common::config_flow::data::location%]",
"mode": "[%key:common::config_flow::data::mode%]",
"name": "[%key:common::config_flow::data::name%]"
},
"data_description": {
"api_key": "API key for the OpenWeatherMap integration",
"language": "Language for the OpenWeatherMap content",
"latitude": "Latitude of the location",
"longitude": "Longitude of the location",
"location": "Location to get the weather data for",
"mode": "Mode for the OpenWeatherMap API",
"name": "Name for this OpenWeatherMap location"
},
Expand Down
5 changes: 1 addition & 4 deletions homeassistant/components/openweathermap/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,13 @@ async def async_setup_entry(
) -> None:
"""Set up OpenWeatherMap weather entity based on a config entry."""
domain_data = config_entry.runtime_data
name = domain_data.name
mode = domain_data.mode

if mode != OWM_MODE_AIRPOLLUTION:
weather_coordinator = domain_data.coordinator

unique_id = f"{config_entry.unique_id}"
owm_weather = OpenWeatherMapWeather(name, unique_id, mode, weather_coordinator)
owm_weather = OpenWeatherMapWeather(unique_id, mode, weather_coordinator)

async_add_entities([owm_weather], False)

Expand Down Expand Up @@ -93,7 +92,6 @@ class OpenWeatherMapWeather(SingleCoordinatorWeatherEntity[OWMUpdateCoordinator]

def __init__(
self,
name: str,
unique_id: str,
mode: str,
weather_coordinator: OWMUpdateCoordinator,
Expand All @@ -105,7 +103,6 @@ def __init__(
entry_type=DeviceEntryType.SERVICE,
identifiers={(DOMAIN, unique_id)},
manufacturer=MANUFACTURER,
name=name,
)
self.mode = mode

Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/zwave_js/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
suggested_display_precision=0,
),
(
ENTITY_DESC_KEY_VOLTAGE,
Expand Down
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ filterwarnings = [
"ignore:Deprecated call to `pkg_resources.declare_namespace\\(('azure'|'google.*'|'pywinusb'|'repoze'|'xbox'|'zope')\\)`:DeprecationWarning:pkg_resources",

# -- tracked upstream / open PRs
# https://github.com/kbr/fritzconnection/pull/244 - v1.15.0 - 2025-05-17
"ignore:.*invalid escape sequence:SyntaxWarning:.*fritzconnection.core.soaper",
# https://github.com/hacf-fr/meteofrance-api/pull/688 - v1.4.0 - 2025-03-26
"ignore:datetime.*utcnow\\(\\) is deprecated and scheduled for removal:DeprecationWarning:meteofrance_api.model.forecast",

Expand Down Expand Up @@ -522,8 +524,8 @@ filterwarnings = [
# https://pypi.org/project/motionblindsble/ - v0.1.3 - 2024-11-12
# https://github.com/LennP/motionblindsble/blob/0.1.3/motionblindsble/device.py#L390
"ignore:Passing additional arguments for BLEDevice is deprecated and has no effect:DeprecationWarning:motionblindsble.device",
# https://pypi.org/project/pyeconet/ - v0.1.28 - 2025-02-15
# https://github.com/w1ll1am23/pyeconet/blob/v0.1.28/src/pyeconet/api.py#L38
# https://pypi.org/project/pyeconet/ - v0.2.0 - 2025-10-05
# https://github.com/w1ll1am23/pyeconet/blob/v0.2.0/src/pyeconet/api.py#L39
"ignore:ssl.PROTOCOL_TLS is deprecated:DeprecationWarning:pyeconet.api",
# https://github.com/thecynic/pylutron - v0.2.18 - 2025-04-15
"ignore:setDaemon\\(\\) is deprecated, set the daemon attribute instead:DeprecationWarning:pylutron",
Expand Down Expand Up @@ -565,7 +567,6 @@ filterwarnings = [
# - SyntaxWarning - is with literal
# https://github.com/majuss/lupupy/pull/15 - >0.3.2
# https://pypi.org/project/opuslib/ - v3.0.1 - 2018-01-16
# https://pypi.org/project/plumlightpad/ - v0.0.11 - 2018-10-16
# https://pypi.org/project/pyiss/ - v1.0.1 - 2016-12-19
"ignore:\"is.*\" with '.*' literal:SyntaxWarning:importlib._bootstrap",

Expand All @@ -574,7 +575,6 @@ filterwarnings = [
"ignore:aifc was removed in Python 3.13.*'standard-aifc':DeprecationWarning:speech_recognition",
"ignore:telnetlib was removed in Python 3.13.*'standard-telnetlib':DeprecationWarning:homeassistant.components.hddtemp.sensor",
"ignore:telnetlib was removed in Python 3.13.*'standard-telnetlib':DeprecationWarning:ndms2_client.connection",
"ignore:telnetlib was removed in Python 3.13.*'standard-telnetlib':DeprecationWarning:plumlightpad.lightpad",
"ignore:telnetlib was removed in Python 3.13.*'standard-telnetlib':DeprecationWarning:pyws66i",

# -- Websockets 14.1
Expand Down Expand Up @@ -605,8 +605,6 @@ filterwarnings = [
"ignore:datetime.*utcnow\\(\\) is deprecated and scheduled for removal:DeprecationWarning:oauth2client.client",
# https://pypi.org/project/pilight/ - v0.1.1 - 2016-10-19
"ignore:pkg_resources is deprecated as an API:UserWarning:pilight",
# https://pypi.org/project/plumlightpad/ - v0.0.11 - 2018-10-16
"ignore:.*invalid escape sequence:SyntaxWarning:.*plumlightpad.plumdiscovery",
# https://pypi.org/project/pure-python-adb/ - v0.3.0.dev0 - 2020-08-05
"ignore:.*invalid escape sequence:SyntaxWarning:.*ppadb",
# https://pypi.org/project/pydub/ - v0.25.1 - 2021-03-10
Expand Down
Loading
Loading