Add translations for shelly ble scanner options in option flow (#86218)

* Add translations for shelly ble scanner options

* Remove redundant labels

* isort
This commit is contained in:
Jan Bouwhuis 2023-01-24 12:25:35 +01:00 committed by GitHub
parent bf41a971a2
commit 66f12d7dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 9 deletions

View File

@ -21,11 +21,7 @@ from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResult from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.selector import ( from homeassistant.helpers.selector import SelectSelector, SelectSelectorConfig
SelectOptionDict,
SelectSelector,
SelectSelectorConfig,
)
from .const import ( from .const import (
BLE_MIN_VERSION, BLE_MIN_VERSION,
@ -53,9 +49,9 @@ HOST_SCHEMA: Final = vol.Schema({vol.Required(CONF_HOST): str})
BLE_SCANNER_OPTIONS = [ BLE_SCANNER_OPTIONS = [
SelectOptionDict(value=BLEScannerMode.DISABLED, label="Disabled"), BLEScannerMode.DISABLED,
SelectOptionDict(value=BLEScannerMode.ACTIVE, label="Active"), BLEScannerMode.ACTIVE,
SelectOptionDict(value=BLEScannerMode.PASSIVE, label="Passive"), BLEScannerMode.PASSIVE,
] ]
INTERNAL_WIFI_AP_IP = "192.168.33.1" INTERNAL_WIFI_AP_IP = "192.168.33.1"
@ -403,7 +399,10 @@ class OptionsFlowHandler(OptionsFlow):
CONF_BLE_SCANNER_MODE, BLEScannerMode.DISABLED CONF_BLE_SCANNER_MODE, BLEScannerMode.DISABLED
), ),
): SelectSelector( ): SelectSelector(
SelectSelectorConfig(options=BLE_SCANNER_OPTIONS), SelectSelectorConfig(
options=BLE_SCANNER_OPTIONS,
translation_key=CONF_BLE_SCANNER_MODE,
),
), ),
} }
), ),

View File

@ -71,5 +71,14 @@
"abort": { "abort": {
"ble_unsupported": "Bluetooth support requires firmware version {ble_min_version} or newer." "ble_unsupported": "Bluetooth support requires firmware version {ble_min_version} or newer."
} }
},
"selector": {
"ble_scanner_mode": {
"options": {
"disabled": "Disabled",
"active": "Active",
"passive": "Passive"
}
}
} }
} }

View File

@ -71,5 +71,14 @@
"description": "Bluetooth scanning can be active or passive. With active, the Shelly requests data from nearby devices; with passive, the Shelly receives unsolicited data from nearby devices." "description": "Bluetooth scanning can be active or passive. With active, the Shelly requests data from nearby devices; with passive, the Shelly receives unsolicited data from nearby devices."
} }
} }
},
"selector": {
"ble_scanner_mode": {
"options": {
"disabled": "Disabled",
"active": "Active",
"passive": "Passive"
}
}
} }
} }