renamed domain

This commit is contained in:
Patrick762 committed 2023-07-29 20:32:14 +02:00
1 parent 1c29ffe7a2
commit 27f79acd00
5 files changed
+12 -7

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
*/__pycache__/
*.pyc
@@ -16,9 +16,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Bluetti Powerstation from a config entry.""" """Set up Bluetti Powerstation from a config entry."""
address = entry.data.get(CONF_ADDRESS) address = entry.data.get(CONF_ADDRESS)
if address is None: if address is None:
return False return False
_LOGGER.error(f"Device address: {address}") _LOGGER.error("Device address: %s", address)
return True return True
@@ -7,7 +7,7 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.components import ( from homeassistant.components.bluetooth import (
BluetoothServiceInfoBleak, BluetoothServiceInfoBleak,
async_discovered_service_info, async_discovered_service_info,
) )
@@ -21,7 +21,7 @@ _LOGGER = logging.getLogger(__name__)
class BluettiConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class BluettiConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle config flow for Bluetti BT devices.""" """Handle config flow for Bluetti BT devices."""
def __init__(self) -> None: def __init__(self) -> None:
_LOGGER.info("Initialize config flow") _LOGGER.info("Initialize config flow")
self._discovery_info: BluetoothServiceInfoBleak | None = None self._discovery_info: BluetoothServiceInfoBleak | None = None
@@ -34,11 +34,14 @@ class BluettiConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
await self.async_set_unique_id(discovery_info.address) await self.async_set_unique_id(discovery_info.address)
self._abort_if_unique_id_configured() self._abort_if_unique_id_configured()
self._discovery_info = discovery_info self._discovery_info = discovery_info
self.context["title_placeholders"] = {
"name": discovery_info.name
}
return await self.async_step_user() return await self.async_step_user()
async def async_step_user(self, user_input: dict[str, Any] | None = None) -> FlowResult: async def async_step_user(self, user_input: dict[str, Any] | None = None) -> FlowResult:
"""Handle user input.""" """Handle user input."""
if user_input is not None: if user_input is not None:
address = user_input[CONF_ADDRESS] address = user_input[CONF_ADDRESS]
discovery_info = self._discovered_devices[address] discovery_info = self._discovered_devices[address]
@@ -1,3 +1,3 @@
"""Constants for the Bluetti BT integration.""" """Constants for the Bluetti BT integration."""
DOMAIN = "bluetti-bt" DOMAIN = "bluetti_bt"
@@ -1,5 +1,5 @@
{ {
"domain": "bluetti-bt", "domain": "bluetti_bt",
"name": "Bluetti BT", "name": "Bluetti BT",
"codeowners": ["@Patrick762"], "codeowners": ["@Patrick762"],
"config_flow": true, "config_flow": true,