diff --git a/.gitignore b/.gitignore index e1699b0..86809b7 100644 --- a/.gitignore +++ b/.gitignore @@ -128,5 +128,5 @@ dmypy.json # Pyre type checker .pyre/ -# vscode +# vscode .vscode/ diff --git a/custom_components/solarman/__init__.py b/custom_components/solarman/__init__.py index 05ecac5..6becef5 100644 --- a/custom_components/solarman/__init__.py +++ b/custom_components/solarman/__init__.py @@ -2,9 +2,9 @@ import logging -from homeassistant.core import HomeAssistant from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_NAME +from homeassistant.core import HomeAssistant from .const import * @@ -12,9 +12,10 @@ PLATFORMS: list[str] = ["sensor"] + async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Solarman Collector from a config entry.""" - _LOGGER.debug(f'__init__.py:async_setup_entry({entry.as_dict()})') + _LOGGER.debug(f"__init__.py:async_setup_entry({entry.as_dict()})") await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) entry.async_on_unload(entry.add_update_listener(update_listener)) return True @@ -22,7 +23,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" - _LOGGER.debug(f'__init__.py:async_unload_entry({entry.as_dict()})') + _LOGGER.debug(f"__init__.py:async_unload_entry({entry.as_dict()})") unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: hass.data[DOMAIN].pop(entry.entry_id) @@ -31,6 +32,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None: """Handle options update.""" - _LOGGER.debug(f'__init__.py:update_listener({entry.as_dict()})') + _LOGGER.debug(f"__init__.py:update_listener({entry.as_dict()})") hass.data[DOMAIN][entry.entry_id].config(entry) entry.title = entry.options[CONF_NAME] diff --git a/custom_components/solarman/config_flow.py b/custom_components/solarman/config_flow.py index 4beb74e..4c3eb5f 100644 --- a/custom_components/solarman/config_flow.py +++ b/custom_components/solarman/config_flow.py @@ -2,27 +2,34 @@ from __future__ import annotations import logging +from socket import gaierror, getaddrinfo, herror, timeout from typing import Any -from socket import getaddrinfo, herror, gaierror, timeout +import homeassistant.helpers.config_validation as cv import voluptuous as vol -from voluptuous.schema_builder import Schema - from homeassistant import config_entries +from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.const import (CONF_NAME, CONF_SCAN_INTERVAL, + EVENT_HOMEASSISTANT_STOP) from homeassistant.core import HomeAssistant, callback from homeassistant.data_entry_flow import FlowResult from homeassistant.exceptions import HomeAssistantError +from voluptuous.schema_builder import Schema -from homeassistant.const import (EVENT_HOMEASSISTANT_STOP, CONF_NAME, CONF_SCAN_INTERVAL) -import homeassistant.helpers.config_validation as cv -from homeassistant.components.sensor import PLATFORM_SCHEMA from .const import * _LOGGER = logging.getLogger(__name__) -def step_user_data_schema(data: dict[str, Any] = {CONF_NAME: SENSOR_PREFIX, CONF_INVERTER_PORT: DEFAULT_PORT_INVERTER, CONF_INVERTER_MB_SLAVEID: DEFAULT_INVERTER_MB_SLAVEID, CONF_LOOKUP_FILE: DEFAULT_LOOKUP_FILE}) -> Schema: - _LOGGER.debug(f'config_flow.py:step_user_data_schema: {data}') +def step_user_data_schema( + data: dict[str, Any] = { + CONF_NAME: SENSOR_PREFIX, + CONF_INVERTER_PORT: DEFAULT_PORT_INVERTER, + CONF_INVERTER_MB_SLAVEID: DEFAULT_INVERTER_MB_SLAVEID, + CONF_LOOKUP_FILE: DEFAULT_LOOKUP_FILE, + } +) -> Schema: + _LOGGER.debug(f"config_flow.py:step_user_data_schema: {data}") STEP_USER_DATA_SCHEMA = vol.Schema( { vol.Required(CONF_NAME, default=data.get(CONF_NAME)): str, @@ -32,10 +39,9 @@ def step_user_data_schema(data: dict[str, Any] = {CONF_NAME: SENSOR_PREFIX, CONF vol.Optional(CONF_INVERTER_MB_SLAVEID, default=data.get(CONF_INVERTER_MB_SLAVEID)): int, vol.Optional(CONF_LOOKUP_FILE, default=data.get(CONF_LOOKUP_FILE)): vol.In(LOOKUP_FILES), }, - extra=vol.PREVENT_EXTRA + extra=vol.PREVENT_EXTRA, ) - _LOGGER.debug( - f'config_flow.py:step_user_data_schema: STEP_USER_DATA_SCHEMA: {STEP_USER_DATA_SCHEMA}') + _LOGGER.debug(f"config_flow.py:step_user_data_schema: STEP_USER_DATA_SCHEMA: {STEP_USER_DATA_SCHEMA}") return STEP_USER_DATA_SCHEMA @@ -46,12 +52,10 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str, Data has the keys from STEP_USER_DATA_SCHEMA with values provided by the user. """ - _LOGGER.debug(f'config_flow.py:validate_input: {data}') + _LOGGER.debug(f"config_flow.py:validate_input: {data}") try: - getaddrinfo( - data[CONF_INVERTER_HOST], data[CONF_INVERTER_PORT], family=0, type=0, proto=0, flags=0 - ) + getaddrinfo(data[CONF_INVERTER_HOST], data[CONF_INVERTER_PORT], family=0, type=0, proto=0, flags=0) except herror: raise InvalidHost except gaierror: @@ -71,18 +75,14 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @callback def async_get_options_flow(entry: config_entries.ConfigEntry) -> OptionsFlow: """Get the options flow for this handler.""" - _LOGGER.debug(f'config_flow.py:ConfigFlow.async_get_options_flow: {entry}') + _LOGGER.debug(f"config_flow.py:ConfigFlow.async_get_options_flow: {entry}") return OptionsFlow(entry) - async def async_step_user( - self, user_input: dict[str, Any] | None = None - ) -> FlowResult: - _LOGGER.debug(f'config_flow.py:ConfigFlow.async_step_user: {user_input}') + async def async_step_user(self, user_input: dict[str, Any] | None = None) -> FlowResult: + _LOGGER.debug(f"config_flow.py:ConfigFlow.async_step_user: {user_input}") """Handle the initial step.""" if user_input is None: - return self.async_show_form( - step_id="user", data_schema=step_user_data_schema() - ) + return self.async_show_form(step_id="user", data_schema=step_user_data_schema()) errors = {} @@ -96,14 +96,12 @@ async def async_step_user( _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: - _LOGGER.debug(f'config_flow.py:ConfigFlow.async_step_user: validation passed: {user_input}') + _LOGGER.debug(f"config_flow.py:ConfigFlow.async_step_user: validation passed: {user_input}") # await self.async_set_unique_id(user_input.device_id) # not sure this is permitted as the user can change the device_id # self._abort_if_unique_id_configured() - return self.async_create_entry( - title=info["title"], data=user_input, options=user_input - ) + return self.async_create_entry(title=info["title"], data=user_input, options=user_input) - _LOGGER.debug(f'config_flow.py:ConfigFlow.async_step_user: validation failed: {user_input}') + _LOGGER.debug(f"config_flow.py:ConfigFlow.async_step_user: validation failed: {user_input}") return self.async_show_form( step_id="user", @@ -117,14 +115,12 @@ class OptionsFlow(config_entries.OptionsFlow): def __init__(self, entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" - _LOGGER.debug(f'config_flow.py:OptionsFlow.__init__: {entry}') + _LOGGER.debug(f"config_flow.py:OptionsFlow.__init__: {entry}") self.entry = entry - async def async_step_init( - self, user_input: dict[str, Any] | None = None - ) -> FlowResult: + async def async_step_init(self, user_input: dict[str, Any] | None = None) -> FlowResult: """Manage the options.""" - _LOGGER.debug(f'config_flow.py:OptionsFlow.async_step_init: {user_input}') + _LOGGER.debug(f"config_flow.py:OptionsFlow.async_step_init: {user_input}") if user_input is None: return self.async_show_form( step_id="init", diff --git a/custom_components/solarman/const.py b/custom_components/solarman/const.py index 59c4908..4fd9753 100644 --- a/custom_components/solarman/const.py +++ b/custom_components/solarman/const.py @@ -1,31 +1,19 @@ from datetime import timedelta -DOMAIN = 'solarman' +DOMAIN = "solarman" DEFAULT_PORT_INVERTER = 8899 DEFAULT_INVERTER_MB_SLAVEID = 1 -DEFAULT_LOOKUP_FILE = 'deye_hybrid.yaml' -LOOKUP_FILES = [ - 'deye_4mppt.yaml', - 'deye_hybrid.yaml', - 'deye_sg04lp3.yaml', - 'deye_string.yaml', - 'sofar_lsw3.yaml', - 'sofar_wifikit.yaml', - 'solis_hybrid.yaml', - 'solis_1p8k-5g.yaml', - 'sofar_g3hyd.yaml', - 'sofar_hyd3k-6k-es.yaml', - 'zcs_azzurro-ktl-v3.yaml', - 'custom_parameters.yaml' -] +DEFAULT_LOOKUP_FILE = "deye_hybrid.yaml" -MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30) +LOOKUP_FILES = os.listdir(os.path.dirname(__file__) + "/inverter_definitions") -CONF_INVERTER_HOST = 'inverter_host' -CONF_INVERTER_PORT = 'inverter_port' -CONF_INVERTER_SERIAL = 'inverter_serial' -CONF_INVERTER_MB_SLAVEID = 'inverter_mb_slaveid' -CONF_LOOKUP_FILE = 'lookup_file' +MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=15) -SENSOR_PREFIX = 'Solarman' +CONF_INVERTER_HOST = "inverter_host" +CONF_INVERTER_PORT = "inverter_port" +CONF_INVERTER_SERIAL = "inverter_serial" +CONF_INVERTER_MB_SLAVEID = "inverter_mb_slaveid" +CONF_LOOKUP_FILE = "lookup_file" + +SENSOR_PREFIX = "Solarman" diff --git a/custom_components/solarman/inverter_definitions/Afore_BNTxxxKTL-2mppt.yaml b/custom_components/solarman/inverter_definitions/Afore_BNTxxxKTL-2mppt.yaml new file mode 100644 index 0000000..9fd7f33 --- /dev/null +++ b/custom_components/solarman/inverter_definitions/Afore_BNTxxxKTL-2mppt.yaml @@ -0,0 +1,170 @@ +# to use modbus function in Afore BNTxxxKTL inverters, You first need to change protocol from RS485 to MODBUS in inverter menu + +requests: + - start: 0x0000 + end: 0x001A + mb_functioncode: 0x04 + + - start: 0x0000 + end: 0x000F + mb_functioncode: 0x03 + +parameters: + - group: solar + items: + - name: "PV1 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x0007] + icon: "mdi:solar-power" + + - name: "PV2 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x0009] + icon: "mdi:solar-power" + + - name: "PV1 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 1 + registers: [0x0008] + icon: "mdi:solar-power" + + - name: "PV2 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 1 + registers: [0x000A] + icon: "mdi:solar-power" + + - name: "Daily Production Wh" + class: "energy" + state_class: "total" + uom: "Wh" + scale: 1 + rule: 1 + registers: [0x000F] + icon: "mdi:solar-power" + + - name: "Total Production Wh" + class: "energy" + state_class: "total_increasing" + uom: "Wh" + scale: 1 + rule: 3 + registers: [0x0015, 0x0014] + icon: "mdi:solar-power" + + - name: "Today generation time " + class: "" + state_class: "measurement" + uom: "s" + scale: 1 + rule: 1 + registers: [0x0013] + icon: "mdi:clock-outline" + + - group: Output + items: + - name: "Output active power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 1 + registers: [0x0011] + icon: "mdi:home-lightning-bolt" + + - name: "Grid frequency" + class: "frequency" + state_class: "measurement" + uom: "Hz" + scale: 0.1 + rule: 1 + registers: [0x000B] + icon: "mdi:home-lightning-bolt" + + - name: "L1 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x0001] + icon: "mdi:home-lightning-bolt" + + - name: "L1 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 1 + registers: [0x0004] + icon: "mdi:home-lightning-bolt" + + - name: "L2 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x0002] + icon: "mdi:home-lightning-bolt" + + - name: "L2 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 1 + registers: [0x0005] + icon: "mdi:home-lightning-bolt" + + - name: "L3 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x0003] + icon: "mdi:home-lightning-bolt" + + - name: "L3 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 1 + registers: [0x0006] + icon: "mdi:home-lightning-bolt" + + - group: Inverter + items: + - name: "Inverter module temperature" + class: "temperature" + uom: "°C" + scale: 0.1 + rule: 1 + registers: [0x000C] + icon: "mdi:thermometer" + + - name: "Inverter inner temperature" + class: "temperature" + state_class: "measurement" + uom: "°C" + scale: 0.1 + rule: 1 + + registers: [0x000D] + icon: "mdi:thermometer" diff --git a/custom_components/solarman/inverter_definitions/deye_2mppt.yaml b/custom_components/solarman/inverter_definitions/deye_2mppt.yaml new file mode 100644 index 0000000..5f872ec --- /dev/null +++ b/custom_components/solarman/inverter_definitions/deye_2mppt.yaml @@ -0,0 +1,394 @@ +# First version: 22.02.2023 +# Latest update: 08.09.2023 +# Microinverter SUN600G3 (DEYE/VESDAS) +# 2x MPPT, 2x inverter +# 1x Logger, 2x Module, + +requests: + - start: 0x0001 + end: 0x007D + mb_functioncode: 0x03 + +parameters: + - group: solar + items: + - name: "PV1 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x006D] + icon: 'mdi:solar-power' + + - name: "PV2 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x006F] + icon: 'mdi:solar-power' + + - name: "PV1 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [0x006E] + icon: 'mdi:solar-power' + + - name: "PV2 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [0x0070] + icon: 'mdi:solar-power' + + - name: "Daily Production" + class: "energy" + state_class: "total" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [0x003C] + icon: 'mdi:solar-power' + + - name: "Daily Production 1" + class: "energy" + state_class: "total" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [0x0041] + icon: 'mdi:solar-power' + + - name: "Daily Production 2" + class: "energy" + state_class: "total" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [0x0042] + icon: 'mdi:solar-power' + + - name: "Total Production" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 3 + registers: [0x003F,0x0040] + icon: 'mdi:solar-power' + validation: + min: 0.1 + + - name: "Total Production 1" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 3 + registers: [0x0045] + icon: 'mdi:solar-power' + + - name: "Total Production 2" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 3 + registers: [0x0047] + icon: 'mdi:solar-power' + + - name: "Active Power Regulations" + class: "" + state_class: "" + uom: "%" + scale: 1 + rule: 1 + registers: [0x0028] + icon: 'mdi:solar-power' + + - group: Grid + items: + - name: "AC Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x0049] + icon: 'mdi:transmission-tower' + + - name: "Grid Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 2 + registers: [0x004C] + icon: 'mdi:home-lightning-bolt' + + - name: "AC Output Frequency" + class: "frequency" + state_class: "measurement" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [0x004F] + icon: 'mdi:home-lightning-bolt' + + - name: "Grid Voltage Upp Limit" + class: "voltage" + state_class: "" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x001B] + icon: 'mdi:transmission-tower' + + - name: "Grid Voltage Lower Limit" + class: "voltage" + state_class: "" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x001C] + icon: 'mdi:transmission-tower' + + - name: "Grid Frequency Upper Limit" + class: "frequency" + state_class: "" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [0x001D] + icon: 'mdi:home-lightning-bolt' + + - name: "Grid Frequency Lower Limit" + class: "frequency" + state_class: "" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [0x001E] + icon: 'mdi:home-lightning-bolt' + + - name: "Overfrequency And Load Reduction Starting Point" + class: "frequency" + state_class: "" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [0x0022] + icon: 'mdi:home-lightning-bolt' + + - name: "Overfrequency And Load Reduction Percentage" + class: "" + state_class: "" + uom: "%" + scale: 1 + rule: 1 + registers: [0x0023] + icon: '' + + - name: "ON-OFF Enable" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x002B] + isstr: true + lookup: + - key: 0 + value: "OFF" + - key: 1 + value: "ON" + icon: 'mdi:toggle-switch' + + - name: "Island Protection Enable" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x002E] + isstr: true + lookup: + - key: 0 + value: "Disabled" + - key: 1 + value: "Enabled" + icon: 'mdi:island' + + - name: "Overfrequency&Load-shedding Enable" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0031] + isstr: true + lookup: + - key: 0 + value: "Disabled" + - key: 1 + value: "Enabled" + icon: 'mdi:toggle-switch' + + - group: Inverter + items: + - name: "Running Status" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x003B] + isstr: true + lookup: + - key: 0 + value: "Stand-by" + - key: 1 + value: "Self-check" + - key: 2 + value: "Normal" + - key: 3 + value: "Warning" + - key: 4 + value: "Fault" + icon: 'mdi:home-lightning-bolt' + + - name: "Total AC Output Power (Active)" + class: "power" + state_class: "measurement" + uom: "W" + scale: 0.1 + rule: 3 + registers: [0x0056, 0x0057] + icon: 'mdi:home-lightning-bolt' + + - name: "Radiator Temperature" + class: "temperature" + uom: "°C" + state_class: "measurement" + scale: 0.01 + rule: 1 + offset: 1000 + registers: [0x005a] + + - name: "Inverter ID" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 5 + registers: [0x0003,0x0004,0x0005,0x0006,0x0007] + isstr: true + + - name: "Hardware Version" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000C] + isstr: true + + - name: "DC Master Firmware Version" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000D] + isstr: true + + - name: "AC Version. Number" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000E] + isstr: true + + - name: "Rated Power" + class: "energy" + state_class: "" + uom: "W" + scale: 0.1 + rule: 1 + registers: [0x0010] + icon: 'mdi:solar-power' + + - name: "Communication Protocol Version" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x0012] + isstr: true + + - name: "Start-up Self-checking Time " + class: "" + state_class: "" + uom: "s" + scale: 1 + rule: 1 + registers: [0x0015] + icon: 'mdi:solar-power' + + - name: "Update Time" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 8 + registers: [0x0016,0x0017,0x0018] + isstr: true + + - name: "Soft Start Enable" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x002F] + isstr: true + lookup: + - key: 0 + value: "Disabled" + - key: 1 + value: "Enabled" + icon: 'mdi:toggle-switch' + + - name: "Power Factor Regulation" + class: "" + state_class: "" + uom: "" + scale: 0.1 + rule: 2 + registers: [0x0032] + icon: '' + + - name: "Restore Factory Settings" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0036] + isstr: true + lookup: + - key: 0 + value: "Disabled" + - key: 1 + value: "Enabled" + icon: 'mdi:factory' diff --git a/custom_components/solarman/inverter_definitions/deye_4mppt.yaml b/custom_components/solarman/inverter_definitions/deye_4mppt.yaml index f0c2e56..977a20e 100644 --- a/custom_components/solarman/inverter_definitions/deye_4mppt.yaml +++ b/custom_components/solarman/inverter_definitions/deye_4mppt.yaml @@ -1,16 +1,17 @@ -# First version : 8.5.2022 +# First version: 08.05.2022 +# Latest update: 08.09.2023 # Microinverter SUN2000G3 (DEYE/VESDAS) # 4x MPPT, 4x inverter -# 1x Logger, 4x Module, +# 1x Logger, 4x Module, requests: - - start: 0x0003 - end: 0x0080 + - start: 0x0001 + end: 0x007D mb_functioncode: 0x03 parameters: - group: solar - items: + items: - name: "PV1 Voltage" class: "voltage" state_class: "measurement" @@ -49,6 +50,7 @@ parameters: - name: "PV1 Current" class: "current" + state_class: "measurement" uom: "A" scale: 0.1 rule: 1 @@ -66,6 +68,7 @@ parameters: - name: "PV3 Current" class: "current" + state_class: "measurement" uom: "A" scale: 0.1 rule: 1 @@ -74,6 +77,7 @@ parameters: - name: "PV4 Current" class: "current" + state_class: "measurement" uom: "A" scale: 0.1 rule: 1 @@ -101,11 +105,18 @@ parameters: min: 0.1 invalidate_all: - + - name: "Active Power Regulations" + class: "" + state_class: "" + uom: "%" + scale: 1 + rule: 1 + registers: [0x0028] + icon: 'mdi:solar-power' - group: Grid - items: - - name: "AC Voltage 1" + items: + - name: "AC Voltage" class: "voltage" state_class: "measurement" uom: "V" @@ -114,135 +125,47 @@ parameters: registers: [0x0049] icon: 'mdi:transmission-tower' -# - name: "Grid Voltage L-L(A)" -# class: "voltage" -# state_class: "measurement" -# uom: "V" -# scale: 0.1 -# rule: 1 -# registers: [0x0049] -# icon: 'mdi:transmission-tower' - -# - name: "Grid Voltage L-L(B))" -# class: "voltage" -# state_class: "measurement" -# uom: "V" -# scale: 0.1 -# rule: 1 -# registers: [0x004A] -# icon: 'mdi:transmission-tower' - -# - name: "Grid Voltage L-L(C)" -# class: "voltage" -# state_class: "measurement" -# uom: "V" -# scale: 0.1 -# rule: 1 -# registers: [0x004B] -# icon: 'mdi:transmission-tower' - -# - name: "Grid Current A" -# class: "current" -# state_class: "measurement" -# uom: "A" -# scale: 0.1 -# rule: 2 -# registers: [0x004C] -# icon: 'mdi:home-lightning-bolt' - -# - name: "Grid Current B" -# class: "current" -# state_class: "measurement" -# uom: "A" -# scale: 0.1 -# rule: 2 -# registers: [0x004D] -# icon: 'mdi:home-lightning-bolt' - -# - name: "Grid Current C" -# class: "current" -# state_class: "measurement" -# uom: "A" -# scale: 0.1 -# rule: 2 -# registers: [0x004E] -# icon: 'mdi:home-lightning-bolt' + - name: "Grid Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 2 + registers: [0x004C] + icon: 'mdi:home-lightning-bolt' - - name: "AC Output Frequency 1" + - name: "AC Output Frequency" class: "frequency" - state_class: "measurement" + state_class: "measurement" uom: "Hz" scale: 0.01 rule: 1 registers: [0x004F] icon: 'mdi:home-lightning-bolt' -# - name: "Grid Frequency" -# class: "frequency" -# state_class: "measurement" -# uom: "Hz" -# scale: 0.01 -# rule: 1 -# registers: [0x004F] -# icon: 'mdi:home-lightning-bolt' - - group: Inverter - items: + items: - name: "Running Status" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x003B] isstr: true - lookup: + lookup: - key: 0 value: "Stand-by" - key: 1 - value: "Self-checking" + value: "Self-check" - key: 2 value: "Normal" - key: 3 - value: "FAULT" + value: "Warning" + - key: 4 + value: "Fault" icon: 'mdi:home-lightning-bolt' -# - name: "Total Ouput AC Power" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 0.1 -# rule: 3 -# registers: [0x0050,0x0051] -# icon: 'mdi:home-lightning-bolt' - -# - name: "Input Active Power" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 0.1 -# rule: 3 -# registers: [0x0052, 0x0053] -# icon: 'mdi:home-lightning-bolt' - -# - name: "Output Apparent Power" -# class: "apparent_power" -# state_class: "measurement" -# uom: "VA" -# scale: 0.1 -# rule: 3 -# registers: [0x0054, 0x0055] -# icon: 'mdi:home-lightning-bolt' - -# - name: "Output Active Power" -# class: "energy" -# state_class: "measurement" -# uom: "kWh" -# scale: 0.1 -# rule: 3 -# registers: [0x0056, 0x0057] -# icon: 'mdi:home-lightning-bolt' - - name: "Total AC Output Power (Active)" class: "power" state_class: "measurement" @@ -252,20 +175,77 @@ parameters: registers: [0x0056, 0x0057] icon: 'mdi:home-lightning-bolt' -# - name: "Output Reactive Power" -# class: "reactive_power" -# state_class: "measurement" -# uom: "VAR" -# rule: 3 -# scale: 0.1 -# registers: [0x0058, 0x0059] -# icon: 'mdi:home-lightning-bolt' + - name: "Radiator Temperature" + class: "temperature" + uom: "°C" + state_class: "measurement" + scale: 0.01 + rule: 1 + offset: 1000 + registers: [0x005a] - name: "Inverter ID" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 5 registers: [0x0003,0x0004,0x0005,0x0006,0x0007] isstr: true + + - name: "Rated Power" + class: "energy" + state_class: "" + uom: "W" + scale: 0.1 + rule: 1 + registers: [0x0010] + icon: 'mdi:solar-power' + + - name: "Start-up Self-checking Time " + class: "" + state_class: "" + uom: "s" + scale: 1 + rule: 1 + registers: [0x0015] + icon: 'mdi:solar-power' + + - name: "Soft Start Enable" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x002F] + isstr: true + lookup: + - key: 0 + value: "Disabled" + - key: 1 + value: "Enabled" + icon: 'mdi:toggle-switch' + + - name: "Power Factor Regulation" + class: "" + state_class: "" + uom: "" + scale: 0.1 + rule: 2 + registers: [0x0032] + icon: '' + + - name: "Restore Factory Settings" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0036] + isstr: true + lookup: + - key: 0 + value: "Disabled" + - key: 1 + value: "Enabled" + icon: 'mdi:factory' diff --git a/custom_components/solarman/inverter_definitions/deye_hybrid.yaml b/custom_components/solarman/inverter_definitions/deye_hybrid.yaml index b1e25e5..262fbce 100644 --- a/custom_components/solarman/inverter_definitions/deye_hybrid.yaml +++ b/custom_components/solarman/inverter_definitions/deye_hybrid.yaml @@ -2,13 +2,16 @@ requests: - start: 0x0003 end: 0x0070 mb_functioncode: 0x03 - - start: 0x0096 - end: 0x00f8 + - start: 0x0096 + end: 0x00f9 + mb_functioncode: 0x03 + - start: 0x00FA + end: 0x0117 mb_functioncode: 0x03 parameters: - group: solar - items: + items: - name: "PV1 Power" class: "power" state_class: "measurement" @@ -90,10 +93,10 @@ parameters: icon: 'mdi:solar-power' - group: Battery - items: + items: - name: "Total Battery Charge" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 0.1 rule: 3 @@ -109,6 +112,24 @@ parameters: registers: [0x004A,0x004B] icon: 'mdi:battery-minus' + - name: "Daily Battery Charge" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [0x0046] + icon: 'mdi:battery-plus' + + - name: "Daily Battery Discharge" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [0x0047] + icon: 'mdi:battery-minus' + - name: "Battery Status" class: "" state_class: "measurement" @@ -117,7 +138,7 @@ parameters: rule: 1 registers: [0x00BD] isstr: true - lookup: + lookup: - key: 0 value: "Charge" - key: 1 @@ -168,12 +189,12 @@ parameters: uom: "°C" scale: 0.1 rule: 1 - offset: 1000 + offset: 1000 registers: [0x00B6] icon: 'mdi:battery' - group: Grid - items: + items: - name: "Total Grid Power" class: "power" state_class: "measurement" @@ -192,6 +213,14 @@ parameters: registers: [0x0096] icon: 'mdi:transmission-tower' + - name: "Grid Current L1" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 1 + registers: [0x00A0] + icon: 'mdi:current-ac' - name: "Grid Voltage L2" class: "voltage" state_class: "measurement" @@ -201,6 +230,15 @@ parameters: registers: [0x0097] icon: 'mdi:transmission-tower' + - name: "Grid Current L2" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 1 + registers: [0x00A1] + icon: 'mdi:current-ac' + - name: "Internal CT L1 Power" class: "power" state_class: "measurement" @@ -254,7 +292,7 @@ parameters: rule: 1 registers: [0x004E,0x0050] icon: 'mdi:transmission-tower-export' - + - name: "Daily Energy Sold" class: "energy" state_class: "total_increasing" @@ -284,10 +322,10 @@ parameters: icon: 'mdi:transmission-tower' - group: Upload - items: + items: - name: "Total Load Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 1 @@ -296,7 +334,7 @@ parameters: - name: "Load L1 Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 1 @@ -305,7 +343,7 @@ parameters: - name: "Load L2 Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 1 @@ -314,7 +352,7 @@ parameters: - name: "Load Voltage" class: "voltage" - state_class: "measurement" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 @@ -323,7 +361,7 @@ parameters: - name: "Daily Load Consumption" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 0.1 rule: 1 @@ -332,7 +370,7 @@ parameters: - name: "Total Load Consumption" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 0.1 rule: 3 @@ -341,13 +379,13 @@ parameters: - name: "SmartLoad Enable Status" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x00C3] isstr: true - lookup: + lookup: - key: 0 value: "OFF" - key: 1 @@ -355,16 +393,16 @@ parameters: icon: 'mdi:lightning-bolt-outline' - group: Inverter - items: + items: - name: "Running Status" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x003B] isstr: true - lookup: + lookup: - key: 0 value: "Stand-by" - key: 1 @@ -377,16 +415,25 @@ parameters: - name: "Total Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 2 registers: [0x00AF] icon: 'mdi:home-lightning-bolt' + - name: "Grid Frequency" + class: "frequency" + state_class: "measurement" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [0x004F] + icon: 'mdi:sine-wave' + - name: "Current L1" class: "current" - state_class: "measurement" + state_class: "measurement" uom: "A" scale: 0.01 rule: 2 @@ -403,7 +450,7 @@ parameters: - name: "Inverter L1 Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 2 @@ -412,45 +459,54 @@ parameters: - name: "Inverter L2 Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 2 registers: [0x00AE] icon: 'mdi:home-lightning-bolt' + - name: "Load Frequency" + class: "" + state_class: "measurement" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [0x00C0] + icon: 'mdi:sine-wave' + - name: "DC Temperature" class: "temperature" - state_class: "measurement" + state_class: "measurement" uom: "°C" scale: 0.1 rule: 2 - offset: 1000 + offset: 1000 registers: [0x005A] icon: 'mdi:thermometer' - name: "AC Temperature" class: "temperature" - state_class: "measurement" + state_class: "measurement" uom: "°C" scale: 0.1 rule: 2 - offset: 1000 + offset: 1000 registers: [0x005B] icon: 'mdi:thermometer' - name: "Inverter ID" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 5 registers: [0x0003,0x0004,0x0005,0x0006,0x0007] isstr: true - + - name: "Communication Board Version No." class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 @@ -459,7 +515,7 @@ parameters: - name: "Control Board Version No." class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 @@ -468,13 +524,13 @@ parameters: - name: "Grid-connected Status" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x00C2] isstr: true - lookup: + lookup: - key: 0 value: "Off-Grid" - key: 1 @@ -483,12 +539,12 @@ parameters: - name: "Gen-connected Status" class: "" uom: "" - state_class: "" + state_class: "" scale: 1 rule: 1 registers: [0x00A6] isstr: true - lookup: + lookup: - key: 0 value: "none" - key: 1 @@ -496,35 +552,21 @@ parameters: - name: "Gen Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 1 registers: [0x00A6] - - name: "Time of use" - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x00F8] - isstr: true - lookup: - - key: 0 - value: "Disable" - - key: 1 - value: "Enable" - - name: "Work Mode" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 3 registers: [0x00F4,0x00F7] isstr: true - lookup: + lookup: - key: 0 value: "Selling First" - key: 1 @@ -538,11 +580,251 @@ parameters: icon: 'mdi:home-lightning-bolt' - group: Alert - items: + items: - name: "Alert" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 6 registers: [0x0065,0x0066,0x0067,0x0068,0x0069,0x006A] + + - group: Time of Use + items: + - name: "Time of use Time 1" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 9 + registers: [0x00FA] + icon: 'mdi:timelapse' + + - name: "Time of use Time 2" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 9 + registers: [0x00FB] + icon: "mdi:timelapse" + + - name: "Time of Use Time 3" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 9 + registers: [0x00FC] + icon: 'mdi:timelapse' + + - name: "Time of Use Time 4" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 9 + registers: [0x00FD] + icon: 'mdi:timelapse' + + - name: "Time of Use Time 5" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 9 + registers: [0x00FE] + icon: "mdi:timelapse" + + - name: "Time of Use Time 6" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 9 + registers: [0x00FF] + icon: 'mdi:timelapse' + + - name: "Time of Use Power 1" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0100] + icon: "mdi:lightning-bolt-outline" + + - name: "Time of Use Power 2" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0101] + icon: 'mdi:lightning-bolt-outline' + + - name: "Time of Use Power 3" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0102] + icon: 'mdi:lightning-bolt-outline' + + - name: "Time of Use Power 4" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0103] + icon: 'mdi:lightning-bolt-outline' + + - name: "Time of Use Power 5" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0104] + icon: 'mdi:lightning-bolt-outline' + + - name: "Time of Use Power 6" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0105] + icon: 'mdi:lightning-bolt-outline' + + - name: "Time of Use SOC 1" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x010C] + icon: 'mdi:battery' + + - name: "Time of Use SOC 2" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x010D] + icon: 'mdi:battery' + + - name: "Time of Use SOC 3" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x010E] + icon: 'mdi:battery' + + - name: "Time of Use SOC 4" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x010F] + icon: 'mdi:battery' + + - name: "Time of Use SOC 5" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0110] + icon: 'mdi:battery' + + - name: "Time of Use SOC 6" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0111] + icon: 'mdi:battery' + + - name: "Time of Use Enable 1" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + mask: 1 + registers: [0x0112] + icon: 'mdi:checkbox-marked-outline' + + - name: "Time of Use Enable 2" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + mask: 1 + registers: [0x0113] + icon: 'mdi:checkbox-marked-outline' + + - name: "Time of Use Enable 3" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + mask: 1 + registers: [0x0114] + icon: 'mdi:checkbox-marked-outline' + + - name: "Time of Use Enable 4" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + mask: 1 + registers: [0x0115] + icon: 'mdi:checkbox-marked-outline' + + - name: "Time of Use Enable 5" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + mask: 1 + registers: [0x0116] + icon: 'mdi:checkbox-marked-outline' + + - name: "Time of Use Enable 6" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + mask: 1 + registers: [0x0117] + icon: 'mdi:checkbox-marked-outline' + + - name: "Time of use" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + mask: 1 + registers: [0x00F8] + icon: 'mdi:checkbox-marked-outline' + isstr: true + lookup: + - key: 0 + value: "Disable" + - key: 1 + value: "Enable" diff --git a/custom_components/solarman/inverter_definitions/deye_sg04lp3.yaml b/custom_components/solarman/inverter_definitions/deye_sg04lp3.yaml index 7d80fe4..9224a29 100644 --- a/custom_components/solarman/inverter_definitions/deye_sg04lp3.yaml +++ b/custom_components/solarman/inverter_definitions/deye_sg04lp3.yaml @@ -5,25 +5,25 @@ requests: - start: 0x0003 end: 0x0059 mb_functioncode: 0x03 - - start: 0x0202 + - start: 0x0202 end: 0x022E - mb_functioncode: 0x03 - - start: 0x024A + mb_functioncode: 0x03 + - start: 0x024A end: 0x024F - mb_functioncode: 0x03 + mb_functioncode: 0x03 - start: 0x0256 end: 0x027C - mb_functioncode: 0x03 - - start: 0x0284 + mb_functioncode: 0x03 + - start: 0x0284 end: 0x028D - mb_functioncode: 0x03 - - start: 0x02A0 + mb_functioncode: 0x03 + - start: 0x02A0 end: 0x02A7 mb_functioncode: 0x03 - + parameters: - group: solar - items: + items: - name: "PV1 Power" class: "power" state_class: "measurement" @@ -100,11 +100,11 @@ parameters: icon: 'mdi:solar-power' - group: Battery - items: + items: - name: "Daily Battery Charge" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 0.1 rule: 1 @@ -112,7 +112,7 @@ parameters: icon: 'mdi:battery-plus' - name: "Daily Battery Discharge" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 0.1 rule: 1 @@ -121,7 +121,7 @@ parameters: - name: "Total Battery Charge" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 0.1 rule: 3 @@ -182,16 +182,15 @@ parameters: uom: "°C" scale: 0.1 rule: 1 - offset: 1000 + offset: 1000 registers: [0x024A] icon: 'mdi:battery' validation: min: 1 max: 99 - invalidate_all: - + - group: Grid - items: + items: - name: "Total Grid Power" class: "measurement" state_class: "measurement" @@ -218,7 +217,7 @@ parameters: rule: 1 registers: [0x0257] icon: 'mdi:transmission-tower' - + - name: "Grid Voltage L3" class: "voltage" state_class: "measurement" @@ -226,7 +225,7 @@ parameters: scale: 0.1 rule: 1 registers: [0x0258] - icon: 'mdi:transmission-tower' + icon: 'mdi:transmission-tower' - name: "Internal CT L1 Power" class: "power" @@ -245,7 +244,7 @@ parameters: rule: 2 registers: [0x025D] icon: 'mdi:transmission-tower' - + - name: "Internal CT L3 Power" class: "power" state_class: "measurement" @@ -253,7 +252,7 @@ parameters: scale: 1 rule: 2 registers: [0x025E] - icon: 'mdi:transmission-tower' + icon: 'mdi:transmission-tower' - name: "External CT L1 Power" class: "power" @@ -272,7 +271,7 @@ parameters: rule: 2 registers: [0x0269] icon: 'mdi:transmission-tower' - + - name: "External CT L3 Power" class: "power" state_class: "measurement" @@ -281,7 +280,7 @@ parameters: rule: 2 registers: [0x026A] icon: 'mdi:transmission-tower' - + - name: "Daily Energy Bought" class: "energy" state_class: "total_increasing" @@ -299,7 +298,7 @@ parameters: rule: 1 registers: [0x020A,0x020B] icon: 'mdi:transmission-tower-export' - + - name: "Daily Energy Sold" class: "energy" state_class: "total_increasing" @@ -326,12 +325,12 @@ parameters: rule: 4 registers: [0x020C,0x020D] icon: 'mdi:transmission-tower' - + - group: Upload - items: + items: - name: "Total Load Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 1 @@ -340,7 +339,7 @@ parameters: - name: "Load L1 Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 1 @@ -349,52 +348,52 @@ parameters: - name: "Load L2 Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 1 registers: [0x028B] icon: 'mdi:lightning-bolt-outline' - + - name: "Load L3 Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 1 registers: [0x028C] icon: 'mdi:lightning-bolt-outline' - + - name: "Load Voltage L1" class: "voltage" - state_class: "measurement" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 registers: [0x0284] icon: 'mdi:lightning-bolt-outline' - + - name: "Load Voltage L2" class: "voltage" - state_class: "measurement" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 registers: [0x0285] icon: 'mdi:lightning-bolt-outline' - + - name: "Load Voltage L3" class: "voltage" - state_class: "measurement" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 registers: [0x0286] icon: 'mdi:lightning-bolt-outline' - + - name: "Daily Load Consumption" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 0.1 rule: 1 @@ -403,18 +402,18 @@ parameters: - name: "Total Load Consumption" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 0.1 rule: 3 registers: [0x020F,0x0210] icon: 'mdi:lightning-bolt-outline' - + - group: Inverter items: - name: "Current L1" class: "current" - state_class: "measurement" + state_class: "measurement" uom: "A" scale: 0.01 rule: 2 @@ -429,7 +428,7 @@ parameters: rule: 2 registers: [0x0277] icon: 'mdi:home-lightning-bolt' - + - name: "Current L3" class: "current" uom: "A" @@ -437,10 +436,10 @@ parameters: rule: 2 registers: [0x0278] icon: 'mdi:home-lightning-bolt' - + - name: "Inverter L1 Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 2 @@ -449,54 +448,54 @@ parameters: - name: "Inverter L2 Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 2 registers: [0x027A] icon: 'mdi:home-lightning-bolt' - + - name: "Inverter L3 Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 2 registers: [0x027B] icon: 'mdi:home-lightning-bolt' - + - name: "DC Temperature" class: "temperature" - state_class: "measurement" + state_class: "measurement" uom: "°C" scale: 0.1 rule: 2 - offset: 1000 + offset: 1000 registers: [0x021C] icon: 'mdi:thermometer' - name: "AC Temperature" class: "temperature" - state_class: "measurement" + state_class: "measurement" uom: "°C" scale: 0.1 rule: 2 - offset: 1000 + offset: 1000 registers: [0x021D] icon: 'mdi:thermometer' - name: "Inverter ID" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 5 registers: [0x0003,0x0004,0x0005,0x0006,0x0007] isstr: true - + - name: "Communication Board Version No." class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 @@ -505,7 +504,7 @@ parameters: - name: "Control Board Version No." class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 @@ -513,10 +512,10 @@ parameters: isstr: true - group: Alert - items: + items: - name: "Alert" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 6 diff --git a/custom_components/solarman/inverter_definitions/deye_string.yaml b/custom_components/solarman/inverter_definitions/deye_string.yaml index 6de29ff..65d9bca 100644 --- a/custom_components/solarman/inverter_definitions/deye_string.yaml +++ b/custom_components/solarman/inverter_definitions/deye_string.yaml @@ -6,7 +6,7 @@ requests: parameters: - group: solar - items: + items: - name: "PV1 Voltage" class: "voltage" state_class: "measurement" @@ -60,13 +60,13 @@ parameters: registers: [0x003F,0x0040] icon: 'mdi:solar-power' validation: - min: 0.1 + min: 0.1 invalidate_all: - group: Grid - items: + items: - name: "Grid Voltage L-L(A)" class: "voltage" state_class: "measurement" @@ -96,7 +96,7 @@ parameters: - name: "Grid Current A" class: "current" - state_class: "measurement" + state_class: "measurement" uom: "A" scale: 0.1 rule: 2 @@ -105,7 +105,7 @@ parameters: - name: "Grid Current B" class: "current" - state_class: "measurement" + state_class: "measurement" uom: "A" scale: 0.1 rule: 2 @@ -114,7 +114,7 @@ parameters: - name: "Grid Current C" class: "current" - state_class: "measurement" + state_class: "measurement" uom: "A" scale: 0.1 rule: 2 @@ -123,7 +123,7 @@ parameters: - name: "Grid Frequency" class: "frequency" - state_class: "measurement" + state_class: "measurement" uom: "Hz" scale: 0.01 rule: 1 @@ -131,16 +131,16 @@ parameters: icon: 'mdi:home-lightning-bolt' - group: Inverter - items: + items: - name: "Running Status" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x003B] isstr: true - lookup: + lookup: - key: 0 value: "Stand-by" - key: 1 @@ -151,9 +151,9 @@ parameters: value: "FAULT" icon: 'mdi:home-lightning-bolt' - - name: "Total Ouput AC Power" + - name: "Total Output AC Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 0.1 rule: 3 @@ -198,7 +198,7 @@ parameters: - name: "Inverter ID" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 5 diff --git a/custom_components/solarman/inverter_definitions/hyd-zss-hp-3k-6k.yaml b/custom_components/solarman/inverter_definitions/hyd-zss-hp-3k-6k.yaml new file mode 100644 index 0000000..833a28d --- /dev/null +++ b/custom_components/solarman/inverter_definitions/hyd-zss-hp-3k-6k.yaml @@ -0,0 +1,883 @@ +# ZCS Azzurro 3-phase hybrid inverters +# with LSW-3 WiFi logger with SN 27xxxxxxxx and FW LSW3_15_270A_1.53: + +requests: + - start: 0x0400 + end: 0x042B + mb_functioncode: 0x03 + - start: 0x0482 + end: 0x04A4 + mb_functioncode: 0x03 + - start: 0x0582 + end: 0x0589 + mb_functioncode: 0x03 + - start: 0x0604 + end: 0x060A + mb_functioncode: 0x03 + - start: 0x0682 + end: 0x069B + mb_functioncode: 0x03 + - start: 0x0504 + end: 0x0504 + mb_functioncode: 0x03 + +parameters: + - group: Solar + items: + - name: 'PV Generation today' + class: 'energy' + state_class: 'total_increasing' + uom: 'kWh' + scale: 0.01 + rule: 3 + registers: [0x0685,0x0684] + icon: 'mdi:solar-power' + + - name: 'PV Generation total' + class: 'energy' + state_class: 'total_increasing' + uom: 'kWh' + scale: 0.1 + rule: 3 + registers: [0x0687,0x0686] + icon: 'mdi:solar-power' + + - name: 'PV1 Power' + class: 'power' + state_class: 'measurement' + uom: 'W' + scale: 10 + rule: 1 + registers: [0x0586] + icon: 'mdi:solar-power' + + - name: 'PV2 Power' + class: 'power' + state_class: 'measurement' + uom: 'W' + scale: 10 + rule: 1 + registers: [0x0589] + icon: 'mdi:solar-power' + + - name: 'PV1 Voltage' + class: 'voltage' + state_class: 'measurement' + uom: 'V' + scale: 0.1 + rule: 1 + registers: [0x0584] + icon: 'mdi:solar-power' + + - name: 'PV2 Voltage' + class: 'voltage' + state_class: 'measurement' + uom: 'V' + scale: 0.1 + rule: 1 + registers: [0x0587] + icon: 'mdi:solar-power' + + - name: 'PV1 Current' + class: 'current' + state_class: 'measurement' + uom: 'A' + scale: 0.01 + rule: 1 + registers: [0x0585] + icon: 'mdi:solar-power' + + - name: 'PV2 Current' + class: 'current' + state_class: 'measurement' + uom: 'A' + scale: 0.01 + rule: 1 + registers: [0x0588] + icon: 'mdi:solar-power' + + - group: batteries + items: + - name: "Battery 1 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x0604] + icon: 'mdi:battery-charging' + + - name: "Battery Charge / Discharge current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 2 + registers: [0x0605] + icon: 'mdi:battery-charging-10' + + - name: "Battery SoC" + class: "battery" + state_class: "measurement" + uom: "%" + scale: 1 + rule: 1 + registers: [0x0608] + icon: 'mdi:battery' + + - name: "Battery SoH" + class: "battery" + state_class: "measurement" + uom: "%" + scale: 1 + rule: 1 + registers: [0x0609] + icon: 'mdi:battery' + + - name: "Battery Temperature" + class: "temperature" + state_class: "measurement" + uom: "°C" + scale: 1 + #se non funziona cambia questo in 2 + rule: 1 + registers: [0x0607] + icon: 'mdi:battery-heart-outline' + + - name: "Battery Charge Total" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [0x0697,0x0696] + icon: 'mdi:battery-clock' + + - name: "Battery Discharge Total" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [0x069B,0x069A] + icon: 'mdi:battery-clock-outline' + + - name: "Battery Cycles" + class: "" + state_class: "" + uom: "Charges" + scale: 1 + rule: 1 + registers: [0x060A] + icon: 'mdi:battery-check-outline' + + - name: "Battery Power" + class: "power" + state_class: "measurement" + uom: "KW" + scale: 0.01 + rule: 2 + registers: [0x0606] + icon: 'mdi:battery-charging-high' + + - name: 'Battery Charge Today' + class: 'energy' + state_class: 'total_increasing' + uom: 'kWh' + scale: 0.01 + rule: 3 + registers: [0x0695,0x0694] + icon: 'mdi:home-lightning-bolt' + + - name: 'Battery Discharge Today' + class: 'energy' + state_class: 'total_increasing' + uom: 'kWh' + scale: 0.01 + rule: 3 + registers: [0x0699,0x0698] + icon: 'mdi:home-lightning-bolt' + + - group: Grid + items: + - name: 'Grid Frequency' + class: 'frequency' + state_class: 'measurement' + uom: 'Hz' + scale: 0.01 + rule: 1 + registers: [0x0484] + icon: 'mdi:home-lightning-bolt' + + - name: 'Active Power Output Total' + class: 'power' + state_class: 'measurement' + uom: 'W' + scale: 10 + rule: 2 + registers: [0x0485] + icon: 'mdi:home-lightning-bolt' + + - name: 'Active Power Load Total' + class: 'power' + state_class: 'measurement' + uom: 'W' + scale: 10 + rule: 2 + registers: [0x0504] + icon: 'mdi:home-lightning-bolt' + + - name: 'Energy Purchase Today' + class: 'energy' + state_class: 'total_increasing' + uom: 'kWh' + scale: 0.01 + rule: 3 + registers: [0x068D,0x068C] + icon: 'mdi:home-lightning-bolt' + + - name: 'Energy Purchase Total' + class: 'energy' + state_class: 'total_increasing' + uom: 'kWh' + scale: 0.1 + rule: 3 + registers: [0x068F,0x068E] + icon: 'mdi:home-lightning-bolt' + + - name: 'Energy Selling Today' + class: 'energy' + state_class: 'total_increasing' + uom: 'kWh' + scale: 0.01 + rule: 3 + registers: [0x0691,0x0690] + icon: 'mdi:home-lightning-bolt' + + - name: 'Energy Selling Total' + class: 'energy' + state_class: 'total_increasing' + uom: 'kWh' + scale: 0.1 + rule: 3 + registers: [0x0693,0x0692] + icon: 'mdi:home-lightning-bolt' + + - group: Inverter + items: + - name: 'Inverter status' + class: '' + state_class: 'measurement' + uom: '' + scale: 1 + rule: 1 + registers: [0x0404] + lookup: + - key: 0 + value: 'Stand-by' + - key: 1 + value: 'Self-checking' + - key: 2 + value: 'Normal' + - key: 3 + value: 'FAULT' + - key: 4 + value: 'Permanent' + icon: 'mdi:wrench' + + - name: 'Module temperature' + class: 'temperature' + uom: '°C' + scale: 0.1 + rule: 2 + registers: [0x0683] + icon: 'mdi:thermometer' + + - name: 'Ambient temperature' + class: 'temperature' + uom: '°C' + scale: 1 + rule: 2 + registers: [0x0418] + icon: 'mdi:thermometer' + + - name: 'Radiator temperature' + class: 'temperature' + uom: '°C' + scale: 1 + rule: 2 + registers: [0x041A] + icon: 'mdi:thermometer' + + - name: 'Insulation Resistance' + class: '' + state_class: 'measurement' + uom: 'Ω' + scale: 1 + rule: 1 + registers: [0x042B] + icon: 'mdi:omega' + + - group: Alert + items: + - name: 'Alert' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 6 + registers: + [ + 0x0405, + 0x0406, + 0x0407, + 0x0408, + 0x0409, + 0x040A, + 0x040B, + 0x040C, + 0x040D, + 0x040E, + 0x040F, + 0x0410, + ] + + - name: 'Fault 1' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 1 + registers: [0x0405] + isstr: true + icon: 'mdi:wrench' + lookup: + - key: 0 + value: 'No error' + - key: 1 + value: 'ID01 Grid Over Voltage Protection' + - key: 2 + value: 'ID02 Grid Under Voltage Protection' + - key: 4 + value: 'ID03 Grid Over Frequency Protection' + - key: 8 + value: 'ID04 Grid Under Frequency Protection' + - key: 16 + value: 'ID05 Leakage current fault' + - key: 32 + value: 'ID06 High penetration error' + - key: 64 + value: 'ID07 Low penetration error' + - key: 128 + value: 'ID08 Islanding error' + - key: 256 + value: 'ID09 Grid voltage transient value overvoltage 1' + - key: 512 + value: 'ID10 Grid voltage transient value overvoltage 2' + - key: 1024 + value: 'ID11 Grid line voltage error' + - key: 2048 + value: 'ID12 Inverter voltage error' + - key: 4096 + value: 'ID13 Anti-backflow overload' + - key: 8192 + value: 'ID14' + - key: 16384 + value: 'ID15' + - key: 32768 + value: 'ID16' + + - name: 'Fault 2' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 1 + icon: 'mdi:wrench' + isstr: true + registers: [0x0406] + lookup: + - key: 0 + value: 'No error' + - key: 1 + value: 'ID17 Grid current sampling error' + - key: 2 + value: 'ID18 Grid current DC component sampling error (AC side)' + - key: 4 + value: 'ID19 Grid voltage sampling error (DC side)' + - key: 8 + value: 'ID20 Grid voltage sampling error (AC side)' + - key: 16 + value: 'ID21 Leakage current sampling error (DC side)' + - key: 32 + value: 'ID22 Leakage current sampling error (AC side)' + - key: 64 + value: 'ID23 Load voltage DC component sampling error' + - key: 128 + value: 'ID24 DC input current sampling error' + - key: 256 + value: 'ID25 DC component sampling error of grid current (DC side)' + - key: 512 + value: 'ID26 DC input branch current sampling error' + - key: 1024 + value: 'ID27' + - key: 2048 + value: 'ID28' + - key: 4096 + value: 'ID29 Leakage current consistency error' + - key: 8192 + value: 'ID30 Grid voltage consistency error' + - key: 16384 + value: 'ID31 DCI consistency error' + - key: 32768 + value: 'ID32' + + - name: 'Fault 3' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 1 + icon: 'mdi:wrench' + isstr: true + registers: [0x0407] + lookup: + - key: 0 + value: 'No error' + - key: 1 + value: 'ID033 SPI communication error (DC side)' + - key: 2 + value: 'ID034 SPI communication error (AC side)' + - key: 4 + value: 'ID035 Chip error (DC side)' + - key: 8 + value: 'ID036 Chip error (AC side)' + - key: 16 + value: 'ID037 Auxiliary power error' + - key: 32 + value: 'ID038 Inverter soft start failure' + - key: 64 + value: 'ID039 ' + - key: 128 + value: 'ID040 ' + - key: 256 + value: 'ID041 Relay detection failure' + - key: 512 + value: 'ID042 Low insulation impedance' + - key: 1024 + value: 'ID043 Grounding error' + - key: 2048 + value: 'ID044 Input mode setting error' + - key: 4096 + value: 'ID045 CT error' + - key: 8192 + value: 'ID046 Input reversal error' + - key: 16384 + value: 'ID047 Parallel error' + - key: 32768 + value: 'ID048 Serial number error' + + - name: 'Fault 4' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 1 + icon: 'mdi:wrench' + registers: [0x0408] + isstr: true + lookup: + - key: 0 + value: 'No error' + - key: 1 + value: 'ID049 Battery temperature protection' + - key: 2 + value: 'ID050 Heat sink 1 temperature protection' + - key: 4 + value: 'ID051 Heater 2 temperature protection' + - key: 8 + value: 'ID052 Heater 3 temperature protection' + - key: 16 + value: 'ID053 Heatsink 4 temperature protection' + - key: 32 + value: 'ID054 Heatsink 5 temperature protection' + - key: 64 + value: 'ID055 Radiator 6 temperature protection' + - key: 128 + value: 'ID056 ' + - key: 256 + value: 'ID057 Ambient temperature 1 protection' + - key: 512 + value: 'ID058 Ambient temperature 2 protection' + - key: 1024 + value: 'ID059 Module 1 temperature protection' + - key: 2048 + value: 'ID060 Module 2 temperature protection' + - key: 4096 + value: 'ID061 Module 3 temperature protection' + - key: 8192 + value: 'ID062 Module temperature difference is too large' + - key: 16384 + value: 'ID063 ' + - key: 32768 + value: 'ID064 ' + + - name: 'Fault 5' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 1 + icon: 'mdi:wrench' + registers: [0x0409] + isstr: true + lookup: + - key: 0 + value: 'No error' + - key: 1 + value: 'ID065 Bus voltage RMS unbalance' + - key: 2 + value: 'ID066 Bus voltage transient value unbalance' + - key: 4 + value: 'ID067 Undervoltage of busbar during grid connection' + - key: 8 + value: 'ID068 Bus bar low voltage' + - key: 16 + value: 'ID069 PV overvoltage' + - key: 32 + value: 'ID070 Battery over-voltage' + - key: 64 + value: 'ID071 LLCBus overvoltage protection' + - key: 128 + value: 'ID072 Inverter bus voltage RMS software overvoltage' + - key: 256 + value: 'ID073 Inverter bus voltage transient value software overvoltage' + - key: 512 + value: 'ID074 Flying Cross Capacitor Overvoltage Protection' + - key: 1024 + value: 'ID075 Flying Cross capacitor undervoltage protection' + - key: 2048 + value: 'ID076 ' + - key: 4096 + value: 'ID077 ' + - key: 8192 + value: 'ID078 ' + - key: 16384 + value: 'ID079 ' + - key: 32768 + value: 'ID080 ' + + - name: 'Fault 6' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 1 + icon: 'mdi:wrench' + isstr: true + registers: [0x040A] + lookup: + - key: 0 + value: 'No error' + - key: 1 + value: 'ID081 Battery overcurrent software protection' + - key: 2 + value: 'ID082 Dci overcurrent protection' + - key: 4 + value: 'ID083 Output transient current protection' + - key: 8 + value: 'ID084 BuckBoost software overcurrent' + - key: 16 + value: 'ID085 Output RMS current protection' + - key: 32 + value: 'ID086 PV instantaneous current overcurrent software protection' + - key: 64 + value: 'ID087 PV parallel uneven current' + - key: 128 + value: 'ID088 Output current unbalance' + - key: 256 + value: 'ID089 PV software overcurrent protection' + - key: 512 + value: 'ID090 Balanced circuit overcurrent protection' + - key: 1024 + value: 'ID091 Resonance protection' + - key: 2048 + value: 'ID092 ' + - key: 4096 + value: 'ID093 ' + - key: 8192 + value: 'ID094 ' + - key: 16384 + value: 'ID095 ' + - key: 32768 + value: 'ID096 ' + + - name: 'Fault 7' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 1 + icon: 'mdi:wrench' + isstr: true + registers: [0x040B] + lookup: + - key: 0 + value: 'No error' + - key: 1 + value: 'ID097 LLC bus hardware overvoltage' + - key: 2 + value: 'ID098 Inverter bus hardware overvoltage' + - key: 4 + value: 'ID099 BuckBoost hardware overcurrent' + - key: 8 + value: 'ID100 Battery hardware overcurrent' + - key: 16 + value: 'ID101 ' + - key: 32 + value: 'ID102 PV hardware overcurrent' + - key: 64 + value: 'ID103 AC output hardware overcurrent' + - key: 128 + value: 'ID104 ' + - key: 256 + value: 'ID105 Power meter error' + - key: 512 + value: 'ID106 Serial number model error' + - key: 1024 + value: 'ID107 ' + - key: 2048 + value: 'ID108 ' + - key: 4096 + value: 'ID109 ' + - key: 8192 + value: 'ID110 Overload protection 1' + - key: 16384 + value: 'ID111 Overload protection 2' + - key: 32768 + value: 'ID112 Overload protection 3' + + - name: 'Fault 8' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 1 + icon: 'mdi:wrench' + registers: [0x040C] + isstr: true + lookup: + - key: 0 + value: 'No error' + - key: 1 + value: 'ID113 Overtemperature derating' + - key: 2 + value: 'ID114 Frequency down load' + - key: 4 + value: 'ID115 Frequency loading' + - key: 8 + value: 'ID116 Voltage down load' + - key: 16 + value: 'ID117 Voltage loading' + - key: 32 + value: 'ID118 ' + - key: 64 + value: 'ID119 ' + - key: 128 + value: 'ID120 ' + - key: 256 + value: 'ID121 Lightning protection failure (DC)' + - key: 512 + value: 'ID122 Lightning protection failure (AC)' + - key: 1024 + value: 'ID123 ' + - key: 2048 + value: 'ID124 Battery low voltage protection' + - key: 4096 + value: 'ID125 Battery low voltage shutdown' + - key: 8192 + value: 'ID126 Battery low voltage pre-alarm' + - key: 16384 + value: 'ID127 ' + - key: 32768 + value: 'ID128 ' + + - name: 'Fault 9' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 1 + icon: 'mdi:wrench' + isstr: true + registers: [0x040D] + lookup: + - key: 0 + value: 'No error' + - key: 1 + value: 'ID129 Output hardware overcurrent permanent fault' + - key: 2 + value: 'ID130 Bus overvoltage permanent fault' + - key: 4 + value: 'ID131 Bus hardware over-voltage permanent fault' + - key: 8 + value: 'ID132 PV uneven flow permanent fault' + - key: 16 + value: 'ID133 Battery overcurrent permanent fault in EPS mode' + - key: 32 + value: 'ID134 Output transient overcurrent permanent fault' + - key: 64 + value: 'ID135 Output current unbalance permanent fault' + - key: 128 + value: 'ID136 ' + - key: 256 + value: 'ID137 Input mode setting error permanent fault' + - key: 512 + value: 'ID138 Input overcurrent permanent fault' + - key: 1024 + value: 'ID139 Input hardware overcurrent permanent fault' + - key: 2048 + value: 'ID140 Relay permanent fault' + - key: 4096 + value: 'ID141 Bus unbalance permanent fault' + - key: 8192 + value: 'ID142 Lightning protection permanent fault - DC side' + - key: 16384 + value: 'ID143 Lightning protection permanent fault - AC side' + - key: 32768 + value: 'ID144 ' + + - name: 'Fault 10' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 1 + icon: 'mdi:wrench' + isstr: true + registers: [0x040E] + lookup: + - key: 0 + value: 'No error' + - key: 1 + value: 'ID145 USB fault' + - key: 2 + value: 'ID146 WIFI fault' + - key: 4 + value: 'ID147 Bluetooth fault' + - key: 8 + value: 'ID148 RTC clock fault' + - key: 16 + value: 'ID149 Communication board EEPROM error' + - key: 32 + value: 'ID150 Communication board FLASH error' + - key: 64 + value: 'ID151 ' + - key: 128 + value: 'ID152 Safety regulation version error' + - key: 256 + value: 'ID153 SCI communication error (DC side)' + - key: 512 + value: 'ID154 SCI communication error (AC side)' + - key: 1024 + value: 'ID155 SCI communication error (convergence board side)' + - key: 2048 + value: 'ID156 Software version inconsistency' + - key: 4096 + value: 'ID157 Lithium battery 1 communication error' + - key: 8192 + value: 'ID158 Li-ion battery 2 communication error' + - key: 16384 + value: 'ID159 Lithium battery 3 communication error' + - key: 32768 + value: 'ID160 Lithium battery 4 communication failure' + + - name: 'Fault 11' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 1 + icon: 'mdi:wrench' + registers: [0x040F] + isstr: true + lookup: + - key: 0 + value: 'No error' + - key: 1 + value: 'ID161 Forced shutdown' + - key: 2 + value: 'ID162 Remote shutdown' + - key: 4 + value: 'ID163 Drms0 shutdown' + - key: 8 + value: 'ID164 ' + - key: 16 + value: 'ID165 Remote down load' + - key: 32 + value: 'ID166 Logic interface down load' + - key: 64 + value: 'ID167 Anti-Reverse Flow Downgrade' + - key: 128 + value: 'ID168 ' + - key: 256 + value: 'ID169 Fan 1 failure' + - key: 512 + value: 'ID170 Fan 2 failure' + - key: 1024 + value: 'ID171 Fan 3 failure' + - key: 2048 + value: 'ID172 Fan 4 failure' + - key: 4096 + value: 'ID173 Fan 5 failure' + - key: 8192 + value: 'ID174 Fan 6 failure' + - key: 16384 + value: 'ID175 Fan 7 fault' + - key: 32768 + value: 'ID176 Meter communication failure' + + - name: 'Fault 12' + class: '' + state_class: '' + uom: '' + scale: 1 + rule: 1 + icon: 'mdi:wrench' + registers: [0x0410] + isstr: true + lookup: + - key: 0 + value: 'No error' + - key: 1 + value: 'ID177 BMS over-voltage alarm' + - key: 2 + value: 'ID178 BMS undervoltage alarm' + - key: 4 + value: 'ID179 BMS high temperature alarm' + - key: 8 + value: 'ID180 BMS low temperature alarm' + - key: 16 + value: 'ID181 BMS charge/discharge overload alarm' + - key: 32 + value: 'ID182 BMS short circuit alarm' + - key: 64 + value: 'ID183 BMS version inconsistency' + - key: 128 + value: 'ID184 BMS CAN version inconsistency' + - key: 256 + value: 'ID185 BMS CAN version is too low' + - key: 512 + value: 'ID186 ' + - key: 1024 + value: 'ID187 ' + - key: 2048 + value: 'ID188 ' + - key: 4096 + value: 'ID189 Arc device communication failure' + - key: 8192 + value: 'ID190 DC arc alarm fault' + - key: 16384 + value: 'ID191 PID repair failed' + - key: 32768 + value: 'ID192 PLC module heartbeat loss' diff --git a/custom_components/solarman/inverter_definitions/kstar_hybrid.yaml b/custom_components/solarman/inverter_definitions/kstar_hybrid.yaml new file mode 100644 index 0000000..6b7a8db --- /dev/null +++ b/custom_components/solarman/inverter_definitions/kstar_hybrid.yaml @@ -0,0 +1,795 @@ +# KSTAR Hybrid Inverter +# Modbus information taken from "MODBUS RS485 Communication Protocol V2.5" document provided by KSTAR + +# This inverter exposes its data in the following registers (although not all of them are used by this definition file): +# +# - INPUT_REGISTERS 3000 - 3660 decimal, 0x0BB8 - 0x0E4C hexadecimal +# - HOLDING_REGISTERS 3200 - 3237 decimal. 0x0C80 - 0x0C9B hexadecimal +# +# Each request can get a maximum of 125 registers as per modbus protocol (start and end included), so we need to +# split up the list of used registers into multiple requests of maximum 125 registers each. + +requests: + # Start requesting from the first needed register (3000) + - start: 3000 + end: 3124 + mb_functioncode: 0x04 + + # Input registers 3200 - 3227 can't be read as they would clash with holding registers of same number + - start: 3125 + end: 3199 + mb_functioncode: 0x04 + + # Change to holding registers 3200 - 3237 (mb_functioncode 3) for the inverter system information. + - start: 3200 + end: 3217 + mb_functioncode: 0x03 + + # Continue with the needed input registers + - start: 3228 + end: 3249 + mb_functioncode: 0x04 + + # Last input register currently used by this definition file is 3301, so we can skip the rest for now. + - start: 3250 + end: 3301 + mb_functioncode: 0x04 + +parameters: + - group: solar + items: + - name: "PV1 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [ 3000 ] + icon: 'mdi:solar-power' + + - name: "PV2 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [ 3001 ] + icon: 'mdi:solar-power' + + - name: "PV1 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 2 + registers: [ 3012 ] + icon: 'mdi:solar-power' + + - name: "PV2 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 2 + registers: [ 3013 ] + icon: 'mdi:solar-power' + + - name: "PV1 Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 2 + registers: [ 3024 ] + icon: 'mdi:solar-power' + + - name: "PV2 Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 2 + registers: [ 3025 ] + icon: 'mdi:solar-power' + + - name: "Daily Production" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [ 3036 ] + icon: 'mdi:solar-power' + + - name: "Monthly Production" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [ 3038, 3037 ] + icon: 'mdi:solar-power' + + - name: "Yearly Production" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [ 3040, 3039 ] + icon: 'mdi:solar-power' + + - name: "Cumulative Production" + class: "energy" + state_class: "total" + uom: "kWh" + scale: 0.1 + rule: 3 + registers: [ 3042, 3041 ] + icon: 'mdi:solar-power' + + - group: Power Grid + items: + # Should this be the sum of the 3 phases "Meter Power"? + - name: "Total Grid Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 2 + registers: [ 3100 ] + icon: 'mdi:transmission-tower' + + - name: "Daily Energy Purchased" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [ 3109 ] + icon: 'mdi:transmission-tower-import' + + - name: "Monthly Energy Purchased" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [ 3111, 3110 ] + icon: 'mdi:transmission-tower-import' + + - name: "Yearly Energy Purchased" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [ 3113, 3112 ] + icon: 'mdi:transmission-tower-import' + + - name: "Cumulative Energy Purchased" + class: "energy" + state_class: "total" + uom: "kWh" + scale: 0.1 + rule: 3 + registers: [ 3115, 3114 ] + icon: 'mdi:transmission-tower-import' + + - name: "Daily Energy Feed-In" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [ 3116 ] + icon: 'mdi:transmission-tower-export' + + - name: "Monthly Energy Feed-In" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [ 3118, 3117 ] + icon: 'mdi:transmission-tower-export' + + - name: "Yearly Energy Feed-In" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [ 3120, 3119 ] + icon: 'mdi:transmission-tower-export' + + - name: "Cumulative Grid Feed-In" + class: "energy" + state_class: "total" + uom: "kWh" + scale: 0.1 + rule: 3 + registers: [ 3122, 3121 ] + icon: 'mdi:transmission-tower-export' + + - group: Electricity Consumption + items: + # Should this be the sum of the 3 phases "Load Power"? + - name: "Total Consumption Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 1 + registers: [ 3144 ] + icon: 'mdi:home-lightning-bolt' + + - name: "Daily Consumption" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [ 3147 ] + icon: 'mdi:home-lightning-bolt' + + - name: "Monthly Consumption" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [ 3149, 3148 ] + icon: 'mdi:home-lightning-bolt' + + - name: "Yearly Consumption" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [ 3151, 3150 ] + icon: 'mdi:home-lightning-bolt' + + - name: "Cumulative Consumption" + class: "energy" + state_class: "total" + uom: "kWh" + scale: 0.1 + rule: 3 + registers: [ 3153, 3152 ] + icon: 'mdi:home-lightning-bolt' + + - group: Battery + items: + - name: "Battery Type" + class: "battery" + state_class: "measurement" + uom: '' + scale: 1 + rule: 1 + registers: [ 3062 ] + icon: 'mdi:battery' + lookup: + - key: 1 + value: "Lead-Acid" + - key: 6 + value: "LFP" + + - name: "Battery Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.01 + rule: 1 + registers: [ 3063 ] + icon: 'mdi:battery-charging' + + - name: "Battery Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 2 + registers: [ 3064 ] + icon: 'mdi:battery-charging-10' + + - name: "Battery Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 2 + registers: [ 3065 ] + icon: 'mdi:battery-charging-high' + + - name: "Battery SoC" + class: "battery" + state_class: "measurement" + uom: "%" + scale: 0.1 + rule: 1 + registers: [ 3066 ] + icon: 'mdi:battery' + + - name: "Battery Temperature" + class: "temperature" + state_class: "measurement" + uom: "°C" + scale: 0.1 + rule: 2 + registers: [ 3067 ] + icon: 'mdi:battery-heart-outline' + + - name: "Battery Discharge Capacity Depth" + class: "battery" + state_class: "measurement" + uom: "%" + scale: 1 + rule: 1 + registers: [ 3068 ] + icon: 'mdi:battery-20' + validation: + min: 10 + max: 95 + + - name: "Battery Radiator Temperature" + class: "temperature" + state_class: "measurement" + uom: "°C" + scale: 0.1 + rule: 2 + registers: [ 3056 ] + icon: 'mdi:battery-heart-outline' + + - name: "Battery Total Discharge" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [ 3293, 3292 ] + icon: 'mdi:battery-minus-variant' + + - name: "Battery Daily Discharge" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [ 3294 ] + icon: 'mdi:battery-minus-variant' + + - name: "Battery Total Charge" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [ 3300, 3299 ] + icon: 'mdi:battery-minus-variant' + + - name: "Battery Daily Charge" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [ 3301 ] + icon: 'mdi:battery-plus-variant' + + - group: Inverter Information + items: + - name: "Inverter Working Mode" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 1 + registers: [3044] + lookup: + - key: 0 + value: "Self Consumption" + - key: 1 + value: "Peak Shift" + - key: 2 + value: "Battery Priority" + icon: 'mdi:wrench' + + - name: "Inverter Model" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 1 + registers: [3045] + lookup: + # Single-phase models + - key: 0 + value: "KSE-2K-048S" + - key: 1 + value: "KSE-3K-048S" + - key: 2 + value: "KSE-3.6K-048S" + - key: 3 + value: "KSE-4.6K-048S" + - key: 4 + value: "KSE-5K-048S" + - key: 5 + value: "KSE-3.6K-048" + - key: 6 + value: "KSE-4.6K-048" + - key: 7 + value: "KSE-5K-048" + - key: 8 + value: "KSE-6K-048" + - key: 9 + value: "BluE-S 3680D" + - key: 11 + value: "BluE-S 5000D" + - key: 12 + value: "BluE-S 6000D" + - key: 14 + value: "KSE-3K-048S M1" + - key: 15 + value: "BluE-S 3680D M1" + - key: 17 + value: "BluE-S 5000D M1" + - key: 18 + value: "BluE-S 6000D M1" + # Three-phase models + - key: 32 + value: "E10KT" + - key: 33 + value: "E8KT" + - key: 34 + value: "E12KT" + icon: 'mdi:wrench' + + - name: "System status" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 1 + registers: [3046] + lookup: + - key: 0 + value: "Initialize" + - key: 1 + value: "Stand-by" + - key: 2 + value: "Hybrid Grid" + - key: 3 + value: "Off-Network" + - key: 4 + value: "Mains Charging" + - key: 5 + value: "PV Charging" + - key: 6 + value: "Mains Bypass" + - key: 7 + value: "Fault" + - key: 8 + value: "Debug" + - key: 9 + value: "Forced Charge" + - key: 10 + value: "Power on the device separately from the" + - key: 11 + value: "DSP Burn" + - key: 12 + value: "MCU Burn" + - key: 13 + value: "Permanent Error" + icon: 'mdi:wrench' + + - name: "Inverter status" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 1 + registers: [3047] + lookup: + - key: 0 + value: "Stand-by" + - key: 1 + value: "Off-Grid" + - key: 2 + value: "On-Grid" + - key: 3 + value: "Off-Grid to On-Grid" + - key: 4 + value: "On-Grid to Off-Grid" + icon: 'mdi:wrench' + + - name: "DCDC status" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 1 + registers: [3048] + lookup: + - key: 0 + value: "Stand-by" + - key: 1 + value: "Soft Boot" + - key: 2 + value: "Charging Mode" + - key: 3 + value: "Discharging Mode" + icon: 'mdi:wrench' + + - name: "DSP Alarm Code" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 6 + registers: [3050, 3049] + icon: 'mdi:wrench' + + - name: "DSP Error Code" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 6 + registers: [3052, 3051] + icon: 'mdi:wrench' + + - name: "Grid Standard" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 1 + registers: [3193] + lookup: + - key: 0 + value: "China" + - key: 1 + value: "Germany" + - key: 2 + value: "Australia" + - key: 3 + value: "Italy" + - key: 4 + value: "Spain" + - key: 5 + value: "UK" + - key: 6 + value: "Hungary" + - key: 7 + value: "Belgium" + - key: 8 + value: "West Australia" + - key: 9 + value: "Greece" + - key: 10 + value: "France" + - key: 11 + value: "Bangkok" + - key: 12 + value: "Thailand" + - key: 13 + value: "South Africa" + - key: 14 + value: "EN50549" + - key: 15 + value: "Brazil" + - key: 16 + value: "VDE0126" + - key: 17 + value: "Ireland" + - key: 18 + value: "Israel" + - key: 19 + value: "Poland" + - key: 20 + value: "Chile" + - key: 21 + value: "Local" + icon: 'mdi:wrench' + + - name: "Inverter Model Name" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 5 + registers: [3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207] + icon: 'mdi:wrench' + + - name: "Inverter Battery Name" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 5 + registers: [3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215] + icon: 'mdi:wrench' + + # ARM AND DSP version numbers ("VX.Y.Z") are set in the two bytes on each register. The first byte contains the + # X.Y part (scale 0.1), and the second by contains the Z part. How should we transform these values from a number + # to a parsed string? + - name: "ARM Version Number" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 1 + registers: [3216] + icon: 'mdi:wrench' + + - name: "DSP Version Number" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 1 + registers: [3217] + icon: 'mdi:wrench' + + - name: "Inverter SN Number" + class: "" + state_class: "measurement" + uom: "" + scale: 1 + rule: 5 + registers: [3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238] + icon: 'mdi:wrench' + + - group: Inverter + items: + - name: "Inverter Bus Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [ 3053 ] + icon: 'mdi:home-lightning-bolt' + + - name: "Inverter DC Bus Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [ 3054 ] + icon: 'mdi:home-lightning-bolt' + + - name: "Inverter Radiator Temperature" + class: "temperature" + state_class: "measurement" + uom: "°C" + scale: 0.1 + rule: 2 + registers: [ 3055 ] + icon: 'mdi:thermometer' + + - name: "Chassis Internal Temperature" + class: "temperature" + state_class: "measurement" + uom: "°C" + scale: 0.1 + rule: 2 + registers: [ 3057 ] + icon: 'mdi:battery-heart-outline' + + # Different phases for 3-phase inverters. Only some models have 3 phases, see "Inverter Model" item + # - R: Referent + # - S: Secondary + # - T: Tertiary + - group: R Phase + items: + - name: "R-phase Grid Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [ 3097 ] + icon: 'mdi:home-lightning-bolt' + + - name: "R-phase Grid Frequency" + class: "frequency" + state_class: "measurement" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [ 3098 ] + icon: 'mdi:sine-wave' + + - name: "R-phase Meter Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.001 + rule: 2 + registers: [ 3099 ] + icon: 'mdi:home-lightning-bolt' + + - name: "R-phase Grid Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 2 + registers: [ 3100 ] + icon: 'mdi:home-lightning-bolt' + + - name: "R-phase Inverter Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [ 3123 ] + icon: 'mdi:home-lightning-bolt' + + - name: "R-phase Inverter Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 2 + registers: [ 3124 ] + icon: 'mdi:home-lightning-bolt' + + - name: "R-phase Inverter Frequency" + class: "frequency" + state_class: "measurement" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [ 3125 ] + icon: 'mdi:sine-wave' + + - name: "R-phase Inverter Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 2 + registers: [ 3126 ] + icon: 'mdi:home-lightning-bolt' + + - name: "R-phase Backup Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [ 3135 ] + icon: 'mdi:home-lightning-bolt' + + - name: "R-phase Backup Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 1 + registers: [ 3136 ] + icon: 'mdi:home-lightning-bolt' + + - name: "R-phase Backup Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 1 + registers: [ 3137 ] + icon: 'mdi:home-lightning-bolt' + + - name: "R-phase Load Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 1 + registers: [ 3144 ] + icon: 'mdi:home-lightning-bolt' diff --git a/custom_components/solarman/inverter_definitions/sofar_g3hyd.yaml b/custom_components/solarman/inverter_definitions/sofar_g3hyd.yaml index 43ca7b6..6a010be 100644 --- a/custom_components/solarman/inverter_definitions/sofar_g3hyd.yaml +++ b/custom_components/solarman/inverter_definitions/sofar_g3hyd.yaml @@ -1,5 +1,6 @@ # Sofar G3 also HYD 5-20KTL-3PH -# some value commented after month no change +# This works also for rebranded ZCS Azzurro 3-Phase inverters such as the 3PH HYD6000 ZSS +# Note that this won't work if your ZCS inverter is connected via Connext, you have to be using a Wi-Fi or Ethernet Kit such as ZSM-WIFI-USB. requests: - start: 0x0404 end: 0x0420 @@ -21,6 +22,7 @@ requests: end: 0x069B mb_functioncode: 0x03 parameters: + - group: Inverter items: - name: "Inverter status" @@ -56,6 +58,13 @@ parameters: rule: 2 registers: [ 0x0418 ] icon: 'mdi:thermometer' + - name: "Ambient temperature 2" + class: "temperature" + uom: "°C" + scale: 1 + rule: 2 + registers: [ 0x0419 ] + icon: 'mdi:thermometer' - name: "Radiator temperature 1" class: "temperature" uom: "°C" @@ -63,6 +72,41 @@ parameters: rule: 2 registers: [ 0x041A ] icon: 'mdi:thermometer' + - name: "Radiator temperature 2" + class: "temperature" + uom: "°C" + scale: 1 + rule: 2 + registers: [ 0x041B ] + icon: 'mdi:thermometer' + - name: "Radiator temperature 3" + class: "temperature" + uom: "°C" + scale: 1 + rule: 2 + registers: [ 0x041C ] + icon: 'mdi:thermometer' + - name: "Radiator temperature 4" + class: "temperature" + uom: "°C" + scale: 1 + rule: 2 + registers: [ 0x041D ] + icon: 'mdi:thermometer' + - name: "Radiator temperature 5" + class: "temperature" + uom: "°C" + scale: 1 + rule: 2 + registers: [ 0x041E ] + icon: 'mdi:thermometer' + - name: "Radiator temperature 6" + class: "temperature" + uom: "°C" + scale: 1 + rule: 2 + registers: [ 0x041F ] + icon: 'mdi:thermometer' - name: "Module temperature 1" class: "temperature" uom: "°C" @@ -70,35 +114,47 @@ parameters: rule: 2 registers: [ 0x0420 ] icon: 'mdi:thermometer' + - name: "Module temperature 2" + class: "temperature" + uom: "°C" + scale: 1 + rule: 2 + registers: [ 0x0421 ] + icon: 'mdi:thermometer' + - name: "Module temperature 3" + class: "temperature" + uom: "°C" + scale: 1 + rule: 2 + registers: [ 0x0422 ] + icon: 'mdi:thermometer' + - group: InverterDC items: - - name: "PV1 Power" - class: "power" + - name: "PV1 Voltage" + class: "voltage" state_class: "measurement" - uom: "W" - scale: 10 + uom: "V" + scale: 0.1 rule: 1 - registers: [ 0x0586 ] + registers: [ 0x0584 ] icon: 'mdi:solar-power' - - - name: "PV2 Power" - class: "power" + - name: "PV1 Current" + class: "current" state_class: "measurement" - uom: "W" - scale: 10 + uom: "A" + scale: 0.01 rule: 1 - registers: [ 0x0589 ] + registers: [ 0x0585 ] icon: 'mdi:solar-power' - - - name: "PV1 Voltage" - class: "voltage" + - name: "PV1 Power" + class: "power" state_class: "measurement" - uom: "V" - scale: 0.1 + uom: "W" + scale: 10 rule: 1 - registers: [ 0x0584 ] + registers: [ 0x0586 ] icon: 'mdi:solar-power' - - name: "PV2 Voltage" class: "voltage" state_class: "measurement" @@ -107,27 +163,42 @@ parameters: rule: 1 registers: [ 0x0587 ] icon: 'mdi:solar-power' - - - name: "PV1 Current" + - name: "PV2 Current" class: "current" state_class: "measurement" uom: "A" scale: 0.01 rule: 1 - registers: [ 0x0585 ] + registers: [ 0x0588 ] icon: 'mdi:solar-power' - - - name: "PV2 Current" - class: "current" + - name: "PV2 Power" + class: "power" state_class: "measurement" - uom: "A" - scale: 0.01 + uom: "W" + scale: 10 rule: 1 - registers: [ 0x0588 ] + registers: [ 0x0589 ] icon: 'mdi:solar-power' + - group: Battery items: - - name: "Battery Power" + - name: "Battery 1 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [ 0x0604 ] + icon: 'mdi:battery' + - name: "Battery 1 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 2 + registers: [ 0x0605 ] + icon: 'mdi:current-dc' + - name: "Battery 1 Power" class: "power" state_class: "measurement" uom: "W" @@ -135,8 +206,15 @@ parameters: rule: 2 registers: [ 0x0606 ] icon: 'mdi:battery-charging' - - - name: "Battery SOC" + - name: "Battery 1 Temperature" + class: "temperature" + state_class: "measurement" + uom: "°C" + scale: 1 + rule: 2 + registers: [ 0x0607 ] + icon: 'mdi:battery' + - name: "Battery 1 SOC" class: "battery" state_class: "measurement" uom: "%" @@ -144,8 +222,7 @@ parameters: rule: 1 registers: [ 0x0608 ] icon: 'mdi:battery' - - - name: "Battery SOH" + - name: "Battery 1 SOH" class: "battery" state_class: "measurement" uom: "%" @@ -153,42 +230,72 @@ parameters: rule: 1 registers: [ 0x0609 ] icon: 'mdi:battery' - - - name: "Battery Current" - class: "current" + - name: "Battery 1 Number of Cycles" + class: "" state_class: "measurement" - uom: "A" - scale: 0.01 - rule: 2 - registers: [ 0x0605 ] - icon: 'mdi:current-dc' - - - name: "Battery Voltage" + uom: "cycle" + scale: 1 + rule: 1 + registers: [ 0x060A ] + icon: 'mdi:battery' + - name: "Battery 2 Voltage" class: "voltage" state_class: "measurement" uom: "V" scale: 0.1 rule: 1 - registers: [ 0x0604 ] + registers: [ 0x060B ] icon: 'mdi:battery' - - - name: "Battery Temperature" + - name: "Battery 2 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 2 + registers: [ 0x060C ] + icon: 'mdi:current-dc' + - name: "Battery 2 Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x060D ] + icon: 'mdi:battery-charging' + - name: "Battery 2 Temperature" class: "temperature" state_class: "measurement" uom: "°C" scale: 1 rule: 2 - registers: [ 0x0607 ] + registers: [ 0x060E ] icon: 'mdi:battery' - - name: "Battery Number of Cycles" + - name: "Battery 2 SOC" + class: "battery" + state_class: "measurement" + uom: "%" + scale: 1 + rule: 1 + registers: [ 0x060F ] + icon: 'mdi:battery' + - name: "Battery 2 SOH" + class: "battery" + state_class: "measurement" + uom: "%" + scale: 1 + rule: 1 + registers: [ 0x0610 ] + icon: 'mdi:battery' + - name: "Battery 2 Number of Cycles" class: "" state_class: "measurement" uom: "cycle" scale: 1 rule: 1 - registers: [ 0x060A ] + registers: [ 0x0611 ] icon: 'mdi:battery' - - group: Grid + + - group: GridAC items: - name: "Grid Frequency" class: "current" @@ -214,14 +321,14 @@ parameters: rule: 2 registers: [ 0x0486 ] icon: 'mdi:home-lightning-bolt' -# - name: "ApparentPower_Output_Total" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 10 -# rule: 2 -# registers: [ 0x0487 ] -# icon: 'mdi:home-lightning-bolt' + - name: "ApparentPower_Output_Total" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x0487 ] + icon: 'mdi:home-lightning-bolt' - name: "ActivePower_PCC_Total" class: "power" state_class: "measurement" @@ -230,22 +337,22 @@ parameters: rule: 2 registers: [ 0x0488 ] icon: 'mdi:home-lightning-bolt' -# - name: "ReactivePower_PCC_Total" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 10 -# rule: 2 -# registers: [ 0x0489 ] -# icon: 'mdi:home-lightning-bolt' -# - name: "ApparentPower_PCC_Total" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 10 -# rule: 2 -# registers: [ 0x048A ] -# icon: 'mdi:home-lightning-bolt' + - name: "ReactivePower_PCC_Total" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x0489 ] + icon: 'mdi:home-lightning-bolt' + - name: "ApparentPower_PCC_Total" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x048A ] + icon: 'mdi:home-lightning-bolt' - name: "Voltage_Phase_R" class: "voltage" state_class: "measurement" @@ -270,22 +377,22 @@ parameters: rule: 2 registers: [ 0x048F ] icon: 'mdi:lightning-bolt-outline' -# - name: "ReactivePower_Output_R" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 10 -# rule: 2 -# registers: [ 0x0490 ] -# icon: 'mdi:lightning-bolt-outline' -# - name: "PowerFactor_Output_R" -# class: "powerfactor" -# state_class: "measurement" -# uom: "p.u." -# scale: 0.001 -# rule: 2 -# registers: [ 0x0491 ] -# icon: 'mdi:lightning-bolt-outline' + - name: "ReactivePower_Output_R" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x0490 ] + icon: 'mdi:lightning-bolt-outline' + - name: "PowerFactor_Output_R" + class: "powerfactor" + state_class: "measurement" + uom: "p.u." + scale: 0.001 + rule: 2 + registers: [ 0x0491 ] + icon: 'mdi:lightning-bolt-outline' - name: "Current_PCC_R" class: "current" state_class: "measurement" @@ -294,30 +401,30 @@ parameters: rule: 1 registers: [ 0x0492 ] icon: 'mdi:lightning-bolt-outline' -# - name: "ActivePower_PCC_R" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 10 -# rule: 2 -# registers: [ 0x0493 ] -# icon: 'mdi:lightning-bolt-outline' -# - name: "ReactivePower_PCC_R" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 10 -# rule: 2 -# registers: [ 0x0494 ] -# icon: 'mdi:lightning-bolt-outline' -# - name: "PowerFactor_PCC_R" -# class: "powerfactor" -# state_class: "measurement" -# uom: "p.u." -# scale: 0.001 -# rule: 2 -# registers: [ 0x0495 ] -# icon: 'mdi:lightning-bolt-outline' + - name: "ActivePower_PCC_R" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x0493 ] + icon: 'mdi:lightning-bolt-outline' + - name: "ReactivePower_PCC_R" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x0494 ] + icon: 'mdi:lightning-bolt-outline' + - name: "PowerFactor_PCC_R" + class: "powerfactor" + state_class: "measurement" + uom: "p.u." + scale: 0.001 + rule: 2 + registers: [ 0x0495 ] + icon: 'mdi:lightning-bolt-outline' - name: "Voltage_Phase_S" class: "voltage" state_class: "measurement" @@ -342,22 +449,22 @@ parameters: rule: 2 registers: [ 0x049A ] icon: 'mdi:lightning-bolt-outline' -## - name: "ReactivePower_Output_S" -## class: "power" -## state_class: "measurement" -## uom: "W" -## scale: 10 -## rule: 2 -## registers: [ 0x049B ] -## icon: 'mdi:lightning-bolt-outline' -# - name: "PowerFactor_Output_S" -# class: "powerfactor" -# state_class: "measurement" -# uom: "p.u." -# scale: 0.001 -# rule: 2 -# registers: [ 0x049C ] -# icon: 'mdi:lightning-bolt-outline' + - name: "ReactivePower_Output_S" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x049B ] + icon: 'mdi:lightning-bolt-outline' + - name: "PowerFactor_Output_S" + class: "powerfactor" + state_class: "measurement" + uom: "p.u." + scale: 0.001 + rule: 2 + registers: [ 0x049C ] + icon: 'mdi:lightning-bolt-outline' - name: "Current_PCC_S" class: "current" state_class: "measurement" @@ -366,30 +473,30 @@ parameters: rule: 1 registers: [ 0x049D ] icon: 'mdi:lightning-bolt-outline' -# - name: "ActivePower_PCC_S" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 10 -# rule: 2 -# registers: [ 0x049E ] -# icon: 'mdi:lightning-bolt-outline' -# - name: "ReactivePower_PCC_S" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 10 -# rule: 2 -# registers: [ 0x049F ] -# icon: 'mdi:lightning-bolt-outline' -# - name: "PowerFactor_PCC_S" -# class: "powerfactor" -# state_class: "measurement" -# uom: "p.u." -# scale: 0.001 -# rule: 2 -# registers: [ 0x04A0 ] -# icon: 'mdi:lightning-bolt-outline' + - name: "ActivePower_PCC_S" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x049E ] + icon: 'mdi:lightning-bolt-outline' + - name: "ReactivePower_PCC_S" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x049F ] + icon: 'mdi:lightning-bolt-outline' + - name: "PowerFactor_PCC_S" + class: "powerfactor" + state_class: "measurement" + uom: "p.u." + scale: 0.001 + rule: 2 + registers: [ 0x04A0 ] + icon: 'mdi:lightning-bolt-outline' - name: "Voltage_Phase_T" class: "voltage" state_class: "measurement" @@ -414,22 +521,22 @@ parameters: rule: 2 registers: [ 0x04A5 ] icon: 'mdi:lightning-bolt-outline' -# - name: "ReactivePower_Output_T" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 10 -# rule: 2 -# registers: [ 0x04A6 ] -# icon: 'mdi:lightning-bolt-outline' -# - name: "PowerFactor_Output_T" -# class: "powerfactor" -# state_class: "measurement" -# uom: "p.u." -# scale: 0.001 -# rule: 2 -# registers: [ 0x04A7 ] -# icon: 'mdi:lightning-bolt-outline' + - name: "ReactivePower_Output_T" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x04A6 ] + icon: 'mdi:lightning-bolt-outline' + - name: "PowerFactor_Output_T" + class: "powerfactor" + state_class: "measurement" + uom: "p.u." + scale: 0.001 + rule: 2 + registers: [ 0x04A7 ] + icon: 'mdi:lightning-bolt-outline' - name: "Current_PCC_T" class: "current" state_class: "measurement" @@ -438,38 +545,38 @@ parameters: rule: 1 registers: [ 0x04A8 ] icon: 'mdi:lightning-bolt-outline' -# - name: "ActivePower_PCC_T" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 10 -# rule: 2 -# registers: [ 0x04A9 ] -# icon: 'mdi:lightning-bolt-outline' -# - name: "ReactivePower_PCC_T" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 10 -# rule: 2 -# registers: [ 0x04AA ] -# icon: 'mdi:lightning-bolt-outline' -# - name: "PowerFactor_PCC_T" -# class: "powerfactor" -# state_class: "measurement" -# uom: "p.u." -# scale: 0.001 -# rule: 2 -# registers: [ 0x04AB ] -# icon: 'mdi:lightning-bolt-outline' -# - name: "ActivePower_PV_Ext" -# class: "power" -# state_class: "measurement" -# uom: "W" -# scale: 10 -# rule: 1 -# registers: [ 0x04AE ] -# icon: 'mdi:lightning-bolt-outline' + - name: "ActivePower_PCC_T" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x04A9 ] + icon: 'mdi:lightning-bolt-outline' + - name: "ReactivePower_PCC_T" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x04AA ] + icon: 'mdi:lightning-bolt-outline' + - name: "PowerFactor_PCC_T" + class: "powerfactor" + state_class: "measurement" + uom: "p.u." + scale: 0.001 + rule: 2 + registers: [ 0x04AB ] + icon: 'mdi:lightning-bolt-outline' + - name: "ActivePower_PV_Ext" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 1 + registers: [ 0x04AE ] + icon: 'mdi:lightning-bolt-outline' - name: "ActivePower_Load_Sys" class: "power" state_class: "measurement" @@ -478,9 +585,189 @@ parameters: rule: 2 registers: [ 0x04AF ] icon: 'mdi:lightning-bolt-outline' + + - group: GridEPS + items: + - name: "ActivePower_Load_Total_EPS" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x0504 ] + icon: 'mdi:home-lightning-bolt' + - name: "ReactivePower_Load_Total_EPS" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x0505 ] + icon: 'mdi:home-lightning-bolt' + - name: "ApparentPower_Load_Total_EPS" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x0506 ] + icon: 'mdi:home-lightning-bolt' + - name: "Frequency_Output_EPS" + class: "current" + state_class: "measurement" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [ 0x0507 ] + icon: 'mdi:home-lightning-bolt' + - name: "Voltage_Output_R_EPS" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [ 0x050A ] + icon: 'mdi:lightning-bolt-outline' + - name: "Current_Load_R_EPS" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 1 + registers: [ 0x050B ] + icon: 'mdi:lightning-bolt-outline' + - name: "ActivePower_Load_R_EPS" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x050C ] + icon: 'mdi:lightning-bolt-outline' + - name: "ReactivePower_Load_R_EPS" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x050D ] + icon: 'mdi:lightning-bolt-outline' + - name: "ApparentPower_Load_R_EPS" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x050E ] + icon: 'mdi:home-lightning-bolt' + - name: "LoadPeakRatio_R_EPS" + class: "powerfactor" + state_class: "measurement" + uom: "p.u." + scale: 0.01 + rule: 2 + registers: [ 0x050F ] + icon: 'mdi:lightning-bolt-outline' + - name: "Voltage_Output_S_EPS" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [ 0x0512 ] + icon: 'mdi:lightning-bolt-outline' + - name: "Current_Load_S_EPS" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 1 + registers: [ 0x0513 ] + icon: 'mdi:lightning-bolt-outline' + - name: "ActivePower_Load_S_EPS" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x0514 ] + icon: 'mdi:lightning-bolt-outline' + - name: "ReactivePower_Load_S_EPS" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x0515 ] + icon: 'mdi:lightning-bolt-outline' + - name: "ApparentPower_Load_S_EPS" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x0516 ] + icon: 'mdi:home-lightning-bolt' + - name: "LoadPeakRatio_S_EPS" + class: "powerfactor" + state_class: "measurement" + uom: "p.u." + scale: 0.01 + rule: 2 + registers: [ 0x0517 ] + icon: 'mdi:lightning-bolt-outline' + - name: "Voltage_Output_T_EPS" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [ 0x051A ] + icon: 'mdi:lightning-bolt-outline' + - name: "Current_Load_T_EPS" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.01 + rule: 1 + registers: [ 0x051B ] + icon: 'mdi:lightning-bolt-outline' + - name: "ActivePower_Load_T_EPS" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x051C ] + icon: 'mdi:lightning-bolt-outline' + - name: "ReactivePower_Load_T_EPS" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x051D ] + icon: 'mdi:lightning-bolt-outline' + - name: "ApparentPower_Load_T_EPS" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [ 0x051E ] + icon: 'mdi:home-lightning-bolt' + - name: "LoadPeakRatio_T_EPS" + class: "powerfactor" + state_class: "measurement" + uom: "p.u." + scale: 0.01 + rule: 2 + registers: [ 0x051F ] + icon: 'mdi:lightning-bolt-outline' + - group: Generation items: - - name: "PV Generation today" + - name: "Daily PV Generation" class: "energy" state_class: "total_increasing" uom: "kWh" @@ -488,7 +775,7 @@ parameters: rule: 3 registers: [ 0x0685,0x0684 ] icon: 'mdi:solar-power' - - name: "PV generation total" + - name: "Total PV Generation" class: "energy" state_class: "total_increasing" uom: "kWh" @@ -496,7 +783,7 @@ parameters: rule: 3 registers: [ 0x0687,0x0686 ] icon: 'mdi:solar-power' - - name: "Load consumption today" + - name: "Daily Load Consumption" class: "energy" state_class: "total_increasing" uom: "kWh" @@ -504,7 +791,7 @@ parameters: rule: 3 registers: [ 0x0689,0x0688 ] icon: 'mdi:lightning-bolt-outline' - - name: "Load consumption total" + - name: "Total Load Consumption" class: "energy" state_class: "total_increasing" uom: "kWh" @@ -512,7 +799,6 @@ parameters: rule: 3 registers: [ 0x068B,0x068A ] icon: 'mdi:solar-power' - - name: "Daily Energy Bought" class: "energy" state_class: "total_increasing" @@ -521,7 +807,6 @@ parameters: rule: 3 registers: [ 0x068D,0x068C ] icon: 'mdi:transmission-tower-export' - - name: "Total Energy Bought" class: "energy" state_class: "total_increasing" @@ -530,7 +815,6 @@ parameters: rule: 3 registers: [ 0x068F,0x068E ] icon: 'mdi:transmission-tower-export' - - name: "Daily Energy Sold" class: "energy" state_class: "total_increasing" @@ -539,7 +823,6 @@ parameters: rule: 3 registers: [ 0x0691,0x0690 ] icon: 'mdi:transmission-tower-import' - - name: "Total Energy Sold" class: "energy" state_class: "total_increasing" @@ -548,7 +831,6 @@ parameters: rule: 3 registers: [ 0x0693,0x0692 ] icon: 'mdi:transmission-tower-import' - - name: "Daily Battery Charge" class: "energy" state_class: "total_increasing" @@ -581,6 +863,7 @@ parameters: rule: 3 registers: [ 0x069b,0x069A ] icon: 'mdi:battery-minus' + - group: Alert items: - name: "Alert" @@ -1121,4 +1404,4 @@ parameters: - key: 16384 value: 'ID191 PID repair failed' - key: 32768 - value: 'ID192 PLC module heartbeat loss' \ No newline at end of file + value: 'ID192 PLC module heartbeat loss' diff --git a/custom_components/solarman/inverter_definitions/sofar_hyd3k-6k-es.yaml b/custom_components/solarman/inverter_definitions/sofar_hyd3k-6k-es.yaml index a6d4bcb..150a1e9 100644 --- a/custom_components/solarman/inverter_definitions/sofar_hyd3k-6k-es.yaml +++ b/custom_components/solarman/inverter_definitions/sofar_hyd3k-6k-es.yaml @@ -14,7 +14,7 @@ parameters: - group: solar items: - name: "PV Instant Generated PW" - class: "energy" + class: "power" state_class: "measurement" uom: "kW" scale: 0.01 @@ -143,16 +143,16 @@ parameters: - name: "Total Grid Return" class: "energy" state_class: "total" - uom: "KWh" + uom: "kWh" scale: 1 rule: 3 registers: [0x021F,0x021E] icon: 'mdi:transmission-tower-export' - name: "Total Grid Consumption" - class: "Energy" + class: "energy" state_class: "total" - uom: "KWh" + uom: "kWh" scale: 1 rule: 3 registers: [0x0221,0x0220] @@ -161,7 +161,7 @@ parameters: - name: "Total Power Consumption" class: "energy" state_class: "total" - uom: "KWh" + uom: "kWh" scale: 1 rule: 3 registers: [0x0223,0x0222] @@ -173,7 +173,7 @@ parameters: - name: "Power Consumption" class: "" state_class: "" - uom: "KW" + uom: "kW" scale: 0.01 rule: 1 registers: [0x0213] @@ -303,7 +303,7 @@ parameters: - name: "Battery Power" class: "power" state_class: "measurement" - uom: "KW" + uom: "kW" scale: 0.01 rule: 2 registers: [0x0237] @@ -327,7 +327,7 @@ parameters: registers: [0x10B1] icon: 'mdi:battery' - - name: "Battery daily Discharge" + - name: "Battery Daily Discharge" class: "energy" state_class: "total_increasing" uom: "kWh" @@ -339,7 +339,7 @@ parameters: - name: "Battery Total Charge" class: "energy" state_class: "total" - uom: "KWh" + uom: "kWh" scale: 1 rule: 3 registers: [0x0227,0x0226] @@ -348,7 +348,7 @@ parameters: - name: "Battery Total Discharge" class: "energy" state_class: "total" - uom: "KWh" + uom: "kWh" scale: 1 rule: 3 registers: [0x0229,0x0228] @@ -448,11 +448,11 @@ parameters: items: - name: "Inverter status" class: "" - state_class: "measurement" uom: "" scale: 1 rule: 1 registers: [0x0200] + isstr: true lookup: - key: 0 value: "Stand-by" @@ -572,11 +572,11 @@ parameters: - name: "Country" class: "" - state_class: "" uom: "" scale: 1 rule: 1 registers: [0x023A] + isstr: true lookup: - key: 0 value: "Germany" @@ -649,6 +649,7 @@ parameters: scale: 1 rule: 1 registers: [0x022B] + isstr: true lookup: - key: 0 value: "No error" @@ -707,7 +708,7 @@ parameters: - key: 30 value: "ID30 Bunk current is too high" - key: 31 - value: "ID31 The ouput current is too high" + value: "ID31 The output current is too high" - key: 32 value: "ID32 The input current is too high" - key: 33 @@ -803,6 +804,7 @@ parameters: scale: 1 rule: 1 registers: [0x0201] + isstr: true lookup: - key: 0 value: "No error" @@ -848,6 +850,7 @@ parameters: scale: 1 rule: 1 registers: [0x0202] + isstr: true lookup: - key: 0 value: "No error" @@ -892,6 +895,7 @@ parameters: scale: 1 rule: 1 registers: [0x0203] + isstr: true lookup: - key: 0 value: "No error" @@ -936,6 +940,7 @@ parameters: scale: 1 rule: 1 registers: [0x0204] + isstr: true lookup: - key: 0 value: "No error" @@ -980,6 +985,7 @@ parameters: scale: 1 rule: 1 registers: [0x0205] + isstr: true lookup: - key: 0 value: "No error" @@ -1059,7 +1065,7 @@ parameters: - name: "Charge / Discharge Power" class: "" state_class: "" - uom: "KW" + uom: "kW" scale: 0.01 rule: 2 registers: [0x020D] @@ -1068,7 +1074,7 @@ parameters: - name: "Feed in / out power" class: "" state_class: "" - uom: "KW" + uom: "kW" scale: 0.01 rule: 2 registers: [0x0212] @@ -1077,7 +1083,7 @@ parameters: - name: "Input/Output Power" class: "power" state_class: "measurement" - uom: "KW" + uom: "kW" scale: 0.01 rule: 2 registers: [0x0214] @@ -1144,4 +1150,4 @@ parameters: scale: 0.01 rule: 1 registers: [0x0235] - icon: 'mdi:lightning-bolt' \ No newline at end of file + icon: 'mdi:lightning-bolt' diff --git a/custom_components/solarman/inverter_definitions/sofar_lsw3.yaml b/custom_components/solarman/inverter_definitions/sofar_lsw3.yaml index 7edc3eb..d7aaf7f 100644 --- a/custom_components/solarman/inverter_definitions/sofar_lsw3.yaml +++ b/custom_components/solarman/inverter_definitions/sofar_lsw3.yaml @@ -6,10 +6,10 @@ requests: parameters: - group: solar - items: + items: - name: "PV1 Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 10 rule: 1 @@ -18,7 +18,7 @@ parameters: - name: "PV2 Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 10 rule: 1 @@ -27,81 +27,81 @@ parameters: - name: "PV1 Voltage" class: "voltage" - state_class: "measurement" + state_class: "measurement" uom: "V" scale: 0.1 - rule: 1 + rule: 1 registers: [0x0006] icon: 'mdi:solar-power' - name: "PV2 Voltage" - class: "voltage" - state_class: "measurement" + class: "voltage" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 registers: [0x0008] - icon: 'mdi:solar-power' + icon: 'mdi:solar-power' - name: "PV1 Current" class: "current" - state_class: "measurement" + state_class: "measurement" uom: "A" scale: 0.01 rule: 1 registers: [0x0007] - icon: 'mdi:solar-power' + icon: 'mdi:solar-power' - name: "PV2 Current" class: "current" - state_class: "measurement" + state_class: "measurement" uom: "A" scale: 0.01 rule: 1 registers: [0x0009] - icon: 'mdi:solar-power' + icon: 'mdi:solar-power' - name: "Daily Production" class: "energy" - state_class: "total" + state_class: "total_increasing" uom: "kWh" scale: 0.01 rule: 1 registers: [0x0019] - icon: 'mdi:solar-power' + icon: 'mdi:solar-power' - name: "Total Production" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 1 rule: 3 registers: [0x0016,0x0015] - icon: 'mdi:solar-power' + icon: 'mdi:solar-power' - name: "Total generation time" class: "" - state_class: "measurement" + state_class: "measurement" uom: "h" scale: 1 rule: 3 registers: [0x0018,0x0017] - icon: 'mdi:clock-outline' + icon: 'mdi:clock-outline' - name: "Today generation time" class: "" - state_class: "measurement" + state_class: "measurement" uom: "min" scale: 1 rule: 1 registers: [0x001A] - icon: 'mdi:clock-outline' + icon: 'mdi:clock-outline' - group: Output - items: + items: - name: "Output active power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 10 rule: 1 @@ -110,7 +110,7 @@ parameters: - name: "Output reactive power" class: "" - state_class: "measurement" + state_class: "measurement" uom: "kVar" scale: 0.01 rule: 1 @@ -119,7 +119,7 @@ parameters: - name: "Grid frequency" class: "frequency" - state_class: "measurement" + state_class: "measurement" uom: "Hz" scale: 0.01 rule: 1 @@ -128,7 +128,7 @@ parameters: - name: "L1 Voltage" class: "voltage" - state_class: "measurement" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 @@ -137,7 +137,7 @@ parameters: - name: "L1 Current" class: "current" - state_class: "measurement" + state_class: "measurement" uom: "A" scale: 0.01 rule: 1 @@ -146,7 +146,7 @@ parameters: - name: "L2 Voltage" class: "voltage" - state_class: "measurement" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 @@ -155,7 +155,7 @@ parameters: - name: "L2 Current" class: "current" - state_class: "measurement" + state_class: "measurement" uom: "A" scale: 0.01 rule: 1 @@ -164,7 +164,7 @@ parameters: - name: "L3 Voltage" class: "voltage" - state_class: "measurement" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 @@ -173,7 +173,7 @@ parameters: - name: "L3 Current" class: "current" - state_class: "measurement" + state_class: "measurement" uom: "A" scale: 0.01 rule: 1 @@ -181,15 +181,15 @@ parameters: icon: 'mdi:home-lightning-bolt' - group: Inverter - items: + items: - name: "Inverter status" class: "" - state_class: "measurement" + state_class: "measurement" uom: "" scale: 1 rule: 1 registers: [0x0000] - lookup: + lookup: - key: 0 value: "Stand-by" - key: 1 @@ -200,7 +200,7 @@ parameters: value: "FAULT" - key: 4 value: "Permanent" - icon: 'mdi:wrench' + icon: 'mdi:wrench' - name: "Inverter module temperature" class: "temperature" @@ -212,16 +212,16 @@ parameters: - name: "Inverter inner temperature" class: "temperature" - state_class: "measurement" + state_class: "measurement" uom: "°C" scale: 1 rule: 1 registers: [0x001C] - icon: 'mdi:thermometer' + icon: 'mdi:thermometer' - name: "Inverter bus voltage" class: "voltage" - state_class: "measurement" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 @@ -230,7 +230,7 @@ parameters: - name: "PV1 voltage sample by slave CPU" class: "voltage" - state_class: "measurement" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 @@ -239,7 +239,7 @@ parameters: - name: "PV1 current sample by slave CPU" class: "current" - state_class: "measurement" + state_class: "measurement" uom: "A" scale: 0.1 rule: 1 @@ -248,7 +248,7 @@ parameters: - name: "Countdown time" class: "" - state_class: "measurement" + state_class: "measurement" uom: "s" scale: 1 rule: 1 @@ -257,7 +257,7 @@ parameters: - name: "Inverter alert message" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 @@ -266,7 +266,7 @@ parameters: - name: "Input mode" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 @@ -275,7 +275,7 @@ parameters: - name: "Communication Board inner message" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 @@ -284,7 +284,7 @@ parameters: - name: "Insulation of PV1+ to ground" class: "" - state_class: "measurement" + state_class: "measurement" uom: "" scale: 1 rule: 1 @@ -293,7 +293,7 @@ parameters: - name: "Insulation of PV2+ to ground" class: "" - state_class: "measurement" + state_class: "measurement" uom: "" scale: 1 rule: 1 @@ -302,7 +302,7 @@ parameters: - name: "Insulation of PV- to ground" class: "" - state_class: "measurement" + state_class: "measurement" uom: "" scale: 1 rule: 1 @@ -311,12 +311,12 @@ parameters: - name: "Country" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x0027] - lookup: + lookup: - key: 0 value: "Germany" - key: 1 @@ -380,15 +380,15 @@ parameters: icon: '' - group: Alert - items: + items: - name: "Fault 1" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x0001] - lookup: + lookup: - key: 0 value: "No error" - key: 1 @@ -423,16 +423,16 @@ parameters: value: "ID15 Hardware AC over current protection" - key: 32768 value: "ID16 Grid current is too high" - icon: 'mdi:wrench' + icon: 'mdi:wrench' - name: "Fault 2" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x0002] - lookup: + lookup: - key: 0 value: "No error" - key: 1 @@ -467,16 +467,16 @@ parameters: value: "ID31" - key: 32768 value: "ID32" - icon: 'mdi:wrench' + icon: 'mdi:wrench' - name: "Fault 3" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x0003] - lookup: + lookup: - key: 0 value: "No error" - key: 1 @@ -511,16 +511,16 @@ parameters: value: "ID47 Reserved" - key: 32768 value: "ID48 Reserved" - icon: 'mdi:wrench' + icon: 'mdi:wrench' - name: "Fault 4" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x0004] - lookup: + lookup: - key: 0 value: "No error" - key: 1 @@ -555,16 +555,16 @@ parameters: value: "ID63 Reserved" - key: 32768 value: "ID64 Reserved" - icon: 'mdi:wrench' + icon: 'mdi:wrench' - name: "Fault 5" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x0005] - lookup: + lookup: - key: 0 value: "No error" - key: 1 @@ -599,4 +599,4 @@ parameters: value: "ID79 Reserved" - key: 32768 value: "ID80 Reserved" - icon: 'mdi:wrench' + icon: 'mdi:wrench' diff --git a/custom_components/solarman/inverter_definitions/sofar_wifikit.yaml b/custom_components/solarman/inverter_definitions/sofar_wifikit.yaml index 050233f..66f2f3b 100644 --- a/custom_components/solarman/inverter_definitions/sofar_wifikit.yaml +++ b/custom_components/solarman/inverter_definitions/sofar_wifikit.yaml @@ -225,21 +225,21 @@ parameters: - name: "Battery Temperature" class: "temperature" - state_class: "measurement" + state_class: "measurement" uom: "°C" scale: 1 rule: 1 registers: [0x0211] - icon: 'mdi:thermometer' + icon: 'mdi:thermometer' - name: "Battery Capacity" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x10B1] - icon: 'mdi:battery-high' + icon: 'mdi:battery-high' - name: "Battery Max Charge Voltage" class: "voltage" @@ -276,7 +276,7 @@ parameters: rule: 2 registers: [0x10B7] icon: 'mdi:current-dc' - + - name: "Battery Discharge Depth" class: "battery" state_class: "measurement" @@ -284,7 +284,7 @@ parameters: scale: 1 rule: 1 registers: [0x10B9] - icon: 'mdi:battery-high' + icon: 'mdi:battery-high' - name: "Battery Empty Voltage" class: "voltage" @@ -306,7 +306,7 @@ parameters: - name: "Battery Type" class: "" - state_class: "measurement" + state_class: "measurement" uom: "" scale: 1 rule: 1 @@ -321,7 +321,7 @@ parameters: # and need to use a custom inverter # definition with the commented lookups # below. - lookup: + lookup: - key: 0x0000 value: "DARFON" - key: 0x0001 @@ -349,15 +349,15 @@ parameters: # value: "DEFAULT" - group: InverterStatus - items: + items: - name: "Inverter Status" class: "" - state_class: "measurement" + state_class: "measurement" uom: "" scale: 1 rule: 1 registers: [0x200] - lookup: + lookup: - key: 0 value: "Wait" - key: 1 @@ -374,29 +374,29 @@ parameters: value: "Fault" - key: 7 value: "Permanent Fault" - icon: 'mdi:wrench' + icon: 'mdi:wrench' - name: "Inverter Temperature" class: "temperature" - state_class: "measurement" + state_class: "measurement" uom: "°C" scale: 1 rule: 1 registers: [0x0238] - icon: 'mdi:thermometer' + icon: 'mdi:thermometer' - name: "Inverter Heat-Sink Temperature" class: "temperature" - state_class: "measurement" + state_class: "measurement" uom: "°C" scale: 1 rule: 1 registers: [0x0239] - icon: 'mdi:thermometer' + icon: 'mdi:thermometer' - name: "Inverter Bus Voltage" class: "voltage" - state_class: "measurement" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 @@ -405,7 +405,7 @@ parameters: - name: "LLC Bus Voltage" class: "voltage" - state_class: "measurement" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 @@ -414,7 +414,7 @@ parameters: - name: "Countdown Time" class: "" - state_class: "measurement" + state_class: "measurement" uom: "s" scale: 1 rule: 1 @@ -423,7 +423,7 @@ parameters: - name: "Inverter Alert Message" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 @@ -432,7 +432,7 @@ parameters: - name: "Communication Board Inner Message" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 @@ -441,12 +441,12 @@ parameters: - name: "Country" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x023A] - lookup: + lookup: - key: 0 value: "Germany" - key: 1 @@ -510,15 +510,15 @@ parameters: icon: '' - group: Alert - items: + items: - name: "Fault 1" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x0201] - lookup: + lookup: - key: 0 value: "No error" - key: 1 @@ -553,16 +553,16 @@ parameters: value: "ID15 Hardware AC over current protection" - key: 32768 value: "ID16 Grid current is too high" - icon: 'mdi:wrench' + icon: 'mdi:wrench' - name: "Fault 2" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x0202] - lookup: + lookup: - key: 0 value: "No error" - key: 1 @@ -597,16 +597,16 @@ parameters: value: "ID31" - key: 32768 value: "ID32" - icon: 'mdi:wrench' + icon: 'mdi:wrench' - name: "Fault 3" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x0203] - lookup: + lookup: - key: 0 value: "No error" - key: 1 @@ -641,16 +641,16 @@ parameters: value: "ID47 Reserved" - key: 32768 value: "ID48 Reserved" - icon: 'mdi:wrench' + icon: 'mdi:wrench' - name: "Fault 4" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x0204] - lookup: + lookup: - key: 0 value: "No error" - key: 1 @@ -685,16 +685,16 @@ parameters: value: "ID63 Reserved" - key: 32768 value: "ID64 Reserved" - icon: 'mdi:wrench' + icon: 'mdi:wrench' - name: "Fault 5" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 registers: [0x0205] - lookup: + lookup: - key: 0 value: "No error" - key: 1 @@ -729,13 +729,13 @@ parameters: value: "ID79 Reserved" - key: 32768 value: "ID80 Reserved" - icon: 'mdi:wrench' + icon: 'mdi:wrench' - group: InverterInformation - items: + items: - name: "Production Code" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 1 @@ -743,7 +743,7 @@ parameters: - name: "Serial Number" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 5 @@ -752,7 +752,7 @@ parameters: - name: "Software Version" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 5 @@ -761,9 +761,9 @@ parameters: - name: "Hardware Version" class: "" - state_class: "" + state_class: "" uom: "" scale: 1 rule: 5 registers: [0x200A,0x200B] - isstr: true \ No newline at end of file + isstr: true diff --git a/custom_components/solarman/inverter_definitions/solis_1p8k-5g.yaml b/custom_components/solarman/inverter_definitions/solis_1p8k-5g.yaml index 22ca58d..0196d20 100644 --- a/custom_components/solarman/inverter_definitions/solis_1p8k-5g.yaml +++ b/custom_components/solarman/inverter_definitions/solis_1p8k-5g.yaml @@ -201,4 +201,3 @@ parameters: rule: 3 registers: [3009, 3008] icon: 'mdi:solar-power' - diff --git a/custom_components/solarman/inverter_definitions/solis_3p-4g.yaml b/custom_components/solarman/inverter_definitions/solis_3p-4g.yaml new file mode 100644 index 0000000..6dae93c --- /dev/null +++ b/custom_components/solarman/inverter_definitions/solis_3p-4g.yaml @@ -0,0 +1,277 @@ +# Solis 4G Three Phase Inverter +# Solis-3P(5-10)K-4G +# refering to https://ginlongsolis.freshdesk.com/support/solutions/articles/36000340158-modbus-communication-for-solis-inverters +# agirilovich June 2023 +# +requests: + - start: 2999 + end: 3044 + mb_functioncode: 0x04 + - start: 4999 + end: 4999 + mb_functioncode: 0x04 + + +parameters: + - group: Inverter + items: + - name: "Working Mode" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [3040] + icon: 'mdi:home-lightning-bolt' + lookup: + - key: 0 + value: "No response mode" + - key: 1 + value: "Volt–watt default" + - key: 2 + value: "Volt–var" + - key: 3 + value: "Fixed power factor" + - key: 4 + value: "Fix reactive power" + - key: 5 + value: "Power-PF" + - key: 6 + value: "Rule21Volt–watt" + + - name: "Grid status" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [4999] + icon: 'mdi:home-lightning-bolt' + + - name: "Inverter Temperature" + class: "temperature" + state_class: "measurement" + uom: "°C" + scale: 0.1 + rule: 1 + registers: [3041] + icon: 'mdi:thermometer' + + - name: "Product Model" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [2999] + isstr: true + + - name: "DSP Software Version" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [3000] + isstr: true + + - name: "LCD Software Version" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [3001] + isstr: true + + - name: "Inverter Status" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [3043] + icon: 'mdi:list-status' + isstr: true + lookup: + - key: 0 + value: "Waiting" + - key: 1 + value: "OpenRun" + - key: 2 + value: "SoftRun" + - key: 3 + value: "Generating" + - key: 1004 + value: "Grid off" + - key: 2011 + value: "Fail Safe" + + - group: InverterDC + items: + - name: "DC Voltage 1" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [3021] + icon: 'mdi:solar-power' + + - name: "DC Voltage 2" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [3023] + icon: 'mdi:solar-power' + + - name: "DC Current 1" + class: "current" + uom: "A" + scale: 0.1 + rule: 1 + registers: [3022] + icon: 'mdi:current-dc' + + - name: "DC Current 2" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [3024] + icon: 'mdi:current-dc' + + - name: "Total DC Power" + class: "power" + state_class: "measurement" + uom: "kW" + scale: 0.001 + rule: 3 + registers: [3007, 3006] + icon: 'mdi:solar-power' + + - group: InverterAC + items: + - name: "Active power" + class: "power" + state_class: "measurement" + uom: "kW" + scale: 0.001 + rule: 3 + registers: [3005, 3004] + icon: 'mdi:solar-power' + + + - name: "Inverter AC Power" + class: "power" + state_class: "measurement" + uom: "kW" + scale: 0.001 + rule: 3 + registers: [3005, 3004] + icon: 'mdi:solar-power' + + - name: "A phase voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [3033] + icon: 'mdi:transmission-tower' + + - name: "B phase voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [3034] + icon: 'mdi:transmission-tower' + + - name: "C phase voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [3035] + icon: 'mdi:transmission-tower' + + - name: "A phase current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [3036] + icon: 'mdi:current-ac' + + - name: "B phase current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [3037] + icon: 'mdi:current-ac' + + - name: "C phase current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [3038] + icon: 'mdi:current-ac' + + + - name: "Inverter Frequency" + class: "frequency" + state_class: "measurement" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [3042] + icon: 'mdi:sine-wave' + + - group: Generation + items: + - name: "Daily Generation" + class: "energy" + state_class: "measurement" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [3014] + icon: 'mdi:solar-power' + + - name: "Monthly Generation" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [3011, 3010] + icon: 'mdi:solar-power' + + - name: "Yearly Generation" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [3017, 3016] + icon: 'mdi:solar-power' + + - name: "Total Generation" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [3009, 3008] + icon: 'mdi:solar-power' diff --git a/custom_components/solarman/inverter_definitions/solis_hybrid.yaml b/custom_components/solarman/inverter_definitions/solis_hybrid.yaml index 78b24ee..6b88f68 100644 --- a/custom_components/solarman/inverter_definitions/solis_hybrid.yaml +++ b/custom_components/solarman/inverter_definitions/solis_hybrid.yaml @@ -1,7 +1,7 @@ # Solis Single Phase Hybrid # RHI-(3-6)K-48ES-5G # Modbus information retrieved from: -# https://www.scss.tcd.ie/coghlan/Elios4you/RS485_MODBUS-Hybrid-BACoghlan-201811228-1854.pdf +# https://www.scss.tcd.ie/Brian.Coghlan/Elios4you/RS485_MODBUS-Hybrid-BACoghlan-201811228-1854.pdf requests: - start: 33029 @@ -13,19 +13,23 @@ requests: - start: 33206 end: 33282 mb_functioncode: 0x04 + - start: 43140 + end: 43150 + mb_functioncode: 0x03 parameters: - group: InverterStatus - items: + items: - name: "Inverter Status" class: "" - state_class: "" + state_class: "measurement" uom: "" scale: 1 rule: 1 registers: [33095] icon: 'mdi:home-lightning-bolt' - lookup: + isstr: true + lookup: - key: 0x0 value: "Waiting State" - key: 0x1 @@ -35,103 +39,104 @@ parameters: - key: 0x3 value: "On Grid/Generating" - key: 0x1004 - value: "Grid OverVoltage" + value: "Grid OverVoltage" - key: 0x1010 - value: "Grid UnderVoltage" + value: "Grid UnderVoltage" - key: 0x1012 - value: "Grid OverFrequency" + value: "Grid OverFrequency" - key: 0x1013 - value: "Grid UnderFrequency" + value: "Grid UnderFrequency" - key: 0x1014 value: "Grid Imp too large" - key: 0x1015 - value: "No Grid" + value: "No Grid" - key: 0x1016 - value: "Grid Imbalance" + value: "Grid Imbalance" - key: 0x1017 - value: "Grid Freq Jitter" + value: "Grid Freq Jitter" - key: 0x1018 - value: "Grid Overcurrent" + value: "Grid Overcurrent" - key: 0x1019 - value: "Grid Tracking Fault" + value: "Grid Tracking Fault" - key: 0x1020 - value: "DC OverVoltage" + value: "DC OverVoltage" - key: 0x1021 value: "DC Bus Overvoltage" - key: 0x1022 - value: "DC Bus Uneven Voltage" + value: "DC Bus Uneven Voltage" - key: 0x1024 value: "DC Bus Uneven Voltage2" - key: 0x1025 value: "DC A path OverCurrent" - key: 0x1026 - value: "DC B path OverCurrent" + value: "DC B path OverCurrent" - key: 0x1027 - value: "DC Input Disturbance" + value: "DC Input Disturbance" - key: 0x1030 - value: "Grid Disturbance" + value: "Grid Disturbance" - key: 0x1031 - value: "DSP Initialization Protection " + value: "DSP Initialization Protection" - key: 0x1032 - value: "Over Temp Protection" + value: "Over Temp Protection" - key: 0x1033 - value: "PV Insulation Fault" + value: "PV Insulation Fault" - key: 0x1034 - value: "Leakage Current Protection" + value: "Leakage Current Protection" - key: 0x1035 - value: "Relay Detection Protection" + value: "Relay Detection Protection" - key: 0x1036 - value: "DSP_B Protection" + value: "DSP_B Protection" - key: 0x1037 - value: "DC Component too Large" + value: "DC Component too Large" - key: 0x1038 - value: "12v UnderVoltage Protection" + value: "12v UnderVoltage Protection" - key: 0x1039 - value: "Under Temperature Protection" + value: "Under Temperature Protection" - key: 0x1040 - value: "Arc Self-Test Protection" + value: "Arc Self-Test Protection" - key: 0x1041 - value: "Arc Protection" + value: "Arc Protection" - key: 0x1042 - value: "DSP on-chip SRAM exception" + value: "DSP on-chip SRAM exception" - key: 0x1043 value: "DSP on-chip FLASH exception" - key: 0x1044 - value: "DSP on-chip PC pointer is abnormal" + value: "DSP on-chip PC pointer is abnormal" - key: 0x1045 value: "DSP key register exception" - key: 0x1046 - value: "Grid disturbance 02" + value: "Grid disturbance 02" - key: 0x1047 - value: "Grid current sampling abnormality" + value: "Grid current sampling abnormality" - key: 0x1048 value: "IGBT overcurrent" - key: 0x1050 - value: "Network current transient overcurrent" + value: "Network current transient overcurrent" - key: 0x1051 - value: "Battery overvoltage hardware failure" + value: "Battery overvoltage hardware failure" - key: 0x1052 - value: "LLC hardware overcurrent" + value: "LLC hardware overcurrent" - key: 0x1053 - value: "Battery overvoltage detection" + value: "Battery overvoltage detection" - key: 0x1054 - value: "Battery undervoltage detection" + value: "Battery undervoltage detection" - key: 0x1055 - value: "Battery no connected" + value: "Battery no connected" - key: 0x1056 - value: "Bypass overvoltage fault" + value: "Bypass overvoltage fault" - key: 0x1057 - value: "Bypass overload fault" + value: "Bypass overload fault" - name: "Operating Status" class: "" - state_class: "" + state_class: "measurement" uom: "" scale: 1 rule: 1 registers: [33121] icon: 'mdi:home-lightning-bolt' - lookup: + isstr: true + lookup: - key: 0x701 value: "Normal Operation" - key: 0x702 @@ -141,23 +146,24 @@ parameters: - key: 0x708 value: "Downtime" - key: 0x710 - value: "Standby" + value: "Standby" - key: 0x720 - value: "Derating Operation" + value: "Derating Operation" - key: 0x740 - value: "Limit Operation" + value: "Limit Operation" - key: 0x780 - value: "Bypass Overload" - + value: "Bypass Overload" + - name: "Grid Fault Status" class: "" - state_class: "" + state_class: "measurement" uom: "" scale: 1 rule: 1 registers: [33116] icon: 'mdi:alert' - lookup: + isstr: true + lookup: - key: 0x0000 value: "No Fault" - key: 0x1 @@ -167,7 +173,7 @@ parameters: - key: 0x4 value: "Grid UnderVoltage" - key: 0x8 - value: "Grid OverFrequency" + value: "Grid OverFrequency" - key: 0x10 value: "Grid UnderFrequency" - key: 0x20 @@ -177,36 +183,39 @@ parameters: - key: 0x80 value: "Grid Impedence too Large" - key: 0x100 - value: "Grid Tracking Fault" + value: "Grid Tracking Fault" - key: 0x200 - value: "Meter Comm Failure" + value: "Meter Comm Failure" - key: 0x400 - value: "Failsafe" - + value: "Failsafe" + - name: "Backup Load Fault Status" class: "" - state_class: "" + state_class: "measurement" uom: "" scale: 1 rule: 1 registers: [33117] icon: 'mdi:alert' - lookup: + isstr: true + lookup: - key: 0x0 value: "No Fault" - key: 0x1 value: "Bypass OverVoltage Fault" - key: 0x2 - value: "Bypass Overload Fault" + value: "Bypass Overload Fault" + - name: "Battery Fault Status" class: "" - state_class: "" + state_class: "measurement" uom: "" scale: 1 rule: 1 registers: [33118] icon: 'mdi:alert' - lookup: + isstr: true + lookup: - key: 0x0 value: "No Fault" - key: 0x1 @@ -214,17 +223,18 @@ parameters: - key: 0x2 value: "Battery OverVoltage Detection" - key: 0x4 - value: "Battery UnderVoltage Detection" - + value: "Battery UnderVoltage Detection" + - name: "Fault Status 04 (Device)" class: "" - state_class: "" + state_class: "measurement" uom: "" scale: 1 rule: 1 registers: [33119] icon: 'mdi:alert' - lookup: + isstr: true + lookup: - key: 0x0000 value: "No Fault" - key: 0x1 @@ -234,7 +244,7 @@ parameters: - key: 0x4 value: "DC Bus Uneven Voltage" - key: 0x8 - value: "DC Bus UnderVoltage" + value: "DC Bus UnderVoltage" - key: 0x10 value: "DC Bus2 Uneven Voltage" - key: 0x20 @@ -244,17 +254,18 @@ parameters: - key: 0x80 value: "DC Input Disturbance" - key: 0x100 - value: "Grid OverCurrent" + value: "Grid OverCurrent" - key: 0x200 - value: "IGBT OverCurrent" + value: "IGBT OverCurrent" - key: 0x400 - value: "Grid Disturbance 2" + value: "Grid Disturbance 2" - key: 0x800 value: "Arc Self-Test Protection" - key: 0x1000 value: "Arc Fault Reservation" - key: 0x2000 - value: "Grid Current Sample Abnormality" + value: "Grid Current Sample Abnormality" + - name: "Fault Status 05 (Device)" class: "" state_class: "" @@ -263,7 +274,8 @@ parameters: rule: 1 registers: [33120] icon: 'mdi:alert' - lookup: + isstr: true + lookup: - key: 0x0000 value: "No Fault" - key: 0x1 @@ -273,7 +285,7 @@ parameters: - key: 0x4 value: "Over Temp Protection" - key: 0x8 - value: "Relay Detection Protection" + value: "Relay Detection Protection" - key: 0x10 value: "Under Temp Protection" - key: 0x20 @@ -283,24 +295,25 @@ parameters: - key: 0x80 value: "Leakage Current Protection" - key: 0x100 - value: "Leakage Current Self-Test" + value: "Leakage Current Self-Test" - key: 0x200 - value: "DSP Initialization Protect" + value: "DSP Initialization Protect" - key: 0x400 - value: "DSP B Protection" + value: "DSP B Protection" - key: 0x800 value: "Battery Overvoltage H/W Failure" - key: 0x1000 - value: "LLC Hardware OverCurrent" + value: "LLC Hardware OverCurrent" - key: 0x2000 value: "Network Side Transient OverCurrent" - key: 0x4000 - value: "CAN Communication Failed" + value: "CAN Communication Failed" - key: 0x8000 - value: "DSP Communication Failed" + value: "DSP Communication Failed" + - name: "Inverter Temperature" class: "temperature" - state_class: "measurement" + state_class: "measurement" uom: "°C" scale: 0.1 rule: 2 @@ -309,19 +322,19 @@ parameters: # Sensors below are outside of modbus request ranges. # If enabling, ensure to amend the request start register. -# +# # - name: "Inverter ID" # class: "" -# state_class: "" +# state_class: "" # uom: "" # scale: 1 # rule: 5 # registers: [33004,33005,33006,33007,33008,33009,33010,33011,33012,33013,33014,33015,33016,33017,33018,33019] # isstr: true - + # - name: "Product Model" # class: "" -# state_class: "" +# state_class: "" # uom: "" # scale: 1 # rule: 6 @@ -330,25 +343,25 @@ parameters: # - name: "DSP Software Version" # class: "" -# state_class: "" +# state_class: "" # uom: "" # scale: 1 # rule: 6 # registers: [33001] # isstr: true - + # - name: "LCD Software Version" # class: "" -# state_class: "" +# state_class: "" # uom: "" # scale: 1 # rule: 6 # registers: [33002] # isstr: true - + # - name: "Protocol Software Version" # class: "" -# state_class: "" +# state_class: "" # uom: "" # scale: 1 # rule: 6 @@ -357,25 +370,29 @@ parameters: - name: "Storage Control Mode" class: "" - state_class: "" + state_class: "measurement" uom: "" scale: 1 rule: 1 registers: [33132] icon: 'mdi:battery-clock' - lookup: + isstr: true + lookup: - key: 0x21 - value: "Spontaneous Mode" + value: "Self Use" - key: 0x22 - value: "Optimized Revenue Mode" + value: "Optimized Revenue" - key: 0x23 - value: "Charging from Grid" + value: "Time of Use" - key: 0x24 - value: "Off-Grid Storage Mode" - - key: 0x28 - value: "Battery Wake-Up" + value: "Off-Grid Storage" + - key: 0x28 + value: "Battery Wake-Up" + - key: 0x60 + value: "Feed-In Priority" + - group: InverterDC - items: + items: - name: "PV1 Voltage" class: "voltage" state_class: "measurement" @@ -410,7 +427,7 @@ parameters: rule: 1 registers: [33052] icon: 'mdi:current-dc' - + - name: "Inverter DC Power" class: "power" state_class: "measurement" @@ -420,8 +437,17 @@ parameters: registers: [33058,33057] icon: 'mdi:solar-power' + - name: "Inverting/Rectifing Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 2 + registers: [33157] + icon: 'mdi:solar-power' + - group: InverterAC - items: + items: - name: "Inverter AC Power" class: "power" state_class: "measurement" @@ -439,7 +465,7 @@ parameters: rule: 1 registers: [33073] icon: 'mdi:transmission-tower' - + - name: "Inverter Current" class: "current" state_class: "measurement" @@ -470,7 +496,7 @@ parameters: rule: 4 registers: [33082] icon: 'mdi:transmission-tower' - + - name: "Inverter Apparent Power" class: "apparent_power" state_class: "measurement" @@ -490,7 +516,7 @@ parameters: icon: 'mdi:sine-wave' - group: Generation - items: + items: - name: "Daily Generation" class: "energy" state_class: "total_increasing" @@ -528,7 +554,7 @@ parameters: icon: 'mdi:solar-power' - group: Grid - items: + items: - name: "Meter Frequency" class: "frequency" state_class: "measurement" @@ -541,7 +567,7 @@ parameters: - name: "Meter Power Factor" class: "power_factor" state_class: "measurement" - uom: "%" + uom: "" scale: 0.01 rule: 2 registers: [33281] @@ -582,7 +608,7 @@ parameters: rule: 4 registers: [33266,33265] icon: 'mdi:transmission-tower' - + - name: "Meter Apparent Power" class: "apparent_power" state_class: "measurement" @@ -609,7 +635,7 @@ parameters: rule: 3 registers: [33170,33169] icon: 'mdi:home-import-outline' - + - name: "Daily Energy Exported" class: "energy" state_class: "total_increasing" @@ -629,10 +655,10 @@ parameters: icon: 'mdi:home-export-outline' - group: Load - items: + items: - name: "House Load Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 1 @@ -641,7 +667,7 @@ parameters: - name: "Backup Load Power" class: "power" - state_class: "measurement" + state_class: "measurement" uom: "W" scale: 1 rule: 1 @@ -650,7 +676,7 @@ parameters: - name: "Daily House+Backup Load Consumption" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 0.1 rule: 1 @@ -659,7 +685,7 @@ parameters: - name: "Total House+Backup Load Consumption" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 1 rule: 3 @@ -667,7 +693,7 @@ parameters: icon: 'mdi:lightning-bolt-outline' - group: Battery - items: + items: - name: "Battery Status" class: "" state_class: "measurement" @@ -676,7 +702,7 @@ parameters: rule: 1 registers: [33135] isstr: true - lookup: + lookup: - key: 0 value: "Charge" - key: 1 @@ -700,7 +726,7 @@ parameters: rule: 1 registers: [33139] icon: 'mdi:battery' - + - name: "Battery SOH" class: "battery" state_class: "measurement" @@ -718,7 +744,7 @@ parameters: rule: 2 registers: [33134] icon: 'mdi:current-dc' - + - name: "Battery Voltage" class: "voltage" state_class: "measurement" @@ -730,7 +756,7 @@ parameters: - name: "Today Battery Charge" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 0.1 rule: 1 @@ -748,7 +774,7 @@ parameters: - name: "Total Battery Charge" class: "energy" - state_class: "total_increasing" + state_class: "total_increasing" uom: "kWh" scale: 1 rule: 3 @@ -763,7 +789,7 @@ parameters: rule: 3 registers: [33166,33165] icon: 'mdi:battery-minus' - + - name: "Battery Charge Current Limit" class: "current" state_class: "measurement" @@ -781,3 +807,131 @@ parameters: rule: 1 registers: [33207] icon: 'mdi:battery-arrow-down' + + - name: "BMS Battery Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 2 + registers: [33142] + icon: 'mdi:current-dc' + + - name: "BMS Battery Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.01 + rule: 1 + registers: [33141] + icon: 'mdi:battery' + + - name: "BMS Battery Charge Current Limit" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [33143] + icon: 'mdi:battery-arrow-up' + + - name: "BMS Battery Discharge Current Limit" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [33144] + icon: 'mdi:battery-arrow-down' + + - group: TimedCharge + items: + - name: "Timed Charge Current" + class: "" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [43141] + icon: 'mdi:wrench-clock' + + - name: "Timed Discharge Current" + class: "" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [43142] + icon: 'mdi:wrench-clock' + + - name: "Timed Charge Start Hour" + class: "" + state_class: "measurement" + uom: "H" + scale: 1 + rule: 1 + registers: [43143] + icon: 'mdi:wrench-clock' + + - name: "Timed Charge Start Minute" + class: "" + state_class: "measurement" + uom: "M" + scale: 1 + rule: 1 + registers: [43144] + icon: 'mdi:wrench-clock' + + - name: "Timed Charge End Hour" + class: "" + state_class: "measurement" + uom: "H" + scale: 1 + rule: 1 + registers: [43145] + icon: 'mdi:wrench-clock' + + - name: "Timed Charge End Minute" + class: "" + state_class: "measurement" + uom: "M" + scale: 1 + rule: 1 + registers: [43146] + icon: 'mdi:wrench-clock' + + - name: "Timed Discharge Start Hour" + class: "" + state_class: "measurement" + uom: "H" + scale: 1 + rule: 1 + registers: [43147] + icon: 'mdi:wrench-clock' + + - name: "Timed Discharge Start Minute" + class: "" + state_class: "measurement" + uom: "M" + scale: 1 + rule: 1 + registers: [43148] + icon: 'mdi:wrench-clock' + + - name: "Timed Discharge End Hour" + class: "" + state_class: "measurement" + uom: "H" + scale: 1 + rule: 1 + registers: [43149] + icon: 'mdi:wrench-clock' + + - name: "Timed Discharge End Minute" + class: "" + state_class: "measurement" + uom: "M" + scale: 1 + rule: 1 + registers: [43150] + icon: 'mdi:wrench-clock' diff --git a/custom_components/solarman/inverter_definitions/solis_s6-gr1p.yaml b/custom_components/solarman/inverter_definitions/solis_s6-gr1p.yaml new file mode 100644 index 0000000..3c3575e --- /dev/null +++ b/custom_components/solarman/inverter_definitions/solis_s6-gr1p.yaml @@ -0,0 +1,317 @@ +# Solis S6-GR1P4.6K Configuration +# NH-Networks 2023 +# +requests: + - start: 2999 + end: 3024 + mb_functioncode: 0x04 + - start: 3035 + end: 3043 + mb_functioncode: 0x04 + - start: 3071 + end: 3071 + mb_functioncode: 0x04 + +parameters: + - group: InverterStatus + items: + - name: "Inverter Status" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [3043] + icon: 'mdi:home-lightning-bolt' + lookup: + - key: 0x0 + value: "Waiting State" + - key: 0x1 + value: "Open Loop Operation" + - key: 0x2 + value: "Soft Start" + - key: 0x3 + value: "On Grid/Generating" + - key: 0x1004 + value: "Grid OverVoltage" + - key: 0x1010 + value: "Grid UnderVoltage" + - key: 0x1012 + value: "Grid OverFrequency" + - key: 0x1013 + value: "Grid UnderFrequency" + - key: 0x1014 + value: "Grid Imp too large" + - key: 0x1015 + value: "No Grid" + - key: 0x1016 + value: "Grid Imbalance" + - key: 0x1017 + value: "Grid Freq Jitter" + - key: 0x1018 + value: "Grid Overcurrent" + - key: 0x1019 + value: "Grid Tracking Fault" + - key: 0x1020 + value: "DC OverVoltage" + - key: 0x1021 + value: "DC Bus Overvoltage" + - key: 0x1022 + value: "DC Bus Uneven Voltage" + - key: 0x1024 + value: "DC Bus Uneven Voltage2" + - key: 0x1025 + value: "DC A path OverCurrent" + - key: 0x1026 + value: "DC B path OverCurrent" + - key: 0x1027 + value: "DC Input Disturbance" + - key: 0x1030 + value: "Grid Disturbance" + - key: 0x1031 + value: "DSP Initialization Protection " + - key: 0x1032 + value: "Over Temp Protection" + - key: 0x1033 + value: "PV Insulation Fault" + - key: 0x1034 + value: "Leakage Current Protection" + - key: 0x1035 + value: "Relay Detection Protection" + - key: 0x1036 + value: "DSP_B Protection" + - key: 0x1037 + value: "DC Component too Large" + - key: 0x1038 + value: "12v UnderVoltage Protection" + - key: 0x1039 + value: "Under Temperature Protection" + - key: 0x1040 + value: "Arc Self-Test Protection" + - key: 0x1041 + value: "Arc Protection" + - key: 0x1042 + value: "DSP on-chip SRAM exception" + - key: 0x1043 + value: "DSP on-chip FLASH exception" + - key: 0x1044 + value: "DSP on-chip PC pointer is abnormal" + - key: 0x1045 + value: "DSP key register exception" + - key: 0x1046 + value: "Grid disturbance 02" + - key: 0x1047 + value: "Grid current sampling abnormality" + - key: 0x1048 + value: "IGBT overcurrent" + - key: 0x1050 + value: "Network current transient overcurrent" + - key: 0x1051 + value: "Battery overvoltage hardware failure" + - key: 0x1052 + value: "LLC hardware overcurrent" + - key: 0x1053 + value: "Battery overvoltage detection" + - key: 0x1054 + value: "Battery undervoltage detection" + - key: 0x1055 + value: "Battery no connected" + - key: 0x1056 + value: "Bypass overvoltage fault" + - key: 0x1057 + value: "Bypass overload fault" + + - name: "Operating Status" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [3071] + icon: 'mdi:home-lightning-bolt' + lookup: + - key: 0x1 + value: "Normal Operation" + - key: 0x2 + value: "Initial Standby" + - key: 0x4 + value: "Control Shutdown" + - key: 0x8 + value: "Downtime" + - key: 0x10 + value: "Standby" + - key: 0x20 + value: "Derating Operation" + - key: 0x40 + value: "Limit Operation" + - key: 0x80 + value: "Bypass Overload" + + - name: "Inverter Temperature" + class: "temperature" + state_class: "measurement" + uom: "°C" + scale: 0.1 + rule: 2 + registers: [3041] + icon: 'mdi:thermometer' + +# Sensors below are outside of modbus request ranges. +# If enabling, ensure to amend the request start register. +# - name: "Inverter ID" +# class: "" +# state_class: "" +# uom: "" +# scale: 1 +# rule: 5 +# registers: [33004,33005,33006,33007,33008,33009,33010,33011,33012,33013,33014,33015,33016,33017,33018,33019] +# isstr: true + +# - name: "Product Model" +# class: "" +# state_class: "" +# uom: "" +# scale: 1 +# rule: 6 +# registers: [2999] +# isstr: true + +# - name: "DSP Software Version" +# class: "" +# state_class: "" +# uom: "" +# scale: 1 +# rule: 6 +# registers: [3000] +# isstr: true + +# - name: "LCD Software Version" +# class: "" +# state_class: "" +# uom: "" +# scale: 1 +# rule: 6 +# registers: [3001] +# isstr: true + + - group: InverterDC + items: + - name: "PV1 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [3021] + icon: 'mdi:solar-power' + + - name: "PV2 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [3023] + icon: 'mdi:solar-power' + + - name: "PV1 Current" + class: "current" + uom: "A" + scale: 0.1 + rule: 1 + registers: [3022] + icon: 'mdi:current-dc' + + - name: "PV2 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [3024] + icon: 'mdi:current-dc' + + - name: "Total DC Power" + class: "power" + state_class: "measurement" + uom: "kW" + scale: 0.001 + rule: 3 + registers: [3007, 3006] + icon: 'mdi:solar-power' + + - group: InverterAC + items: + - name: "Inverter AC Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 1 + registers: [3005, 3004] + icon: 'mdi:solar-power' + + - name: "Inverter Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [3035] + icon: 'mdi:transmission-tower' + + - name: "Inverter Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [3038] + icon: 'mdi:current-ac' + + - name: "Inverter Frequency" + class: "frequency" + state_class: "measurement" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [3042] + icon: 'mdi:sine-wave' + + - group: Generation + items: + - name: "Daily Generation" + class: "energy" + state_class: "measurement" + uom: "kWh" + scale: 0.1 + rule: 1 + registers: [3014] + icon: 'mdi:solar-power' + + - name: "Monthly Generation" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [3011, 3010] + icon: 'mdi:solar-power' + + - name: "Yearly Generation" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [3017, 3016] + icon: 'mdi:solar-power' + + - name: "Total Generation" + class: "energy" + state_class: "total_increasing" + uom: "kWh" + scale: 1 + rule: 3 + registers: [3009, 3008] + icon: 'mdi:solar-power' diff --git a/custom_components/solarman/parser.py b/custom_components/solarman/parser.py index 7c939de..8890a98 100644 --- a/custom_components/solarman/parser.py +++ b/custom_components/solarman/parser.py @@ -1,6 +1,6 @@ import struct -# The parameters start in the "business field" +# The parameters start in the "business field" # just after the first two bytes. OFFSET_PARAMS = 28 @@ -8,174 +8,171 @@ class ParameterParser: def __init__(self, lookups): self.result = {} - self._lookups = lookups + self._lookups = lookups return - def parse (self, rawData, start, length): - for i in self._lookups['parameters']: - for j in i['items']: - self.try_parse_field(rawData, j, start, length) + def parse(self, rawData, start, length): + for i in self._lookups["parameters"]: + for j in i["items"]: + self.try_parse_field(rawData, j, start, length) return def get_result(self): return self.result - - def try_parse_field (self, rawData, definition, start, length): - rule = definition['rule'] + def try_parse_field(self, rawData, definition, start, length): + rule = definition["rule"] if rule == 1: - self.try_parse_unsigned(rawData,definition, start, length) + self.try_parse_unsigned(rawData, definition, start, length) elif rule == 2: - self.try_parse_signed(rawData,definition, start, length) + self.try_parse_signed(rawData, definition, start, length) elif rule == 3: - self.try_parse_unsigned(rawData,definition, start, length) + self.try_parse_unsigned(rawData, definition, start, length) elif rule == 4: - self.try_parse_signed(rawData,definition, start, length) + self.try_parse_signed(rawData, definition, start, length) elif rule == 5: - self.try_parse_ascii(rawData,definition, start, length) + self.try_parse_ascii(rawData, definition, start, length) elif rule == 6: - self.try_parse_bits(rawData,definition, start, length) + self.try_parse_bits(rawData, definition, start, length) return - + def do_validate(self, title, value, rule): - if 'min' in rule: - if rule['min'] > value: - if 'invalidate_all' in rule: - raise ValueError(f'Invalidate complete dataset ({title} ~ {value})') + if "min" in rule: + if rule["min"] > value: + if "invalidate_all" in rule: + raise ValueError(f"Invalidate complete dataset ({title} ~ {value})") return False - if 'max' in rule: - if rule['max'] < value: - if 'invalidate_all' in rule: - raise ValueError(f'Invalidate complete dataset ({title} ~ {value})') + if "max" in rule: + if rule["max"] < value: + if "invalidate_all" in rule: + raise ValueError(f"Invalidate complete dataset ({title} ~ {value})") return False - + return True - def try_parse_signed (self, rawData, definition, start, length): - title = definition['name'] - scale = definition['scale'] + def try_parse_signed(self, rawData, definition, start, length): + title = definition["name"] + scale = definition["scale"] value = 0 found = True shift = 0 maxint = 0 - for r in definition['registers']: - index = r - start # get the decimal value of the register' + for r in definition["registers"]: + index = r - start # get the decimal value of the register' if (index >= 0) and (index < length): maxint <<= 16 maxint |= 0xFFFF offset = OFFSET_PARAMS + (index * 2) - temp = struct.unpack('>H', rawData[offset:offset + 2])[0] + temp = struct.unpack(">H", rawData[offset : offset + 2])[0] value += (temp & 0xFFFF) << shift shift += 16 else: found = False if found: - if 'offset' in definition: - value = value - definition['offset'] - - if value > maxint/2: + if "offset" in definition: + value = value - definition["offset"] + + if value > maxint / 2: value = (value - maxint) * scale else: value = value * scale - - if 'validation' in definition: - if not self.do_validate(title, value, definition['validation']): + + if "validation" in definition: + if not self.do_validate(title, value, definition["validation"]): return - - if self.is_integer_num (value): - self.result[title] = int(value) - else: + + if self.is_integer_num(value): + self.result[title] = int(value) + else: self.result[title] = value return - - def try_parse_unsigned (self, rawData, definition, start, length): - title = definition['name'] - scale = definition['scale'] + + def try_parse_unsigned(self, rawData, definition, start, length): + title = definition["name"] + scale = definition["scale"] value = 0 found = True shift = 0 - for r in definition['registers']: - index = r - start # get the decimal value of the register' + for r in definition["registers"]: + index = r - start # get the decimal value of the register' if (index >= 0) and (index < length): offset = OFFSET_PARAMS + (index * 2) - temp = struct.unpack('>H', rawData[offset:offset + 2])[0] + temp = struct.unpack(">H", rawData[offset : offset + 2])[0] value += (temp & 0xFFFF) << shift shift += 16 else: found = False if found: - if 'lookup' in definition: - self.result[title] = self.lookup_value (value, definition['lookup']) + if "lookup" in definition: + self.result[title] = self.lookup_value(value, definition["lookup"]) else: - if 'offset' in definition: - value = value - definition['offset'] - + if "offset" in definition: + value = value - definition["offset"] + value = value * scale - - if 'validation' in definition: - if not self.do_validate(title, value, definition['validation']): + + if "validation" in definition: + if not self.do_validate(title, value, definition["validation"]): return - if self.is_integer_num (value): - self.result[title] = int(value) - else: - self.result[title] = value + if self.is_integer_num(value): + self.result[title] = int(value) + else: + self.result[title] = value return - - def lookup_value (self, value, options): + def lookup_value(self, value, options): for o in options: - if (o['key'] == value): - return o['value'] + if o["key"] == value: + return o["value"] return "LOOKUP" - - def try_parse_ascii (self, rawData, definition, start, length): - title = definition['name'] + def try_parse_ascii(self, rawData, definition, start, length): + title = definition["name"] found = True - value = '' - for r in definition['registers']: - index = r - start # get the decimal value of the register' + value = "" + for r in definition["registers"]: + index = r - start # get the decimal value of the register' if (index >= 0) and (index < length): offset = OFFSET_PARAMS + (index * 2) - temp = struct.unpack('>H', rawData[offset:offset + 2])[0] + temp = struct.unpack(">H", rawData[offset : offset + 2])[0] value = value + chr(temp >> 8) + chr(temp & 0xFF) else: found = False if found: self.result[title] = value - return - - def try_parse_bits (self, rawData, definition, start, length): - title = definition['name'] + return + + def try_parse_bits(self, rawData, definition, start, length): + title = definition["name"] found = True value = [] - for r in definition['registers']: - index = r - start # get the decimal value of the register' + for r in definition["registers"]: + index = r - start # get the decimal value of the register' if (index >= 0) and (index < length): offset = OFFSET_PARAMS + (index * 2) - temp = struct.unpack('>H', rawData[offset:offset + 2])[0] + temp = struct.unpack(">H", rawData[offset : offset + 2])[0] value.append(hex(temp)) else: found = False if found: self.result[title] = value - return - - def get_sensors (self): + return + + def get_sensors(self): result = [] - for i in self._lookups['parameters']: - for j in i['items']: + for i in self._lookups["parameters"]: + for j in i["items"]: result.append(j) return result - + def is_integer_num(self, n): if isinstance(n, int): return True if isinstance(n, float): return n.is_integer() - return False \ No newline at end of file + return False diff --git a/custom_components/solarman/scanner.py b/custom_components/solarman/scanner.py index 3e621e4..5bc3b75 100644 --- a/custom_components/solarman/scanner.py +++ b/custom_components/solarman/scanner.py @@ -1,4 +1,3 @@ - import socket @@ -8,7 +7,7 @@ def __init__(self): self._serial = None self._mac = None - def _discover_inverters(self): + def _discover_inverters(self): request = "WIFIKIT-214028-READ" address = ("", 48899) try: @@ -18,26 +17,26 @@ def _discover_inverters(self): sock.settimeout(1.0) sock.sendto(request.encode(), address) - + while True: try: data = sock.recv(1024) - a = data.decode().split(',') + a = data.decode().split(",") if 3 == len(a): self._ipaddress = a[0] self._mac = a[1] self._serial = int(a[2]) except socket.timout: break - except: - return None - + except: + return None + def get_ipaddress(self): if not self._ipaddress: self._discover_inverters() return self._ipaddress - + def get_serialno(self): if not self._serial: self._discover_inverters() - return self._serial + return self._serial diff --git a/custom_components/solarman/sensor.py b/custom_components/solarman/sensor.py index b189db1..c24f955 100644 --- a/custom_components/solarman/sensor.py +++ b/custom_components/solarman/sensor.py @@ -1,4 +1,3 @@ - ################################################################################ # Solarman local interface. # @@ -8,45 +7,46 @@ ############################################################################### import logging + import voluptuous as vol -from homeassistant.core import HomeAssistant from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_NAME +from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const import * -from .solarman import Inverter from .scanner import InverterScanner +from .solarman import Inverter _LOGGER = logging.getLogger(__name__) _inverter_scanner = InverterScanner() -def _do_setup_platform(hass: HomeAssistant, config, async_add_entities : AddEntitiesCallback): - _LOGGER.debug(f'sensor.py:async_setup_platform: {config}') - + +def _do_setup_platform(hass: HomeAssistant, config, async_add_entities: AddEntitiesCallback): + _LOGGER.debug(f"sensor.py:async_setup_platform: {config}") + inverter_name = config.get(CONF_NAME) inverter_host = config.get(CONF_INVERTER_HOST) if inverter_host == "0.0.0.0": inverter_host = _inverter_scanner.get_ipaddress() - - + inverter_port = config.get(CONF_INVERTER_PORT) inverter_sn = config.get(CONF_INVERTER_SERIAL) if inverter_sn == 0: inverter_sn = _inverter_scanner.get_serialno() - + inverter_mb_slaveid = config.get(CONF_INVERTER_MB_SLAVEID) if not inverter_mb_slaveid: inverter_mb_slaveid = DEFAULT_INVERTER_MB_SLAVEID lookup_file = config.get(CONF_LOOKUP_FILE) - path = hass.config.path('custom_components/solarman/inverter_definitions/') + path = hass.config.path("custom_components/solarman/inverter_definitions/") # Check input configuration. if inverter_host is None: - raise vol.Invalid('configuration parameter [inverter_host] does not have a value') + raise vol.Invalid("configuration parameter [inverter_host] does not have a value") if inverter_sn is None: - raise vol.Invalid('configuration parameter [inverter_serial] does not have a value') + raise vol.Invalid("configuration parameter [inverter_serial] does not have a value") inverter = Inverter(path, inverter_sn, inverter_host, inverter_port, inverter_mb_slaveid, lookup_file) # Prepare the sensor entities. @@ -58,24 +58,28 @@ def _do_setup_platform(hass: HomeAssistant, config, async_add_entities : AddEnti else: hass_sensors.append(SolarmanSensor(inverter_name, inverter, sensor, inverter_sn)) except BaseException as ex: - _LOGGER.error(f'Config error {ex} {sensor}') + _LOGGER.error(f"Config error {ex} {sensor}") raise hass_sensors.append(SolarmanStatus(inverter_name, inverter, "status_lastUpdate", inverter_sn)) hass_sensors.append(SolarmanStatus(inverter_name, inverter, "status_connection", inverter_sn)) - _LOGGER.debug(f'sensor.py:_do_setup_platform: async_add_entities') + _LOGGER.debug(f"sensor.py:_do_setup_platform: async_add_entities") _LOGGER.debug(hass_sensors) async_add_entities(hass_sensors) + # Set-up from configuration.yaml -async def async_setup_platform(hass: HomeAssistant, config, async_add_entities : AddEntitiesCallback, discovery_info=None): - _LOGGER.debug(f'sensor.py:async_setup_platform: {config}') +async def async_setup_platform( + hass: HomeAssistant, config, async_add_entities: AddEntitiesCallback, discovery_info=None +): + _LOGGER.debug(f"sensor.py:async_setup_platform: {config}") _do_setup_platform(hass, config, async_add_entities) - + + # Set-up from the entries in config-flow async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback): - _LOGGER.debug(f'sensor.py:async_setup_entry: {entry.options}') + _LOGGER.debug(f"sensor.py:async_setup_entry: {entry.options}") _do_setup_platform(hass, entry.options, async_add_entities) @@ -84,7 +88,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_e # It provides device_info to Home Assistant which allows grouping all the Entities under a single Device. ############################################################################################################# -class SolarmanSensor(): + +class SolarmanSensor: """Solarman Device class.""" def __init__(self, id: str = None, device_name: str = None, model: str = None, manufacturer: str = None): @@ -116,6 +121,7 @@ def extra_state_attributes(self): # It derives from the Entity class in HA and is suited for status values. ############################################################################################################# + class SolarmanStatus(SolarmanSensor, Entity): def __init__(self, inverter_name, inverter, field_name, sn): super().__init__(sn, inverter_name, inverter.lookup_file) @@ -123,7 +129,7 @@ def __init__(self, inverter_name, inverter, field_name, sn): self.inverter = inverter self._field_name = field_name self.p_state = None - self.p_icon = 'mdi:magnify' + self.p_icon = "mdi:magnify" self._sn = sn return @@ -156,20 +162,20 @@ def update(self): # Overrides the Status entity, supply the configured icon, and updates the inverter parameters ############################################################################################################# + class SolarmanSensorText(SolarmanStatus): def __init__(self, inverter_name, inverter, sensor, sn): - SolarmanStatus.__init__(self,inverter_name, inverter, sensor['name'], sn) - if 'icon' in sensor: - self.p_icon = sensor['icon'] + SolarmanStatus.__init__(self, inverter_name, inverter, sensor["name"], sn) + if "icon" in sensor: + self.p_icon = sensor["icon"] else: - self.p_icon = '' + self.p_icon = "" return - def update(self): - # Update this sensor using the data. - # Get the latest data and use it to update our sensor state. - # Retrieve the sensor data from actual interface + # Update this sensor using the data. + # Get the latest data and use it to update our sensor state. + # Retrieve the sensor data from actual interface self.inverter.update() val = self.inverter.get_current_val() @@ -177,7 +183,7 @@ def update(self): if self._field_name in val: self.p_state = val[self._field_name] else: - _LOGGER.debug(f'No value recorded for {self._field_name}') + _LOGGER.debug(f"No value recorded for {self._field_name}") ############################################################################################################# @@ -185,32 +191,29 @@ def update(self): # Overrides the Text sensor and supply the device class, last_reset and unit of measurement ############################################################################################################# + class SolarmanSensor(SolarmanSensorText): def __init__(self, inverter_name, inverter, sensor, sn): SolarmanSensorText.__init__(self, inverter_name, inverter, sensor, sn) - self._device_class = sensor['class'] - if 'state_class' in sensor: - self._state_class = sensor['state_class'] + self._device_class = sensor["class"] + if "state_class" in sensor: + self._state_class = sensor["state_class"] else: self._state_class = None - self.uom = sensor['uom'] + self.uom = sensor["uom"] return @property def device_class(self): return self._device_class - @property def extra_state_attributes(self): if self._state_class: - return { - 'state_class': self._state_class - } + return {"state_class": self._state_class} else: return None @property def unit_of_measurement(self): return self.uom - diff --git a/custom_components/solarman/solarman.py b/custom_components/solarman/solarman.py index d6f04c6..870ee41 100644 --- a/custom_components/solarman/solarman.py +++ b/custom_components/solarman/solarman.py @@ -1,11 +1,13 @@ -import socket -import yaml import logging +import socket import struct -from homeassistant.util import Throttle from datetime import datetime -from .parser import ParameterParser + +import yaml +from homeassistant.util import Throttle + from .const import * +from .parser import ParameterParser log = logging.getLogger(__name__) @@ -16,6 +18,7 @@ SEND_DATA_FIELD = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] QUERY_RETRY_ATTEMPTS = 6 + class Inverter: def __init__(self, path, serial, host, port, mb_slaveid, lookup_file): self._serial = serial @@ -27,8 +30,8 @@ def __init__(self, path, serial, host, port, mb_slaveid, lookup_file): self.status_connection = "Disconnected" self.status_lastUpdate = "N/A" self.lookup_file = lookup_file - if not self.lookup_file or lookup_file == 'parameters.yaml': - self.lookup_file = 'deye_hybrid.yaml' + if not self.lookup_file or lookup_file == "parameters.yaml": + self.lookup_file = "deye_hybrid.yaml" with open(self.path + self.lookup_file) as f: self.parameter_definition = yaml.full_load(f) @@ -40,9 +43,7 @@ def modbus(self, data): for byte in data: crc ^= byte for _ in range(8): - crc = ((crc >> 1) ^ POLY - if (crc & 0x0001) - else crc >> 1) + crc = (crc >> 1) ^ POLY if (crc & 0x0001) else crc >> 1 return crc def get_serial_hex(self): @@ -52,18 +53,18 @@ def get_serial_hex(self): return serial_bytes def get_read_business_field(self, start, length, mb_fc): - request_data = bytearray([self._mb_slaveid, mb_fc]) # Function Code - request_data.extend(start.to_bytes(2, 'big')) - request_data.extend(length.to_bytes(2, 'big')) + request_data = bytearray([self._mb_slaveid, mb_fc]) # Function Code + request_data.extend(start.to_bytes(2, "big")) + request_data.extend(length.to_bytes(2, "big")) crc = self.modbus(request_data) - request_data.extend(crc.to_bytes(2, 'little')) + request_data.extend(crc.to_bytes(2, "little")) return request_data def generate_request(self, start, length, mb_fc): packet = bytearray([START_OF_MESSAGE]) packet_data = [] - packet_data.extend (SEND_DATA_FIELD) + packet_data.extend(SEND_DATA_FIELD) buisiness_field = self.get_read_business_field(start, length, mb_fc) packet_data.extend(buisiness_field) length = packet_data.__len__() @@ -72,9 +73,9 @@ def generate_request(self, start, length, mb_fc): packet.extend(SERIAL_NO) packet.extend(self.get_serial_hex()) packet.extend(packet_data) - #Checksum + # Checksum checksum = 0 - for i in range(1,len(packet),1): + for i in range(1, len(packet), 1): checksum += packet[i] packet.append(checksum & 0xFF) packet.append(END_OF_MESSAGE) @@ -88,7 +89,7 @@ def validate_packet(self, packet): # Start with the outer V5 logger packet and work inwards towards the embedded modbus frame # Does the v5 packet start and end with what we expect? - if packet[0] != 0xa5 or packet[len(packet) - 1] != 0x15: + if packet[0] != 0xA5 or packet[len(packet) - 1] != 0x15: log.debug("unexpected v5 packet start/stop") return 0 # Does the v5 packet have the correct checksum? @@ -105,7 +106,7 @@ def validate_packet(self, packet): return 0 # Move onto the encapsulated modbus frame - modbus_frame = packet[25:len(packet) - 2] + modbus_frame = packet[25 : len(packet) - 2] # Is the modbus CRC correct? if self.validate_modbus_crc(modbus_frame) == 0: @@ -115,7 +116,6 @@ def validate_packet(self, packet): # Validation compelted successfully return 1 - def validate_modbus_crc(self, frame): # Calculate crc with all but the last 2 bytes of the frame (they contain the crc) calc_crc = 0xFFFF @@ -129,13 +129,12 @@ def validate_modbus_crc(self, frame): calc_crc >>= 1 # Compare calculated crc with the one supplied in the frame.... - frame_crc, = struct.unpack('Buy Me A Coffee
- -