Skip to content

Commit

Permalink
- added manual VENT Fan options
Browse files Browse the repository at this point in the history
- added config/setup to add scheduler entities (OFF by default)
- seperated generated EntityDescriptions from "handcrafted"
  • Loading branch information
marq24 committed Feb 27, 2024
1 parent f91c729 commit 69ce95a
Show file tree
Hide file tree
Showing 13 changed files with 6,869 additions and 6,779 deletions.
6 changes: 5 additions & 1 deletion custom_components/waterkotte_heatpump/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
CONF_SERIAL,
CONF_SERIES,
CONF_SYSTEMTYPE,
CONF_ADD_SCHEDULE_ENTITIES,
CONF_USE_VENT,
CONF_USE_HEATING_CURVE,
CONF_USE_DISINFECTION,
Expand All @@ -45,6 +46,7 @@

from . import service as waterkotte_service
from custom_components.waterkotte_heatpump.pywaterkotte_ha import WaterkotteClient
from custom_components.waterkotte_heatpump.pywaterkotte_ha.const import ECOTOUCH
from custom_components.waterkotte_heatpump.pywaterkotte_ha.tags import WKHPTag
from custom_components.waterkotte_heatpump.pywaterkotte_ha.error import TooManyUsersException, InvalidPasswordException

Expand Down Expand Up @@ -158,6 +160,8 @@ class WKHPDataUpdateCoordinator(DataUpdateCoordinator):
def __init__(self, hass: HomeAssistant, config_entry):
self.name = config_entry.title
self._config_entry = config_entry
self.add_schedule_entities = config_entry.options.get(CONF_ADD_SCHEDULE_ENTITIES,
config_entry.data.get(CONF_ADD_SCHEDULE_ENTITIES, False))
self.available_features = []
if CONF_USE_VENT in config_entry.data and config_entry.data[CONF_USE_VENT]:
self.available_features.append(FEATURE_VENT)
Expand All @@ -170,7 +174,7 @@ def __init__(self, hass: HomeAssistant, config_entry):
_host = config_entry.options.get(CONF_HOST, config_entry.data.get(CONF_HOST))
# _user = config_entry.options.get(CONF_USERNAME, config_entry.data.get(CONF_USERNAME, "waterkotte"))
_pwd = config_entry.options.get(CONF_PASSWORD, config_entry.data.get(CONF_PASSWORD, "waterkotte"))
_system_type = config_entry.options.get(CONF_SYSTEMTYPE, config_entry.data.get(CONF_SYSTEMTYPE))
_system_type = config_entry.options.get(CONF_SYSTEMTYPE, config_entry.data.get(CONF_SYSTEMTYPE, ECOTOUCH))
_tags_num = config_entry.options.get(CONF_TAGS_PER_REQUEST, config_entry.data.get(CONF_TAGS_PER_REQUEST, 10))
_tags = generate_tag_list(hass=hass, config_entry_id=config_entry.entry_id)

Expand Down
5 changes: 5 additions & 0 deletions custom_components/waterkotte_heatpump/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from . import WKHPDataUpdateCoordinator, WKHPBaseEntity
from .const import DOMAIN, BINARY_SENSORS, ExtBinarySensorEntityDescription
from .const_gen import BINARY_SENSORS_GENERATED

_LOGGER = logging.getLogger(__name__)

Expand All @@ -17,6 +18,10 @@ async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry,
for description in BINARY_SENSORS:
entity = WKHPBinarySensor(coordinator, description)
entities.append(entity)
if coordinator.add_schedule_entities:
for description in BINARY_SENSORS_GENERATED:
entity = WKHPBinarySensor(coordinator, description)
entities.append(entity)
add_entity_cb(entities)


Expand Down
7 changes: 5 additions & 2 deletions custom_components/waterkotte_heatpump/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
CONF_SERIAL,
CONF_SERIES,
CONF_SYSTEMTYPE,
CONF_ADD_SCHEDULE_ENTITIES,
CONF_USE_DISINFECTION,
CONF_USE_HEATING_CURVE,
CONF_USE_VENT,
Expand Down Expand Up @@ -107,7 +108,8 @@ async def async_step_user(self, user_input=None):
# vol.Required(CONF_USERNAME, default=user_input.get(CONF_USERNAME)): str,
vol.Required(CONF_PASSWORD, default=user_input.get(CONF_PASSWORD)): str,
vol.Required(CONF_POLLING_INTERVAL, default=60): int,
vol.Required(CONF_TAGS_PER_REQUEST, default=75): int
vol.Required(CONF_TAGS_PER_REQUEST, default=75): int,
vol.Required(CONF_ADD_SCHEDULE_ENTITIES, default=False): bool,
}),
last_step=True,
errors=self._errors
Expand Down Expand Up @@ -194,7 +196,8 @@ async def async_step_user(self, user_input=None):
# vol.Required(CONF_USERNAME, default=self.options.get(CONF_USERNAME, "waterkotte")): str,
vol.Required(CONF_PASSWORD, default=self.options.get(CONF_PASSWORD, "waterkotte")): str,
vol.Required(CONF_POLLING_INTERVAL, default=self.options.get(CONF_POLLING_INTERVAL, 60)): int,
vol.Required(CONF_TAGS_PER_REQUEST, default=self.options.get(CONF_TAGS_PER_REQUEST, 75)): int
vol.Required(CONF_TAGS_PER_REQUEST, default=self.options.get(CONF_TAGS_PER_REQUEST, 75)): int,
vol.Required(CONF_ADD_SCHEDULE_ENTITIES, default=False): bool
}),
)

Expand Down
Loading

0 comments on commit 69ce95a

Please sign in to comment.