start of integration

This commit is contained in:
Vincent BENOIT
2023-10-23 14:11:59 +00:00
parent 0c1e92f5a6
commit d26324306e
5 changed files with 149 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
"""The koolnova BMS modbus integration.""" # pylint: disable=invalid-name
import logging
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_NAME, CONF_DEVICE_ID
from .const import DOMAIN
#from .wfrac.device import Device
_LOGGER = logging.getLogger(__name__)
COMPONENT_TYPES = ["sensor", "climate", "select"]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
""" Set up koolnova from a config entry. """
_LOGGER.info('async_setup_entry')
# if DOMAIN not in hass.data:
# hass.data[DOMAIN] = []
#
# device: str = entry.data[CONF_HOST]
# name: str = entry.data[CONF_NAME]
# device_id: str = entry.data[CONF_DEVICE_ID]
# operator_id: str = entry.data[CONF_OPERATOR_ID]
# port: int = entry.data[CONF_PORT]
# airco_id: str = entry.data[CONF_AIRCO_ID]
# try:
# api = Device(hass, name, device, port, device_id, operator_id, airco_id)
# await api.update() # initial update to get fresh values
# hass.data[DOMAIN].append(api)
# except Exception as ex: # pylint: disable=broad-except
# _LOGGER.warning("Something whent wrong setting up device [%s] %s", device, ex)
#
# for component in COMPONENT_TYPES:
# hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, component))
#
# return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Handle removal of an entry."""
_LOGGER.info('async_unload_entry')
# if unloaded := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
# hass.data[DOMAIN].pop(entry.entry_id)
# return unloaded
async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Reload config entry."""
_LOGGER.info('async_reload_entry')
# await async_unload_entry(hass, entry)
# await async_setup_entry(hass, entry)
async def async_remove_entry(hass, entry: ConfigEntry) -> None:
"""Handle removal of an entry."""
_LOGGER.info('async_remove_entry')
# for device in hass.data[DOMAIN]:
# temp_device: Device = device
# if temp_device.host == entry.data[CONF_HOST]:
# try:
# await temp_device.delete_account()
# _LOGGER.info(
# "Deleted operator ID [%s] from airco [%s]",
# temp_device.operator_id,
# temp_device.airco_id,
# )
# hass.data[DOMAIN].remove(temp_device)
# except Exception as ex: # pylint: disable=broad-except
# _LOGGER.warning(
# "Something whent wrong deleting account from airco [%s] %s",
# temp_device.name,
# ex,
# )

View File

@@ -0,0 +1,55 @@
"""Constants used by the koolnova-bms component."""
DOMAIN = "koolnova_bms"
NUM_ZONES = 16
REG_PER_ZONE = 4
REG_ENABLED = 1
REG_MODE = 2
REG_TARGET_TEMP = 3
REG_CURRENT_TEMP = 4
REG_AIRFLOW = 65
REG_AC_TARGET_TEMP = 69
REG_AC_TARGET_FAN_MODE = 73
REG_SERIAL_CONFIG = 77
REG_SLAVE_ID = 78
REG_EFFICIENCY = 79
REG_SYSTEM_ENABLED = 81
REG_SYS_KN_MODE = 82
FIRST_ZONE_REGISTER = REG_ENABLED
TOTAL_ZONE_REGISTERS = NUM_ZONES * REG_PER_ZONE
FIRST_SYS_REGISTER = REG_AIRFLOW
TOTAL_SYS_REGISTERS = 18
FAN_OFF = 0
FAN_LOW = 1
FAN_MED = 2
FAN_HIGH = 3
FAN_AUTO = 4
MODE_AIR_COOLING = 0x01
MODE_AIR_HEATING = 0x02
MODE_UNDERFLOOR_HEATING = 0x04
MODE_UNDERFLOOR_AIR_COOLING = 0x05
MODE_UNDERFLOOR_AIR_HEATING = 0x06
HOLD_MODE_UNDERFLOOR_ONLY = "underfloor"
HOLD_MODE_FAN_ONLY = "fan"
HOLD_MODE_UNDERFLOOR_AND_FAN = "underfloor and fan"
HVAC_MODE_OFF = "off"
HVAC_MODE_COOL = "cool"
HVAC_MODE_HEAT = "heat"
ACMACHINES = 4
AC1 = 1
AC2 = 2
AC3 = 3
AC4 = 4
HA_COMPONENT_SENSOR = "sensor"
HA_COMPONENT_CLIMATE = "climate"

View File

@@ -0,0 +1,13 @@
{
"domain": "koolnova_bms",
"name": "koolnova BMS Modbus",
"codeowners": ["@sinseman44"],
"config_flow": true,
"documentation": "https://git.nas.benserv.fr/vincent/koolnova-BMS-Integration/src/branch/main/README.md",
"iot_class": "local_polling",
"issue_tracker": "https://git.nas.benserv.fr/vincent/koolnova-BMS-Integration/issues",
"requirements": [
"pymodbus>=3.5.0"
],
"version": "0.1.0"
}

View File

5
hacs.json Normal file
View File

@@ -0,0 +1,5 @@
{
"name": "koolnova BMS RS485 Modbus",
"homeassistant": "2023.10.5",
"render_readme": true
}