1 """The Efergy integration."""
3 from __future__
import annotations
5 from pyefergy
import Efergy, exceptions
13 PLATFORMS = [Platform.SENSOR]
14 type EfergyConfigEntry = ConfigEntry[Efergy]
18 """Set up Efergy from a config entry."""
20 entry.data[CONF_API_KEY],
22 utc_offset=hass.config.time_zone,
23 currency=hass.config.currency,
27 await api.async_status(get_sids=
True)
28 except (exceptions.ConnectError, exceptions.DataError)
as ex:
30 except exceptions.InvalidAuth
as ex:
32 "API Key is no longer valid. Please reauthenticate"
35 entry.runtime_data = api
37 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
43 """Unload a config entry."""
44 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_setup_entry(HomeAssistant hass, EfergyConfigEntry entry)
bool async_unload_entry(HomeAssistant hass, EfergyConfigEntry entry)
aiohttp.ClientSession async_get_clientsession(HomeAssistant hass, bool verify_ssl=True, socket.AddressFamily family=socket.AF_UNSPEC, ssl_util.SSLCipherList ssl_cipher=ssl_util.SSLCipherList.PYTHON_DEFAULT)