Compare commits

..

7 Commits

Author SHA1 Message Date
mettolen
66b1728c13 Implement reauth for Huum integration (#165971) 2026-03-20 10:03:23 +01:00
Erik Montnemery
d11668b868 Remove useless string split from mqtt diagnostics (#166035) 2026-03-20 09:51:59 +01:00
tronikos
ed3f70bc3f Bump androidtvremote2 to 0.3.1 (#166045) 2026-03-20 08:15:04 +01:00
tronikos
008eb39c3b Bump opower to 0.17.1 (#166044) 2026-03-20 08:14:22 +01:00
Erik Montnemery
a085d91a0d Remove useless string split from triggers (#166034) 2026-03-20 07:56:55 +01:00
Logan Rosen
6395a0abd0 Reject entity/number price for external statistics in energy config (#165582)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-20 08:34:40 +02:00
Erwin Douna
0de2e689f1 Add pause/resume buttons to Portainer (#166028) 2026-03-19 22:35:53 +01:00
24 changed files with 1134 additions and 561 deletions

View File

@@ -8,6 +8,6 @@
"iot_class": "local_push",
"loggers": ["androidtvremote2"],
"quality_scale": "platinum",
"requirements": ["androidtvremote2==0.2.3"],
"requirements": ["androidtvremote2==0.3.1"],
"zeroconf": ["_androidtvremote2._tcp.local."]
}

View File

@@ -1,7 +1,7 @@
"""Provides triggers for covers."""
from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNAVAILABLE, STATE_UNKNOWN
from homeassistant.core import HomeAssistant, State, split_entity_id
from homeassistant.core import HomeAssistant, State
from homeassistant.helpers.trigger import EntityTriggerBase, Trigger
from .const import ATTR_IS_CLOSED, DOMAIN, CoverDeviceClass
@@ -13,14 +13,14 @@ class CoverTriggerBase(EntityTriggerBase[CoverDomainSpec]):
def _get_value(self, state: State) -> str | bool | None:
"""Extract the relevant value from state based on domain spec."""
domain_spec = self._domain_specs[split_entity_id(state.entity_id)[0]]
domain_spec = self._domain_specs[state.domain]
if domain_spec.value_source is not None:
return state.attributes.get(domain_spec.value_source)
return state.state
def is_valid_state(self, state: State) -> bool:
"""Check if the state matches the target cover state."""
domain_spec = self._domain_specs[split_entity_id(state.entity_id)[0]]
domain_spec = self._domain_specs[state.domain]
return self._get_value(state) == domain_spec.target_value
def is_valid_transition(self, from_state: State, to_state: State) -> bool:

View File

@@ -9,7 +9,7 @@ from typing import Any, Literal, NotRequired, TypedDict
import voluptuous as vol
from homeassistant.core import HomeAssistant, callback
from homeassistant.core import HomeAssistant, callback, valid_entity_id
from homeassistant.helpers import config_validation as cv, singleton, storage
from .const import DOMAIN
@@ -244,6 +244,38 @@ class EnergyPreferencesUpdate(EnergyPreferences, total=False):
"""all types optional."""
def _reject_price_for_external_stat(
*,
stat_key: str,
entity_price_key: str = "entity_energy_price",
number_price_key: str = "number_energy_price",
cost_stat_key: str = "stat_cost",
) -> Callable[[dict[str, Any]], dict[str, Any]]:
"""Return a validator that rejects entity/number price for external statistics.
Only rejects when the cost/compensation stat is not already set, since
price fields are ignored when a cost stat is provided.
"""
def validate(val: dict[str, Any]) -> dict[str, Any]:
stat_id = val.get(stat_key)
if stat_id is not None and not valid_entity_id(stat_id):
if val.get(cost_stat_key) is not None:
# Cost stat is already set; price fields are ignored, so allow.
return val
if (
val.get(entity_price_key) is not None
or val.get(number_price_key) is not None
):
raise vol.Invalid(
"Entity or number price is not supported for external"
f" statistics. Use {cost_stat_key} instead"
)
return val
return validate
def _flow_from_ensure_single_price(
val: FlowFromGridSourceType,
) -> FlowFromGridSourceType:
@@ -268,19 +300,25 @@ FLOW_FROM_GRID_SOURCE_SCHEMA = vol.All(
vol.Optional("number_energy_price"): vol.Any(vol.Coerce(float), None),
}
),
_reject_price_for_external_stat(stat_key="stat_energy_from"),
_flow_from_ensure_single_price,
)
FLOW_TO_GRID_SOURCE_SCHEMA = vol.Schema(
{
vol.Required("stat_energy_to"): str,
vol.Optional("stat_compensation"): vol.Any(str, None),
# entity_energy_to was removed in HA Core 2022.10
vol.Remove("entity_energy_to"): vol.Any(str, None),
vol.Optional("entity_energy_price"): vol.Any(str, None),
vol.Optional("number_energy_price"): vol.Any(vol.Coerce(float), None),
}
FLOW_TO_GRID_SOURCE_SCHEMA = vol.All(
vol.Schema(
{
vol.Required("stat_energy_to"): str,
vol.Optional("stat_compensation"): vol.Any(str, None),
# entity_energy_to was removed in HA Core 2022.10
vol.Remove("entity_energy_to"): vol.Any(str, None),
vol.Optional("entity_energy_price"): vol.Any(str, None),
vol.Optional("number_energy_price"): vol.Any(vol.Coerce(float), None),
}
),
_reject_price_for_external_stat(
stat_key="stat_energy_to", cost_stat_key="stat_compensation"
),
)
@@ -419,6 +457,13 @@ GRID_SOURCE_SCHEMA = vol.All(
vol.Required("cost_adjustment_day"): vol.Coerce(float),
}
),
_reject_price_for_external_stat(stat_key="stat_energy_from"),
_reject_price_for_external_stat(
stat_key="stat_energy_to",
entity_price_key="entity_energy_price_export",
number_price_key="number_energy_price_export",
cost_stat_key="stat_compensation",
),
_grid_ensure_single_price_import,
_grid_ensure_single_price_export,
_grid_ensure_at_least_one_stat,
@@ -442,27 +487,35 @@ BATTERY_SOURCE_SCHEMA = vol.Schema(
vol.Optional("power_config"): POWER_CONFIG_SCHEMA,
}
)
GAS_SOURCE_SCHEMA = vol.Schema(
{
vol.Required("type"): "gas",
vol.Required("stat_energy_from"): str,
vol.Optional("stat_rate"): str,
vol.Optional("stat_cost"): vol.Any(str, None),
# entity_energy_from was removed in HA Core 2022.10
vol.Remove("entity_energy_from"): vol.Any(str, None),
vol.Optional("entity_energy_price"): vol.Any(str, None),
vol.Optional("number_energy_price"): vol.Any(vol.Coerce(float), None),
}
GAS_SOURCE_SCHEMA = vol.All(
vol.Schema(
{
vol.Required("type"): "gas",
vol.Required("stat_energy_from"): str,
vol.Optional("stat_rate"): str,
vol.Optional("stat_cost"): vol.Any(str, None),
# entity_energy_from was removed in HA Core 2022.10
vol.Remove("entity_energy_from"): vol.Any(str, None),
vol.Optional("entity_energy_price"): vol.Any(str, None),
vol.Optional("number_energy_price"): vol.Any(vol.Coerce(float), None),
}
),
_reject_price_for_external_stat(stat_key="stat_energy_from"),
)
WATER_SOURCE_SCHEMA = vol.Schema(
{
vol.Required("type"): "water",
vol.Required("stat_energy_from"): str,
vol.Optional("stat_rate"): str,
vol.Optional("stat_cost"): vol.Any(str, None),
vol.Optional("entity_energy_price"): vol.Any(str, None),
vol.Optional("number_energy_price"): vol.Any(vol.Coerce(float), None),
}
WATER_SOURCE_SCHEMA = vol.All(
vol.Schema(
{
vol.Required("type"): "water",
vol.Required("stat_energy_from"): str,
vol.Optional("stat_rate"): str,
vol.Optional("stat_cost"): vol.Any(str, None),
vol.Optional("entity_energy_price"): vol.Any(str, None),
vol.Optional("number_energy_price"): vol.Any(vol.Coerce(float), None),
}
),
_reject_price_for_external_stat(stat_key="stat_energy_from"),
)

View File

@@ -2,6 +2,7 @@
from __future__ import annotations
from collections.abc import Mapping
import logging
from typing import Any
@@ -57,3 +58,48 @@ class HuumConfigFlow(ConfigFlow, domain=DOMAIN):
return self.async_show_form(
step_id="user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors
)
async def async_step_reauth(
self, entry_data: Mapping[str, Any]
) -> ConfigFlowResult:
"""Handle reauthentication upon an API authentication error."""
return await self.async_step_reauth_confirm()
async def async_step_reauth_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Confirm reauthentication dialog."""
errors: dict[str, str] = {}
reauth_entry = self._get_reauth_entry()
if user_input is not None:
huum = Huum(
reauth_entry.data[CONF_USERNAME],
user_input[CONF_PASSWORD],
session=async_get_clientsession(self.hass),
)
try:
await huum.status()
except Forbidden, NotAuthenticated:
errors["base"] = "invalid_auth"
except Exception:
_LOGGER.exception("Unknown error")
errors["base"] = "unknown"
else:
return self.async_update_reload_and_abort(
reauth_entry,
data_updates={CONF_PASSWORD: user_input[CONF_PASSWORD]},
)
return self.async_show_form(
step_id="reauth_confirm",
data_schema=vol.Schema(
{
vol.Required(CONF_PASSWORD): str,
}
),
description_placeholders={
"username": reauth_entry.data[CONF_USERNAME],
},
errors=errors,
)

View File

@@ -12,8 +12,9 @@ from huum.schemas import HuumStatusResponse
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from .const import DOMAIN
@@ -54,6 +55,6 @@ class HuumDataUpdateCoordinator(DataUpdateCoordinator[HuumStatusResponse]):
try:
return await self.huum.status()
except (Forbidden, NotAuthenticated) as err:
raise UpdateFailed(
raise ConfigEntryAuthFailed(
"Could not log in to Huum with given credentials"
) from err

View File

@@ -38,7 +38,7 @@ rules:
integration-owner: done
log-when-unavailable: done
parallel-updates: done
reauthentication-flow: todo
reauthentication-flow: done
test-coverage:
status: todo
comment: |

View File

@@ -1,7 +1,8 @@
{
"config": {
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
},
"error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
@@ -9,6 +10,16 @@
"unknown": "[%key:common::config_flow::error::unknown%]"
},
"step": {
"reauth_confirm": {
"data": {
"password": "[%key:common::config_flow::data::password%]"
},
"data_description": {
"password": "[%key:component::huum::config::step::user::data_description::password%]"
},
"description": "The authentication for {username} is no longer valid. Please enter the current password.",
"title": "[%key:common::config_flow::title::reauth%]"
},
"user": {
"data": {
"password": "[%key:common::config_flow::data::password%]",

View File

@@ -140,14 +140,6 @@
"pump_status": {
"default": "mdi:pump"
},
"setpoint_change_source": {
"default": "mdi:hand-back-right",
"state": {
"external": "mdi:webhook",
"manual": "mdi:hand-back-right",
"schedule": "mdi:calendar-clock"
}
},
"tank_percentage": {
"default": "mdi:water-boiler"
},

View File

@@ -183,13 +183,6 @@ EVSE_FAULT_STATE_MAP = {
clusters.EnergyEvse.Enums.FaultStateEnum.kOther: "other",
}
SETPOINT_CHANGE_SOURCE_MAP = {
clusters.Thermostat.Enums.SetpointChangeSourceEnum.kManual: "manual",
clusters.Thermostat.Enums.SetpointChangeSourceEnum.kSchedule: "schedule",
clusters.Thermostat.Enums.SetpointChangeSourceEnum.kExternal: "external",
clusters.Thermostat.Enums.SetpointChangeSourceEnum.kUnknownEnumValue: None,
}
PUMP_CONTROL_MODE_MAP = {
clusters.PumpConfigurationAndControl.Enums.ControlModeEnum.kConstantSpeed: "constant_speed",
clusters.PumpConfigurationAndControl.Enums.ControlModeEnum.kConstantPressure: "constant_pressure",
@@ -1586,48 +1579,4 @@ DISCOVERY_SCHEMAS = [
required_attributes=(clusters.DoorLock.Attributes.DoorClosedEvents,),
featuremap_contains=clusters.DoorLock.Bitmaps.Feature.kDoorPositionSensor,
),
MatterDiscoverySchema(
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(
key="SetpointChangeSource",
translation_key="setpoint_change_source",
device_class=SensorDeviceClass.ENUM,
state_class=None,
options=[x for x in SETPOINT_CHANGE_SOURCE_MAP.values() if x is not None],
device_to_ha=SETPOINT_CHANGE_SOURCE_MAP.get,
),
entity_class=MatterSensor,
required_attributes=(clusters.Thermostat.Attributes.SetpointChangeSource,),
device_type=(device_types.Thermostat, device_types.RoomAirConditioner),
),
MatterDiscoverySchema(
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(
key="SetpointChangeSourceTimestamp",
translation_key="setpoint_change_timestamp",
device_class=SensorDeviceClass.TIMESTAMP,
state_class=None,
device_to_ha=matter_epoch_seconds_to_utc,
),
entity_class=MatterSensor,
required_attributes=(
clusters.Thermostat.Attributes.SetpointChangeSourceTimestamp,
),
device_type=(device_types.Thermostat, device_types.RoomAirConditioner),
),
MatterDiscoverySchema(
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(
key="ThermostatSetpointChangeAmount",
translation_key="setpoint_change_amount",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
suggested_display_precision=1,
device_class=SensorDeviceClass.TEMPERATURE,
device_to_ha=lambda x: x / TEMPERATURE_SCALING_FACTOR,
state_class=SensorStateClass.MEASUREMENT,
),
entity_class=MatterSensor,
required_attributes=(clusters.Thermostat.Attributes.SetpointChangeAmount,),
device_type=(device_types.Thermostat, device_types.RoomAirConditioner),
),
]

View File

@@ -558,20 +558,6 @@
"rms_voltage": {
"name": "Effective voltage"
},
"setpoint_change_amount": {
"name": "Last change amount"
},
"setpoint_change_source": {
"name": "Last change source",
"state": {
"external": "External",
"manual": "Manual",
"schedule": "Schedule"
}
},
"setpoint_change_timestamp": {
"name": "Last change"
},
"switch_current_position": {
"name": "Current switch position"
},

View File

@@ -13,7 +13,7 @@ from homeassistant.const import (
CONF_PASSWORD,
CONF_USERNAME,
)
from homeassistant.core import HomeAssistant, callback, split_entity_id
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.device_registry import DeviceEntry
@@ -103,10 +103,8 @@ def _async_device_as_dict(hass: HomeAssistant, device: DeviceEntry) -> dict[str,
# The context doesn't provide useful information in this case.
state_dict.pop("context", None)
entity_domain = split_entity_id(state.entity_id)[0]
# Retract some sensitive state attributes
if entity_domain == device_tracker.DOMAIN:
if state.domain == device_tracker.DOMAIN:
state_dict["attributes"] = async_redact_data(
state_dict["attributes"], REDACT_STATE_DEVICE_TRACKER
)

View File

@@ -9,5 +9,5 @@
"iot_class": "cloud_polling",
"loggers": ["opower"],
"quality_scale": "platinum",
"requirements": ["opower==0.17.0"]
"requirements": ["opower==0.17.1"]
}

View File

@@ -74,6 +74,26 @@ CONTAINER_BUTTONS: tuple[PortainerButtonDescription, ...] = (
)
),
),
PortainerButtonDescription(
key="pause",
translation_key="pause_container",
entity_category=EntityCategory.CONFIG,
press_action=(
lambda portainer, endpoint_id, container_id: portainer.pause_container(
endpoint_id, container_id
)
),
),
PortainerButtonDescription(
key="resume",
translation_key="resume_container",
entity_category=EntityCategory.CONFIG,
press_action=(
lambda portainer, endpoint_id, container_id: portainer.unpause_container(
endpoint_id, container_id
)
),
),
)

View File

@@ -1,5 +1,13 @@
{
"entity": {
"button": {
"pause_container": {
"default": "mdi:pause-circle"
},
"resume_container": {
"default": "mdi:play"
}
},
"sensor": {
"api_version": {
"default": "mdi:api"

View File

@@ -66,8 +66,14 @@
"images_prune": {
"name": "Prune unused images"
},
"pause_container": {
"name": "Pause container"
},
"restart_container": {
"name": "Restart container"
},
"resume_container": {
"name": "Resume container"
}
},
"sensor": {

View File

@@ -53,7 +53,6 @@ from homeassistant.core import (
callback,
get_hassjob_callable_job_type,
is_callback,
split_entity_id,
valid_entity_id,
)
from homeassistant.exceptions import HomeAssistantError, TemplateError
@@ -364,7 +363,7 @@ class EntityTriggerBase[DomainSpecT: DomainSpec = DomainSpec](Trigger):
def _get_tracked_value(self, state: State) -> Any:
"""Get the tracked value from a state based on the DomainSpec."""
domain_spec = self._domain_specs[split_entity_id(state.entity_id)[0]]
domain_spec = self._domain_specs[state.domain]
if domain_spec.value_source is None:
return state.state
return state.attributes.get(domain_spec.value_source)
@@ -598,14 +597,14 @@ class EntityNumericalStateTriggerBase(EntityTriggerBase[NumericalDomainSpec]):
def _get_tracked_value(self, state: State) -> Any:
"""Get the tracked numerical value from a state."""
domain_spec = self._domain_specs[split_entity_id(state.entity_id)[0]]
domain_spec = self._domain_specs[state.domain]
if domain_spec.value_source is None:
return state.state
return state.attributes.get(domain_spec.value_source)
def _get_converter(self, state: State) -> Callable[[Any], float]:
"""Get the value converter for an entity."""
domain_spec = self._domain_specs[split_entity_id(state.entity_id)[0]]
domain_spec = self._domain_specs[state.domain]
if domain_spec.value_converter is not None:
return domain_spec.value_converter
return float

4
requirements_all.txt generated
View File

@@ -494,7 +494,7 @@ amcrest==1.9.9
androidtv[async]==0.0.75
# homeassistant.components.androidtv_remote
androidtvremote2==0.2.3
androidtvremote2==0.3.1
# homeassistant.components.anel_pwrctrl
anel-pwrctrl-homeassistant==0.0.1.dev2
@@ -1726,7 +1726,7 @@ openwrt-luci-rpc==1.1.17
openwrt-ubus-rpc==0.0.2
# homeassistant.components.opower
opower==0.17.0
opower==0.17.1
# homeassistant.components.oralb
oralb-ble==1.0.2

View File

@@ -473,7 +473,7 @@ amberelectric==2.0.12
androidtv[async]==0.0.75
# homeassistant.components.androidtv_remote
androidtvremote2==0.2.3
androidtvremote2==0.3.1
# homeassistant.components.anova
anova-wifi==0.17.0
@@ -1503,7 +1503,7 @@ openrgb-python==0.3.6
openwebifpy==4.3.1
# homeassistant.components.opower
opower==0.17.0
opower==0.17.1
# homeassistant.components.oralb
oralb-ble==1.0.2

View File

@@ -6,7 +6,10 @@ import voluptuous as vol
from homeassistant.components.energy.data import (
ENERGY_SOURCE_SCHEMA,
FLOW_FROM_GRID_SOURCE_SCHEMA,
FLOW_TO_GRID_SOURCE_SCHEMA,
GAS_SOURCE_SCHEMA,
POWER_CONFIG_SCHEMA,
WATER_SOURCE_SCHEMA,
EnergyManager,
)
from homeassistant.core import HomeAssistant
@@ -853,3 +856,241 @@ async def test_grid_validation_single_export_price() -> None:
}
]
)
async def test_flow_from_rejects_entity_price_for_external_stat() -> None:
"""Test that entity_energy_price is rejected for external statistics."""
with pytest.raises(vol.Invalid, match="not supported for external statistics"):
FLOW_FROM_GRID_SOURCE_SCHEMA(
{
"stat_energy_from": "opower:utility_elec_12345_energy_consumption",
"entity_energy_price": "input_number.electricity_rate",
}
)
async def test_flow_from_rejects_number_price_for_external_stat() -> None:
"""Test that number_energy_price is rejected for external statistics."""
with pytest.raises(vol.Invalid, match="not supported for external statistics"):
FLOW_FROM_GRID_SOURCE_SCHEMA(
{
"stat_energy_from": "opower:utility_elec_12345_energy_consumption",
"number_energy_price": 0.15,
}
)
async def test_flow_from_allows_stat_cost_for_external_stat() -> None:
"""Test that stat_cost is allowed for external statistics."""
result = FLOW_FROM_GRID_SOURCE_SCHEMA(
{
"stat_energy_from": "opower:utility_elec_12345_energy_consumption",
"stat_cost": "opower:utility_elec_12345_energy_cost",
"entity_energy_price": None,
"number_energy_price": None,
}
)
assert result["stat_energy_from"] == "opower:utility_elec_12345_energy_consumption"
assert result["stat_cost"] == "opower:utility_elec_12345_energy_cost"
async def test_flow_from_allows_no_cost_for_external_stat() -> None:
"""Test that external statistics with no cost config are allowed."""
result = FLOW_FROM_GRID_SOURCE_SCHEMA(
{
"stat_energy_from": "opower:utility_elec_12345_energy_consumption",
"entity_energy_price": None,
"number_energy_price": None,
}
)
assert result["stat_energy_from"] == "opower:utility_elec_12345_energy_consumption"
async def test_flow_to_rejects_entity_price_for_external_stat() -> None:
"""Test that entity_energy_price is rejected for external export statistics."""
with pytest.raises(vol.Invalid, match="not supported for external statistics"):
FLOW_TO_GRID_SOURCE_SCHEMA(
{
"stat_energy_to": "external:grid_export",
"entity_energy_price": "sensor.sell_price",
}
)
async def test_flow_to_rejects_number_price_for_external_stat() -> None:
"""Test that number_energy_price is rejected for external export statistics."""
with pytest.raises(vol.Invalid, match="not supported for external statistics"):
FLOW_TO_GRID_SOURCE_SCHEMA(
{
"stat_energy_to": "external:grid_export",
"number_energy_price": 0.08,
}
)
async def test_grid_rejects_entity_price_for_external_import_stat() -> None:
"""Test that grid schema rejects entity price for external import stats."""
with pytest.raises(vol.Invalid, match="not supported for external statistics"):
ENERGY_SOURCE_SCHEMA(
[
{
"type": "grid",
"stat_energy_from": "opower:utility_elec_12345_energy_consumption",
"entity_energy_price": "input_number.electricity_rate",
"cost_adjustment_day": 0,
}
]
)
async def test_grid_rejects_number_price_for_external_export_stat() -> None:
"""Test that grid schema rejects number price for external export stats."""
with pytest.raises(vol.Invalid, match="not supported for external statistics"):
ENERGY_SOURCE_SCHEMA(
[
{
"type": "grid",
"stat_energy_to": "external:grid_export",
"number_energy_price_export": 0.08,
"cost_adjustment_day": 0,
}
]
)
async def test_grid_allows_stat_cost_for_external_stat() -> None:
"""Test that grid schema allows stat_cost with external statistics."""
result = ENERGY_SOURCE_SCHEMA(
[
{
"type": "grid",
"stat_energy_from": "opower:utility_elec_12345_energy_consumption",
"stat_cost": "opower:utility_elec_12345_energy_cost",
"cost_adjustment_day": 0,
}
]
)
assert (
result[0]["stat_energy_from"] == "opower:utility_elec_12345_energy_consumption"
)
assert result[0]["stat_cost"] == "opower:utility_elec_12345_energy_cost"
async def test_gas_rejects_entity_price_for_external_stat() -> None:
"""Test that gas schema rejects entity price for external statistics."""
with pytest.raises(vol.Invalid, match="not supported for external statistics"):
GAS_SOURCE_SCHEMA(
{
"type": "gas",
"stat_energy_from": "external:gas_consumption",
"entity_energy_price": "sensor.gas_price",
}
)
async def test_gas_rejects_number_price_for_external_stat() -> None:
"""Test that gas schema rejects number price for external statistics."""
with pytest.raises(vol.Invalid, match="not supported for external statistics"):
GAS_SOURCE_SCHEMA(
{
"type": "gas",
"stat_energy_from": "external:gas_consumption",
"number_energy_price": 1.50,
}
)
async def test_water_rejects_entity_price_for_external_stat() -> None:
"""Test that water schema rejects entity price for external statistics."""
with pytest.raises(vol.Invalid, match="not supported for external statistics"):
WATER_SOURCE_SCHEMA(
{
"type": "water",
"stat_energy_from": "external:water_consumption",
"entity_energy_price": "sensor.water_price",
}
)
async def test_water_rejects_number_price_for_external_stat() -> None:
"""Test that water schema rejects number price for external statistics."""
with pytest.raises(vol.Invalid, match="not supported for external statistics"):
WATER_SOURCE_SCHEMA(
{
"type": "water",
"stat_energy_from": "external:water_consumption",
"number_energy_price": 0.005,
}
)
async def test_flow_from_allows_price_with_stat_cost_for_external_stat() -> None:
"""Test that price fields are allowed when stat_cost is already set."""
result = FLOW_FROM_GRID_SOURCE_SCHEMA(
{
"stat_energy_from": "opower:utility_elec_12345_energy_consumption",
"stat_cost": "opower:utility_elec_12345_energy_cost",
"entity_energy_price": "input_number.electricity_rate",
"number_energy_price": None,
}
)
assert result["stat_cost"] == "opower:utility_elec_12345_energy_cost"
assert result["entity_energy_price"] == "input_number.electricity_rate"
async def test_flow_to_allows_price_with_stat_compensation_for_external_stat() -> None:
"""Test that price fields are allowed when stat_compensation is already set."""
result = FLOW_TO_GRID_SOURCE_SCHEMA(
{
"stat_energy_to": "external:grid_export",
"stat_compensation": "external:grid_compensation",
"number_energy_price": 0.08,
}
)
assert result["stat_compensation"] == "external:grid_compensation"
assert result["number_energy_price"] == 0.08
async def test_grid_allows_price_with_stat_cost_for_external_stat() -> None:
"""Test that grid schema allows price when stat_cost is set for external stats."""
result = ENERGY_SOURCE_SCHEMA(
[
{
"type": "grid",
"stat_energy_from": "opower:utility_elec_12345_energy_consumption",
"stat_cost": "opower:utility_elec_12345_energy_cost",
"entity_energy_price": "input_number.electricity_rate",
"cost_adjustment_day": 0,
}
]
)
assert result[0]["stat_cost"] == "opower:utility_elec_12345_energy_cost"
assert result[0]["entity_energy_price"] == "input_number.electricity_rate"
async def test_gas_allows_price_with_stat_cost_for_external_stat() -> None:
"""Test that gas schema allows price when stat_cost is set for external stats."""
result = GAS_SOURCE_SCHEMA(
{
"type": "gas",
"stat_energy_from": "external:gas_consumption",
"stat_cost": "external:gas_cost",
"entity_energy_price": "sensor.gas_price",
}
)
assert result["stat_cost"] == "external:gas_cost"
assert result["entity_energy_price"] == "sensor.gas_price"
async def test_water_allows_price_with_stat_cost_for_external_stat() -> None:
"""Test that water schema allows price when stat_cost is set for external stats."""
result = WATER_SOURCE_SCHEMA(
{
"type": "water",
"stat_energy_from": "external:water_consumption",
"stat_cost": "external:water_cost",
"number_energy_price": 0.005,
}
)
assert result["stat_cost"] == "external:water_cost"
assert result["number_energy_price"] == 0.005

View File

@@ -115,3 +115,76 @@ async def test_huum_errors(
},
)
assert result["type"] is FlowResultType.CREATE_ENTRY
async def test_reauth_flow(
hass: HomeAssistant,
mock_huum: AsyncMock,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test reauthentication flow succeeds with valid credentials."""
mock_config_entry.add_to_hass(hass)
result = await mock_config_entry.start_reauth_flow(hass)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "reauth_confirm"
assert result["errors"] == {}
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
{CONF_PASSWORD: "new_password"},
)
await hass.async_block_till_done()
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "reauth_successful"
assert mock_config_entry.data[CONF_USERNAME] == TEST_USERNAME
assert mock_config_entry.data[CONF_PASSWORD] == "new_password"
@pytest.mark.parametrize(
(
"raises",
"error_base",
),
[
(Exception, "unknown"),
(Forbidden, "invalid_auth"),
],
)
async def test_reauth_errors(
hass: HomeAssistant,
mock_huum: AsyncMock,
mock_config_entry: MockConfigEntry,
raises: Exception,
error_base: str,
) -> None:
"""Test reauthentication flow handles errors and recovers."""
mock_config_entry.add_to_hass(hass)
result = await mock_config_entry.start_reauth_flow(hass)
with patch(
"homeassistant.components.huum.config_flow.Huum.status",
side_effect=raises,
):
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
{CONF_PASSWORD: "wrong_password"},
)
assert result["type"] is FlowResultType.FORM
assert result["errors"] == {"base": error_base}
# Recover with valid credentials
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
{CONF_PASSWORD: "new_password"},
)
await hass.async_block_till_done()
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "reauth_successful"
assert mock_config_entry.data[CONF_USERNAME] == TEST_USERNAME
assert mock_config_entry.data[CONF_PASSWORD] == "new_password"

View File

@@ -1,7 +1,11 @@
"""Tests for the Huum __init__."""
from unittest.mock import AsyncMock
from unittest.mock import AsyncMock, patch
from huum.exceptions import Forbidden, NotAuthenticated
import pytest
from homeassistant import config_entries
from homeassistant.components.huum.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import Platform
@@ -25,3 +29,25 @@ async def test_loading_and_unloading_config_entry(
await hass.async_block_till_done()
assert mock_config_entry.state is ConfigEntryState.NOT_LOADED
@pytest.mark.parametrize("side_effect", [Forbidden, NotAuthenticated])
async def test_auth_error_triggers_reauth(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
side_effect: type[Exception],
) -> None:
"""Test that an auth error during coordinator refresh triggers reauth."""
mock_config_entry.add_to_hass(hass)
with patch(
"homeassistant.components.huum.coordinator.Huum.status",
side_effect=side_effect,
):
await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
assert mock_config_entry.state is ConfigEntryState.SETUP_ERROR
assert any(
mock_config_entry.async_get_active_flows(hass, {config_entries.SOURCE_REAUTH})
)

View File

@@ -4145,177 +4145,6 @@
'state': '100',
})
# ---
# name: test_sensors[eve_thermo_v5][sensor.eve_thermo_20ecd1701_last_change-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.eve_thermo_20ecd1701_last_change',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Last change',
'options': dict({
}),
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
'original_icon': None,
'original_name': 'Last change',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'setpoint_change_timestamp',
'unique_id': '00000000000004D2-000000000000000C-MatterNodeDevice-1-SetpointChangeSourceTimestamp-513-50',
'unit_of_measurement': None,
})
# ---
# name: test_sensors[eve_thermo_v5][sensor.eve_thermo_20ecd1701_last_change-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'timestamp',
'friendly_name': 'Eve Thermo 20ECD1701 Last change',
}),
'context': <ANY>,
'entity_id': 'sensor.eve_thermo_20ecd1701_last_change',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_sensors[eve_thermo_v5][sensor.eve_thermo_20ecd1701_last_change_amount-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.eve_thermo_20ecd1701_last_change_amount',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Last change amount',
'options': dict({
'sensor': dict({
'suggested_display_precision': 1,
}),
}),
'original_device_class': <SensorDeviceClass.TEMPERATURE: 'temperature'>,
'original_icon': None,
'original_name': 'Last change amount',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'setpoint_change_amount',
'unique_id': '00000000000004D2-000000000000000C-MatterNodeDevice-1-ThermostatSetpointChangeAmount-513-49',
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
})
# ---
# name: test_sensors[eve_thermo_v5][sensor.eve_thermo_20ecd1701_last_change_amount-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'temperature',
'friendly_name': 'Eve Thermo 20ECD1701 Last change amount',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
'entity_id': 'sensor.eve_thermo_20ecd1701_last_change_amount',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '0.0',
})
# ---
# name: test_sensors[eve_thermo_v5][sensor.eve_thermo_20ecd1701_last_change_source-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': dict({
'options': list([
'manual',
'schedule',
'external',
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.eve_thermo_20ecd1701_last_change_source',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Last change source',
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
'original_icon': None,
'original_name': 'Last change source',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'setpoint_change_source',
'unique_id': '00000000000004D2-000000000000000C-MatterNodeDevice-1-SetpointChangeSource-513-48',
'unit_of_measurement': None,
})
# ---
# name: test_sensors[eve_thermo_v5][sensor.eve_thermo_20ecd1701_last_change_source-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'enum',
'friendly_name': 'Eve Thermo 20ECD1701 Last change source',
'options': list([
'manual',
'schedule',
'external',
]),
}),
'context': <ANY>,
'entity_id': 'sensor.eve_thermo_20ecd1701_last_change_source',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'manual',
})
# ---
# name: test_sensors[eve_thermo_v5][sensor.eve_thermo_20ecd1701_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
@@ -11304,177 +11133,6 @@
'state': '25',
})
# ---
# name: test_sensors[mock_thermostat][sensor.mock_thermostat_last_change-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.mock_thermostat_last_change',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Last change',
'options': dict({
}),
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
'original_icon': None,
'original_name': 'Last change',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'setpoint_change_timestamp',
'unique_id': '00000000000004D2-0000000000000096-MatterNodeDevice-1-SetpointChangeSourceTimestamp-513-50',
'unit_of_measurement': None,
})
# ---
# name: test_sensors[mock_thermostat][sensor.mock_thermostat_last_change-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'timestamp',
'friendly_name': 'Mock Thermostat Last change',
}),
'context': <ANY>,
'entity_id': 'sensor.mock_thermostat_last_change',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '2025-01-01T00:00:00+00:00',
})
# ---
# name: test_sensors[mock_thermostat][sensor.mock_thermostat_last_change_amount-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.mock_thermostat_last_change_amount',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Last change amount',
'options': dict({
'sensor': dict({
'suggested_display_precision': 1,
}),
}),
'original_device_class': <SensorDeviceClass.TEMPERATURE: 'temperature'>,
'original_icon': None,
'original_name': 'Last change amount',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'setpoint_change_amount',
'unique_id': '00000000000004D2-0000000000000096-MatterNodeDevice-1-ThermostatSetpointChangeAmount-513-49',
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
})
# ---
# name: test_sensors[mock_thermostat][sensor.mock_thermostat_last_change_amount-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'temperature',
'friendly_name': 'Mock Thermostat Last change amount',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
'entity_id': 'sensor.mock_thermostat_last_change_amount',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '1.5',
})
# ---
# name: test_sensors[mock_thermostat][sensor.mock_thermostat_last_change_source-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': dict({
'options': list([
'manual',
'schedule',
'external',
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.mock_thermostat_last_change_source',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Last change source',
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
'original_icon': None,
'original_name': 'Last change source',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'setpoint_change_source',
'unique_id': '00000000000004D2-0000000000000096-MatterNodeDevice-1-SetpointChangeSource-513-48',
'unit_of_measurement': None,
})
# ---
# name: test_sensors[mock_thermostat][sensor.mock_thermostat_last_change_source-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'enum',
'friendly_name': 'Mock Thermostat Last change source',
'options': list([
'manual',
'schedule',
'external',
]),
}),
'context': <ANY>,
'entity_id': 'sensor.mock_thermostat_last_change_source',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'manual',
})
# ---
# name: test_sensors[mock_thermostat][sensor.mock_thermostat_outdoor_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': list([

