Clean up vicare code (#65774)

* Clean up vicare code

Remove constants that were only used once
Remove _build_entity and use constructor directly

* Fix copy/paste issue
This commit is contained in:
Hans Oischinger 2022-02-05 14:26:44 +01:00 committed by GitHub
parent 9f8c0685e3
commit 99fd16d675
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 91 deletions

View file

@ -95,12 +95,6 @@ HA_TO_VICARE_PRESET_HEATING = {
}
def _build_entity(name, vicare_api, circuit, device_config, heating_type):
"""Create a ViCare climate entity."""
_LOGGER.debug("Found device %s", name)
return ViCareClimate(name, vicare_api, device_config, circuit, heating_type)
def _get_circuits(vicare_api):
"""Return the list of circuits."""
try:
@ -126,11 +120,11 @@ async def async_setup_entry(
if len(circuits) > 1:
suffix = f" {circuit.id}"
entity = _build_entity(
entity = ViCareClimate(
f"{name} Heating{suffix}",
api,
hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG],
circuit,
hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG],
config_entry.data[CONF_HEATING_TYPE],
)
entities.append(entity)