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
20 changes: 12 additions & 8 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,23 @@ jobs:
name: Build Core wheels ${{ matrix.abi }} for ${{ matrix.arch }} (musllinux_1_2)
if: github.repository_owner == 'home-assistant'
needs: init
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: &matrix-build
abi: ["cp313", "cp314"]
arch: ${{ fromJson(needs.init.outputs.architectures) }}
include:
- os: ubuntu-latest
- arch: aarch64
os: ubuntu-24.04-arm
exclude:
- abi: "cp314"
arch: "armv7"
- abi: "cp314"
arch: "armhf"
- abi: "cp314"
arch: "i386"
- abi: cp314
arch: armv7
- abi: cp314
arch: armhf
- abi: cp314
arch: i386
steps:
- *checkout

Expand Down Expand Up @@ -187,7 +191,7 @@ jobs:
name: Build wheels ${{ matrix.abi }} for ${{ matrix.arch }}
if: github.repository_owner == 'home-assistant'
needs: init
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: *matrix-build
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/esphome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"mqtt": ["esphome/discover/#"],
"quality_scale": "platinum",
"requirements": [
"aioesphomeapi==42.1.0",
"aioesphomeapi==42.2.0",
"esphome-dashboard-api==1.3.0",
"bleak-esphome==3.4.0"
],
Expand Down
7 changes: 6 additions & 1 deletion homeassistant/components/nightscout/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ async def async_step_user(
return self.async_create_entry(title=info["title"], data=user_input)

return self.async_show_form(
step_id="user", data_schema=DATA_SCHEMA, errors=errors
step_id="user",
data_schema=DATA_SCHEMA,
errors=errors,
description_placeholders={
"example_url": "https://myhomeassistant.duckdns.org:5423",
},
)


Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/nightscout/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
"step": {
"user": {
"title": "Enter your Nightscout server information.",
"description": "- URL: the address of your nightscout instance. I.e.: https://myhomeassistant.duckdns.org:5423\n- API Key (optional): Only use if your instance is protected (auth_default_roles != readable).",
"data": {
"url": "[%key:common::config_flow::data::url%]",
"api_key": "[%key:common::config_flow::data::api_key%]"
},
"data_description": {
"url": "The address of your Nightscout instance. For example: {example_url}.",
"api_key": "Optional; only use it if your instance is protected (auth_default_roles != readable)."
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/opower/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "cloud_polling",
"loggers": ["opower"],
"quality_scale": "bronze",
"requirements": ["opower==0.15.7"]
"requirements": ["opower==0.15.8"]
}
1 change: 0 additions & 1 deletion homeassistant/components/shelly/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ class RpcEntityDescription(EntityDescription):
use_polling_coordinator: bool = False
supported: Callable = lambda _: False
unit: Callable[[dict], str | None] | None = None
options_fn: Callable[[dict], list[str]] | None = None
entity_class: Callable | None = None
role: str | None = None
models: set[str] | None = None
Expand Down
25 changes: 10 additions & 15 deletions homeassistant/components/shelly/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def __init__(
super().__init__(coordinator, key, attribute, description)

if self.option_map:
self._attr_options = list(self.option_map.values())
if description.role == ROLE_GENERIC:
self._attr_options = list(self.option_map.values())
else:
self._attr_options = list(self.option_map)

@property
def native_value(self) -> StateType:
Expand All @@ -117,7 +120,10 @@ def native_value(self) -> StateType:
if not isinstance(attribute_value, str):
return None

return self.option_map[attribute_value]
if self.entity_description.role == ROLE_GENERIC:
return self.option_map[attribute_value]

return attribute_value


class RpcEnergyConsumedSensor(RpcSensor):
Expand Down Expand Up @@ -1442,7 +1448,6 @@ def __init__(
removal_condition=lambda config, _, key: not is_view_for_platform(
config, key, SENSOR_PLATFORM
),
options_fn=lambda config: config["options"],
device_class=SensorDeviceClass.ENUM,
role=ROLE_GENERIC,
),
Expand Down Expand Up @@ -1532,21 +1537,11 @@ def __init__(
state_class=SensorStateClass.MEASUREMENT,
role="water_temperature",
),
"number_work_state": RpcSensorDescription(
key="number",
"enum_work_state": RpcSensorDescription(
key="enum",
sub_key="value",
translation_key="charger_state",
device_class=SensorDeviceClass.ENUM,
options=[
"charger_charging",
"charger_end",
"charger_fault",
"charger_free",
"charger_free_fault",
"charger_insert",
"charger_pause",
"charger_wait",
],
role="work_state",
),
"number_energy_charge": RpcSensorDescription(
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/shelly/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class RpcSwitchDescription(RpcEntityDescription, SwitchEntityDescription):
"boolean_start_charging": RpcSwitchDescription(
key="boolean",
sub_key="value",
name="Charging",
is_on=lambda status: bool(status["value"]),
method_on="boolean_set",
method_off="boolean_set",
Expand Down
4 changes: 2 additions & 2 deletions requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions tests/components/bluesound/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Common fixtures for the Bluesound tests."""

from __future__ import annotations

from collections.abc import AsyncGenerator, Generator
from dataclasses import dataclass
import ipaddress
from typing import Any
from typing import Any, Self
from unittest.mock import AsyncMock, patch

from pyblu import Input, Player, Preset, Status, SyncStatus
Expand All @@ -27,8 +29,8 @@ class PlayerMockData:
status_long_polling_mock: LongPollingMock[Status]
sync_status_long_polling_mock: LongPollingMock[SyncStatus]

@staticmethod
async def generate(host: str) -> "PlayerMockData":
@classmethod
async def generate(cls, host: str) -> Self:
"""Generate player mock data."""
host_ip = ipaddress.ip_address(host)
assert host_ip.version == 4
Expand Down Expand Up @@ -110,7 +112,7 @@ async def generate(host: str) -> "PlayerMockData":
]
)

return PlayerMockData(
return cls(
host, player, status_long_polling_mock, sync_status_long_polling_mock
)

Expand Down
2 changes: 1 addition & 1 deletion tests/components/remote_calendar/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def test_form_import_webcal(hass: HomeAssistant, ics_content: str) -> None
],
)
@respx.mock
async def test_form_inavild_url(
async def test_form_invalid_url(
hass: HomeAssistant,
side_effect: Exception,
ics_content: str,
Expand Down
2 changes: 1 addition & 1 deletion tests/components/shelly/snapshots/test_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'charger_state',
'unique_id': '123456789ABC-number:200-number_work_state',
'unique_id': '123456789ABC-enum:200-enum_work_state',
'unit_of_measurement': None,
})
# ---
Expand Down
14 changes: 7 additions & 7 deletions tests/components/shelly/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ async def test_rpc_shelly_ev_sensors(
) -> None:
"""Test Shelly EV sensors."""
config = deepcopy(mock_rpc_device.config)
config["number:200"] = {
config["enum:200"] = {
"name": "Charger state",
"meta": {
"ui": {
Expand All @@ -1711,14 +1711,14 @@ async def test_rpc_shelly_ev_sensors(
}
},
"options": [
"charger_free",
"charger_insert",
"charger_free_fault",
"charger_wait",
"charger_charging",
"charger_pause",
"charger_end",
"charger_fault",
"charger_free",
"charger_free_fault",
"charger_insert",
"charger_pause",
"charger_wait",
],
"role": "work_state",
}
Expand All @@ -1735,7 +1735,7 @@ async def test_rpc_shelly_ev_sensors(
monkeypatch.setattr(mock_rpc_device, "config", config)

status = deepcopy(mock_rpc_device.status)
status["number:200"] = {"value": "charger_charging"}
status["enum:200"] = {"value": "charger_charging"}
status["number:201"] = {"value": 5.0}
status["number:202"] = {"value": 60}
monkeypatch.setattr(mock_rpc_device, "status", status)
Expand Down
31 changes: 31 additions & 0 deletions tests/components/shelly/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from homeassistant.components.shelly.const import (
DOMAIN,
ENTRY_RELOAD_COOLDOWN,
MODEL_TOP_EV_CHARGER_EVE01,
MODEL_WALL_DISPLAY,
MOTION_MODELS,
)
Expand Down Expand Up @@ -954,3 +955,33 @@ async def test_cury_switch_availability(

assert (state := hass.states.get(entity_id))
assert state.state == STATE_ON


async def test_rpc_ev_charging_switch(
hass: HomeAssistant,
mock_rpc_device: Mock,
monkeypatch: pytest.MonkeyPatch,
entity_registry: EntityRegistry,
) -> None:
"""Test the charging switch for EV charger."""
config = deepcopy(mock_rpc_device.config)
config["boolean:200"] = {
"name": "Start Charging",
"meta": {"ui": {"view": "toggle"}},
"role": "start_charging",
}
monkeypatch.setattr(mock_rpc_device, "config", config)

status = deepcopy(mock_rpc_device.status)
status["boolean:200"] = {"value": False}
monkeypatch.setattr(mock_rpc_device, "status", status)

entity_id = "switch.test_name_charging"

await init_integration(hass, 3, model=MODEL_TOP_EV_CHARGER_EVE01)

assert (state := hass.states.get(entity_id))
assert state.state == STATE_OFF

assert (entry := entity_registry.async_get(entity_id))
assert entry.unique_id == "123456789ABC-boolean:200-boolean_start_charging"
8 changes: 8 additions & 0 deletions tests/components/todoist/test_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import urllib
import zoneinfo

from freezegun import freeze_time
from freezegun.api import FrozenDateTimeFactory
import pytest
from todoist_api_python.models import Due
Expand Down Expand Up @@ -38,6 +39,13 @@
TIMEZONE = zoneinfo.ZoneInfo(TZ_NAME)


@pytest.fixture(autouse=True)
def freeze_the_time():
"""Freeze the time."""
with freeze_time("2024-05-24 12:00:00"):
yield


@pytest.fixture(autouse=True)
def platforms() -> list[Platform]:
"""Override platforms."""
Expand Down
Loading