Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The Aurora ABB Powerone PV inverter sensor integration."""
2 
3 # Reference info:
4 # https://s1.solacity.com/docs/PVI-3.0-3.6-4.2-OUTD-US%20Manual.pdf
5 # http://www.drhack.it/images/PDF/AuroraCommunicationProtocol_4_2.pdf
6 #
7 # Developer note:
8 # vscode devcontainer: use the following to access USB device:
9 # "runArgs": ["-e", "GIT_EDITOR=code --wait", "--device=/dev/ttyUSB0"],
10 # and add the following to the end of script/bootstrap:
11 # sudo chmod 777 /dev/ttyUSB0
12 
13 from homeassistant.const import CONF_ADDRESS, CONF_PORT, Platform
14 from homeassistant.core import HomeAssistant
15 
16 from .coordinator import AuroraAbbConfigEntry, AuroraAbbDataUpdateCoordinator
17 
18 PLATFORMS = [Platform.SENSOR]
19 
20 
21 async def async_setup_entry(hass: HomeAssistant, entry: AuroraAbbConfigEntry) -> bool:
22  """Set up Aurora ABB PowerOne from a config entry."""
23 
24  comport = entry.data[CONF_PORT]
25  address = entry.data[CONF_ADDRESS]
26  coordinator = AuroraAbbDataUpdateCoordinator(hass, comport, address)
27  await coordinator.async_config_entry_first_refresh()
28 
29  entry.runtime_data = coordinator
30  await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
31 
32  return True
33 
34 
35 async def async_unload_entry(hass: HomeAssistant, entry: AuroraAbbConfigEntry) -> bool:
36  """Unload a config entry."""
37 
38  return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_unload_entry(HomeAssistant hass, AuroraAbbConfigEntry entry)
Definition: __init__.py:35
bool async_setup_entry(HomeAssistant hass, AuroraAbbConfigEntry entry)
Definition: __init__.py:21