Skip to content

Commit

Permalink
Merge pull request #82 from uvjim/selector-translations
Browse files Browse the repository at this point in the history
  • Loading branch information
uvjim authored Apr 6, 2023
2 parents 4ea5ae4 + 6e13788 commit 9973b49
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
18 changes: 16 additions & 2 deletions custom_components/hdhomerun/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@
from homeassistant.components import ssdp
from homeassistant.const import CONF_SCAN_INTERVAL
from homeassistant.core import callback
from homeassistant.helpers import selector
from homeassistant.helpers.aiohttp_client import async_get_clientsession

from .const import (
CONF_HOST,
CONF_SCAN_INTERVAL_TUNER_STATUS,
CONF_TUNER_CHANNEL_AVAILABLE_FORMATS,
CONF_TUNER_CHANNEL_ENTITY_PICTURE_PATH,
CONF_TUNER_CHANNEL_FORMAT,
CONF_TUNER_CHANNEL_NAME,
CONF_TUNER_CHANNEL_NUMBER,
CONF_TUNER_CHANNEL_NUMBER_NAME,
DEF_SCAN_INTERVAL_SECS,
DEF_SCAN_INTERVAL_TUNER_STATUS_SECS,
DEF_TUNER_CHANNEL_ENTITY_PICTURE_PATH,
Expand Down Expand Up @@ -80,7 +83,18 @@ async def _async_build_schema_with_user_input(step: str, user_input=None) -> vol
default=user_input.get(
CONF_TUNER_CHANNEL_FORMAT, DEF_TUNER_CHANNEL_FORMAT
),
): vol.In(CONF_TUNER_CHANNEL_AVAILABLE_FORMATS),
): selector.SelectSelector(
config=selector.SelectSelectorConfig(
mode=selector.SelectSelectorMode.DROPDOWN,
multiple=False,
options=[
CONF_TUNER_CHANNEL_NAME,
CONF_TUNER_CHANNEL_NUMBER,
CONF_TUNER_CHANNEL_NUMBER_NAME,
],
translation_key="channel_format",
),
),
}

if step == STEP_SELECT_DEVICE:
Expand Down
7 changes: 0 additions & 7 deletions custom_components/hdhomerun/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,12 @@
CONF_TUNER_CHANNEL_NUMBER_NAME: str = "channel_number_name"
CONF_TUNER_CHANNEL_NUMBER: str = "channel_number"

CONF_TUNER_CHANNEL_AVAILABLE_FORMATS: dict = {
CONF_TUNER_CHANNEL_NAME: "Channel name, e.g. BBC One HD",
CONF_TUNER_CHANNEL_NUMBER: "Channel number, e.g. 101",
CONF_TUNER_CHANNEL_NUMBER_NAME: "Channel number and name, e.g. 101: BBC One HD",
}

DEF_DISCOVERY_MODE: DiscoverMode = DiscoverMode.AUTO
DEF_SCAN_INTERVAL_SECS: int = 300
DEF_SCAN_INTERVAL_TUNER_STATUS_SECS: int = 10
DEF_TUNER_CHANNEL_ENTITY_PICTURE_PATH: str = ""
DEF_TUNER_CHANNEL_FORMAT: str = CONF_TUNER_CHANNEL_NAME


PLATFORMS = [
BINARY_SENSOR_DOMAIN,
BUTTON_DOMAIN,
Expand Down
11 changes: 10 additions & 1 deletion custom_components/hdhomerun/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"options": {
"data": {
"channel_entity_picture_path": "Channel logo path",
"channel_format":"Pick the format you'd like the channel to be displayed in"
"channel_format": "Pick the format you'd like the channel to be displayed in"
},
"title": "Options"
},
Expand All @@ -46,5 +46,14 @@
"title": "Timeouts"
}
}
},
"selector": {
"channel_format": {
"options": {
"channel_name": "Channel name, e.g. BBC One HD",
"channel_number": "Channel number, e.g. 101",
"channel_number_name": "Channel number and name, e.g. 101: BBC One HD"
}
}
}
}
4 changes: 2 additions & 2 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"domains": "hdhomerun",
"homeassistant": "2022.2.0",
"homeassistant": "2023.2.0",
"name": "HDHomeRun",
"render_readme": true
}
}

0 comments on commit 9973b49

Please sign in to comment.