mirror of
https://github.com/home-assistant/core.git
synced 2025-11-14 21:40:16 +00:00
Home connect program select entities (#126157)
* Home connect selector for programs * Mark program switches as deprecated * Simplified translation keys * Improvements for program select entity * Revert mark program switches as deprecated * Return `None` if program is `None` or empty string * Fix program format * Use `is` instead of `==` * Program selector entity selects program instead of start the selected program * Fix typo * Active and selected program * Added ServiceValidationError * Delete unnecessary `service` param at tests * Use full program keys * Fix again typos in programs states * Use map for translations * Add error handling for when the selected program is not registered on the program map * Reverse map for programs and translation keys * Remove stale string * Log only once that the program is not part of the official Home Connect API specification * pop programs * Move `RE_CAMEL_CASE` to a better place * Added warning if updated program is not valid * Stale test function name * Improve log about unknown program at update * Add underscore before numbers in translation keys * Added suggested changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Use target for adding an executor job * Apply suggestions from code review * Clean whitespace --------- Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
committed by
GitHub
parent
b2537a45e0
commit
c2d6599736
@@ -10,7 +10,10 @@ from requests import HTTPError
|
||||
import requests_mock
|
||||
|
||||
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||
from homeassistant.components.home_connect import SCAN_INTERVAL
|
||||
from homeassistant.components.home_connect import (
|
||||
SCAN_INTERVAL,
|
||||
bsh_key_to_translation_key,
|
||||
)
|
||||
from homeassistant.components.home_connect.const import (
|
||||
BSH_CHILD_LOCK_STATE,
|
||||
BSH_OPERATION_STATE,
|
||||
@@ -27,6 +30,7 @@ from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from script.hassfest.translations import RE_TRANSLATION_KEY
|
||||
|
||||
from .conftest import (
|
||||
CLIENT_ID,
|
||||
@@ -372,3 +376,10 @@ async def test_entity_migration(
|
||||
domain, DOMAIN, f"{appliance.haId}-{expected_unique_id_suffix}"
|
||||
)
|
||||
assert config_entry_v1_1.minor_version == 2
|
||||
|
||||
|
||||
async def test_bsh_key_transformations() -> None:
|
||||
"""Test that the key transformations are compatible valid translations keys and can be reversed."""
|
||||
program = "Dishcare.Dishwasher.Program.Eco50"
|
||||
translation_key = bsh_key_to_translation_key(program)
|
||||
assert RE_TRANSLATION_KEY.match(translation_key)
|
||||
|
||||
Reference in New Issue
Block a user