View File

@@ -233,100 +233,6 @@ async def test_eve_thermo_sensor(
assert state.state == "18.0"
@pytest.mark.parametrize("node_fixture", ["eve_thermo_v5"])
async def test_eve_thermo_v5_setpoint_change_source(
hass: HomeAssistant,
matter_client: MagicMock,
matter_node: MatterNode,
) -> None:
"""Test Eve Thermo v5 SetpointChangeSource sensor."""
entity_id = "sensor.eve_thermo_20ecd1701_last_change_source"
# Initial state and options
state = hass.states.get(entity_id)
assert state
assert state.state == "manual"
assert state.attributes["options"] == ["manual", "schedule", "external"]
# Change to schedule
set_node_attribute(matter_node, 1, 513, 48, 1)
await trigger_subscription_callback(hass, matter_client)
state = hass.states.get(entity_id)
assert state
assert state.state == "schedule"
# Change to external
set_node_attribute(matter_node, 1, 513, 48, 2)
await trigger_subscription_callback(hass, matter_client)
state = hass.states.get(entity_id)
assert state
assert state.state == "external"
@pytest.mark.parametrize("node_fixture", ["eve_thermo_v5"])
async def test_eve_thermo_v5_setpoint_change_timestamp(
hass: HomeAssistant,
matter_client: MagicMock,
matter_node: MatterNode,
) -> None:
"""Test Eve Thermo v5 SetpointChangeSourceTimestamp sensor."""
entity_id = "sensor.eve_thermo_20ecd1701_last_change"
# Initial is unknown per snapshot
state = hass.states.get(entity_id)
assert state
assert state.state == "unknown"
# Update to 2024-01-01 00:00:00+00:00 (Matter epoch seconds since 2000)
set_node_attribute(matter_node, 1, 513, 50, 757382400)
await trigger_subscription_callback(hass, matter_client)
state = hass.states.get(entity_id)
assert state
assert state.state == "2024-01-01T00:00:00+00:00"
# Set to zero should yield unknown
set_node_attribute(matter_node, 1, 513, 50, 0)
await trigger_subscription_callback(hass, matter_client)
state = hass.states.get(entity_id)
assert state
assert state.state == "unknown"
@pytest.mark.parametrize("node_fixture", ["eve_thermo_v5"])
async def test_eve_thermo_v5_setpoint_change_amount(
hass: HomeAssistant,
matter_client: MagicMock,
matter_node: MatterNode,
) -> None:
"""Test Eve Thermo v5 SetpointChangeAmount sensor."""
entity_id = "sensor.eve_thermo_20ecd1701_last_change_amount"
# Initial per snapshot
state = hass.states.get(entity_id)
assert state
assert state.state == "0.0"
# Update to 2.0°C (200 in Matter units)
set_node_attribute(matter_node, 1, 513, 49, 200)
await trigger_subscription_callback(hass, matter_client)
state = hass.states.get(entity_id)
assert state
assert state.state == "2.0"
# Update to -0.5°C (-50 in Matter units)
set_node_attribute(matter_node, 1, 513, 49, -50)
await trigger_subscription_callback(hass, matter_client)
state = hass.states.get(entity_id)
assert state
assert state.state == "-0.5"
@pytest.mark.parametrize("node_fixture", ["longan_link_thermostat"])
async def test_thermostat_outdoor(
hass: HomeAssistant,

View File

@@ -1,4 +1,54 @@
# serializer version: 1
# name: test_all_button_entities_snapshot[button.dashy_dashy_1_qgza68hnz4n1qvyz3iohynx05_pause_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.dashy_dashy_1_qgza68hnz4n1qvyz3iohynx05_pause_container',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Pause container',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Pause container',
'platform': 'portainer',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'pause_container',
'unique_id': 'portainer_test_entry_123_dashy_dashy.1.qgza68hnz4n1qvyz3iohynx05_pause',
'unit_of_measurement': None,
})
# ---
# name: test_all_button_entities_snapshot[button.dashy_dashy_1_qgza68hnz4n1qvyz3iohynx05_pause_container-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'dashy_dashy.1.qgza68hnz4n1qvyz3iohynx05 Pause container',
}),
'context': <ANY>,
'entity_id': 'button.dashy_dashy_1_qgza68hnz4n1qvyz3iohynx05_pause_container',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.dashy_dashy_1_qgza68hnz4n1qvyz3iohynx05_restart_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
@@ -50,6 +100,106 @@
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.dashy_dashy_1_qgza68hnz4n1qvyz3iohynx05_resume_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.dashy_dashy_1_qgza68hnz4n1qvyz3iohynx05_resume_container',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Resume container',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Resume container',
'platform': 'portainer',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'resume_container',
'unique_id': 'portainer_test_entry_123_dashy_dashy.1.qgza68hnz4n1qvyz3iohynx05_resume',
'unit_of_measurement': None,
})
# ---
# name: test_all_button_entities_snapshot[button.dashy_dashy_1_qgza68hnz4n1qvyz3iohynx05_resume_container-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'dashy_dashy.1.qgza68hnz4n1qvyz3iohynx05 Resume container',
}),
'context': <ANY>,
'entity_id': 'button.dashy_dashy_1_qgza68hnz4n1qvyz3iohynx05_resume_container',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.focused_einstein_pause_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.focused_einstein_pause_container',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Pause container',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Pause container',
'platform': 'portainer',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'pause_container',
'unique_id': 'portainer_test_entry_123_focused_einstein_pause',
'unit_of_measurement': None,
})
# ---
# name: test_all_button_entities_snapshot[button.focused_einstein_pause_container-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'focused_einstein Pause container',
}),
'context': <ANY>,
'entity_id': 'button.focused_einstein_pause_container',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.focused_einstein_restart_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
@@ -101,6 +251,106 @@
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.focused_einstein_resume_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.focused_einstein_resume_container',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Resume container',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Resume container',
'platform': 'portainer',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'resume_container',
'unique_id': 'portainer_test_entry_123_focused_einstein_resume',
'unit_of_measurement': None,
})
# ---
# name: test_all_button_entities_snapshot[button.focused_einstein_resume_container-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'focused_einstein Resume container',
}),
'context': <ANY>,
'entity_id': 'button.focused_einstein_resume_container',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.funny_chatelet_pause_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.funny_chatelet_pause_container',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Pause container',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Pause container',
'platform': 'portainer',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'pause_container',
'unique_id': 'portainer_test_entry_123_funny_chatelet_pause',
'unit_of_measurement': None,
})
# ---
# name: test_all_button_entities_snapshot[button.funny_chatelet_pause_container-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'funny_chatelet Pause container',
}),
'context': <ANY>,
'entity_id': 'button.funny_chatelet_pause_container',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.funny_chatelet_restart_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
@@ -152,6 +402,56 @@
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.funny_chatelet_resume_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.funny_chatelet_resume_container',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Resume container',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Resume container',
'platform': 'portainer',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'resume_container',
'unique_id': 'portainer_test_entry_123_funny_chatelet_resume',
'unit_of_measurement': None,
})
# ---
# name: test_all_button_entities_snapshot[button.funny_chatelet_resume_container-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'funny_chatelet Resume container',
}),
'context': <ANY>,
'entity_id': 'button.funny_chatelet_resume_container',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.my_environment_prune_unused_images-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
@@ -203,6 +503,56 @@
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.practical_morse_pause_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.practical_morse_pause_container',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Pause container',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Pause container',
'platform': 'portainer',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'pause_container',
'unique_id': 'portainer_test_entry_123_practical_morse_pause',
'unit_of_measurement': None,
})
# ---
# name: test_all_button_entities_snapshot[button.practical_morse_pause_container-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'practical_morse Pause container',
}),
'context': <ANY>,
'entity_id': 'button.practical_morse_pause_container',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.practical_morse_restart_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
@@ -254,6 +604,106 @@
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.practical_morse_resume_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.practical_morse_resume_container',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Resume container',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Resume container',
'platform': 'portainer',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'resume_container',
'unique_id': 'portainer_test_entry_123_practical_morse_resume',
'unit_of_measurement': None,
})
# ---
# name: test_all_button_entities_snapshot[button.practical_morse_resume_container-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'practical_morse Resume container',
}),
'context': <ANY>,
'entity_id': 'button.practical_morse_resume_container',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.serene_banach_pause_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.serene_banach_pause_container',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Pause container',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Pause container',
'platform': 'portainer',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'pause_container',
'unique_id': 'portainer_test_entry_123_serene_banach_pause',
'unit_of_measurement': None,
})
# ---
# name: test_all_button_entities_snapshot[button.serene_banach_pause_container-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'serene_banach Pause container',
}),
'context': <ANY>,
'entity_id': 'button.serene_banach_pause_container',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.serene_banach_restart_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
@@ -305,6 +755,106 @@
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.serene_banach_resume_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.serene_banach_resume_container',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Resume container',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Resume container',
'platform': 'portainer',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'resume_container',
'unique_id': 'portainer_test_entry_123_serene_banach_resume',
'unit_of_measurement': None,
})
# ---
# name: test_all_button_entities_snapshot[button.serene_banach_resume_container-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'serene_banach Resume container',
}),
'context': <ANY>,
'entity_id': 'button.serene_banach_resume_container',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.stoic_turing_pause_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.stoic_turing_pause_container',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Pause container',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Pause container',
'platform': 'portainer',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'pause_container',
'unique_id': 'portainer_test_entry_123_stoic_turing_pause',
'unit_of_measurement': None,
})
# ---
# name: test_all_button_entities_snapshot[button.stoic_turing_pause_container-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'stoic_turing Pause container',
}),
'context': <ANY>,
'entity_id': 'button.stoic_turing_pause_container',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.stoic_turing_restart_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
@@ -356,3 +906,53 @@
'state': 'unknown',
})
# ---
# name: test_all_button_entities_snapshot[button.stoic_turing_resume_container-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.stoic_turing_resume_container',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Resume container',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Resume container',
'platform': 'portainer',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'resume_container',
'unique_id': 'portainer_test_entry_123_stoic_turing_resume',
'unit_of_measurement': None,
})
# ---
# name: test_all_button_entities_snapshot[button.stoic_turing_resume_container-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'stoic_turing Resume container',
}),
'context': <ANY>,
'entity_id': 'button.stoic_turing_resume_container',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---