wlcrs / huawei_solar

Home Assistant integration for Huawei Solar inverters via Modbus
GNU Affero General Public License v3.0
530 stars 84 forks source link

[Bug]: Inverter not being discovered #593

Closed spac3h closed 7 months ago

spac3h commented 7 months ago

Describe the issue

On the HA integration only the battery and the power meter are been shown, i can't manage to see the inverter.

image image

Bescribe your Huawei Solar Setup

Inverter Type: SUN2000-5KTL-L1 Inverter Firmware version: SDongle present: no Power meter present: single phase Battery: LUNA2000 5kWh Battery Firmware version:

How do you connect to the inverter?

Via the SUN2000-<serial_no> WiFi

Upload your Diagnostics File

Drag & Drop your Diagnostics File here. config_entry-huawei_solar-970c62a7fa1f0b9f7d663ccb401a7120.json.txt

Upload your relevant debug logs

2024-01-18 10:22:13.025 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration omie which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-01-18 10:22:13.026 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-01-18 10:22:13.027 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration pyscript which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-01-18 10:22:13.027 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration duosida which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-01-18 10:22:13.027 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration nodered which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-01-18 10:22:13.029 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration solcast_solar which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-01-18 10:22:13.029 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration huawei_solar which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-01-18 10:22:48.641 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ (states('sensor.power_meter_active_power') | float* -1 ) | round(1) }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1925, in forgiving_float_filter
    return float(value)
           ^^^^^^^^^^^^
ValueError: could not convert string to float: 'unknown'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 568, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2196, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1928, in forgiving_float_filter
    raise_no_default("float", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1626, in raise_no_default
    raise ValueError(
ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.power_meter_active_power') | float* -1 ) | round(1) }}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 694, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 570, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.power_meter_active_power') | float* -1 ) | round(1) }}' but no default was specified
2024-01-18 10:22:48.651 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.power_meter_active_power') | float* -1 ) | round(1) }}' but no default was specified') while processing template 'Template<template=({{ (states('sensor.power_meter_active_power') | float* -1 ) | round(1) }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.from_to_grid'
2024-01-18 10:22:48.651 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ (states('sensor.inverter_daily_yield') | float) - (states('sensor.battery_day_discharge') | float) + (states('sensor.battery_day_charge') | float) }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1925, in forgiving_float_filter
    return float(value)
           ^^^^^^^^^^^^
ValueError: could not convert string to float: 'unknown'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 568, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2196, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1928, in forgiving_float_filter
    raise_no_default("float", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1626, in raise_no_default
    raise ValueError(
ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.inverter_daily_yield') | float) - (states('sensor.battery_day_discharge') | float) + (states('sensor.battery_day_charge') | float) }}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 694, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 570, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.inverter_daily_yield') | float) - (states('sensor.battery_day_discharge') | float) + (states('sensor.battery_day_charge') | float) }}' but no default was specified
2024-01-18 10:22:48.655 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.inverter_daily_yield') | float) - (states('sensor.battery_day_discharge') | float) + (states('sensor.battery_day_charge') | float) }}' but no default was specified') while processing template 'Template<template=({{ (states('sensor.inverter_daily_yield') | float) - (states('sensor.battery_day_discharge') | float) + (states('sensor.battery_day_charge') | float) }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.solar_prod'
2024-01-18 10:22:48.656 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ (states('sensor.inverter_total_yield') | float) - (states('sensor.battery_total_discharge') | float) + (states('sensor.battery_total_charge') | float)}}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1925, in forgiving_float_filter
    return float(value)
           ^^^^^^^^^^^^
ValueError: could not convert string to float: 'unknown'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 568, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2196, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1928, in forgiving_float_filter
    raise_no_default("float", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1626, in raise_no_default
    raise ValueError(
ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.inverter_total_yield') | float) - (states('sensor.battery_total_discharge') | float) + (states('sensor.battery_total_charge') | float)}}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 694, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 570, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.inverter_total_yield') | float) - (states('sensor.battery_total_discharge') | float) + (states('sensor.battery_total_charge') | float)}}' but no default was specified
2024-01-18 10:22:48.658 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.inverter_total_yield') | float) - (states('sensor.battery_total_discharge') | float) + (states('sensor.battery_total_charge') | float)}}' but no default was specified') while processing template 'Template<template=({{ (states('sensor.inverter_total_yield') | float) - (states('sensor.battery_total_discharge') | float) + (states('sensor.battery_total_charge') | float)}}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.energy_pv'
2024-01-18 10:22:48.659 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ (states('sensor.inverter_daily_yield') | float) - (states('sensor.battery_day_discharge') | float) + (states('sensor.battery_day_charge') | float)}}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1925, in forgiving_float_filter
    return float(value)
           ^^^^^^^^^^^^
ValueError: could not convert string to float: 'unknown'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 568, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2196, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1928, in forgiving_float_filter
    raise_no_default("float", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1626, in raise_no_default
    raise ValueError(
ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.inverter_daily_yield') | float) - (states('sensor.battery_day_discharge') | float) + (states('sensor.battery_day_charge') | float)}}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 694, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 570, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.inverter_daily_yield') | float) - (states('sensor.battery_day_discharge') | float) + (states('sensor.battery_day_charge') | float)}}' but no default was specified
2024-01-18 10:22:48.663 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.inverter_daily_yield') | float) - (states('sensor.battery_day_discharge') | float) + (states('sensor.battery_day_charge') | float)}}' but no default was specified') while processing template 'Template<template=({{ (states('sensor.inverter_daily_yield') | float) - (states('sensor.battery_day_discharge') | float) + (states('sensor.battery_day_charge') | float)}}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.energy_pv_daily'
2024-01-18 10:24:49.371 ERROR (MainThread) [homeassistant.components.switch] Error adding entities for domain switch with platform huawei_solar
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 616, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial_number'
2024-01-18 10:24:49.382 ERROR (MainThread) [homeassistant.components.switch] Error while setting up huawei_solar platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 616, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial_number'
2024-01-18 10:24:50.040 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform huawei_solar
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 616, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial_number'
2024-01-18 10:24:50.041 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 616, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial_number'
2024-01-18 10:25:00.508 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.from_to_grid (<class 'homeassistant.components.template.sensor.SensorTemplate'>) is using native unit of measurement 'W' which is not a valid unit for the device class ('energy') it is using; expected one of ['Wh', 'kWh', 'MWh', 'GJ', 'MJ']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+template%22
2024-01-18 10:25:30.047 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{ (states('sensor.power_meter_active_power') | float* -1 ) | round(1) }}' but no default was specified') while processing template 'Template<template=({{ (states('sensor.power_meter_active_power') | float* -1 ) | round(1) }}) renders=10>' for attribute '_attr_native_value' in entity 'sensor.from_to_grid'
2024-01-18 10:25:35.171 ERROR (MainThread) [homeassistant.components.switch] Error adding entities for domain switch with platform huawei_solar
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 616, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial_number'
2024-01-18 10:25:35.172 ERROR (MainThread) [homeassistant.components.switch] Error while setting up huawei_solar platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 616, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial_number'
2024-01-18 10:25:35.812 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform huawei_solar
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 616, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial_number'
2024-01-18 10:25:35.814 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 616, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial_number'
2024-01-18 10:26:15.541 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-01-18 10:26:15.541 INFO (MainThread) [backoff] Backing off _do_read(...) for 1.0s (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-01-18 10:26:16.543 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-01-18 10:26:16.544 INFO (MainThread) [backoff] Backing off _do_read(...) for 2.0s (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-01-18 10:26:18.544 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-01-18 10:26:18.545 INFO (MainThread) [backoff] Backing off _do_read(...) for 4.0s (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-01-18 10:26:18.619 ERROR (MainThread) [huawei_solar.huawei_solar] Could not read register value, has another device interrupted the connection?
2024-01-18 10:26:18.622 INFO (MainThread) [backoff] Backing off _do_read(...) for 1.0s (huawei_solar.exceptions.ConnectionInterruptedException: Could not read register value, has another device interrupted the connection?)
2024-01-18 10:26:19.538 WARNING (MainThread) [huawei_solar.huawei_solar] Received an error after sending the heartbeat command: None
2024-01-18 10:26:19.623 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-01-18 10:26:19.623 INFO (MainThread) [backoff] Backing off _do_read(...) for 2.0s (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-01-18 10:26:21.625 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-01-18 10:26:21.626 INFO (MainThread) [backoff] Backing off _do_read(...) for 4.0s (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-01-18 10:26:22.546 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-01-18 10:26:22.546 INFO (MainThread) [backoff] Backing off _do_read(...) for 8.0s (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-01-18 10:26:30.547 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-01-18 10:26:30.547 INFO (MainThread) [backoff] Backing off _do_read(...) for 16.0s (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-01-18 10:26:44.542 ERROR (MainThread) [custom_components.huawei_solar] Timeout fetching 102285825065_data_update_coordinator data
2024-01-18 10:26:44.548 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{ (states('sensor.power_meter_active_power') | float* -1 ) | round(1) }}' but no default was specified') while processing template 'Template<template=({{ (states('sensor.power_meter_active_power') | float* -1 ) | round(1) }}) renders=16>' for attribute '_attr_native_value' in entity 'sensor.from_to_grid'
2024-01-18 10:27:19.543 ERROR (MainThread) [huawei_solar.huawei_solar] Timeout while waiting for connection. Reconnecting...
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 490, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 141, in _communication_lock
    await asyncio.wait_for(self._client.connected_event.wait(), WAIT_FOR_CONNECTION_TIMEOUT)
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 492, in wait_for
    raise exceptions.TimeoutError() from exc
TimeoutError
2024-01-18 10:32:01.141 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{ (states('sensor.power_meter_active_power') | float* -1 ) | round(1) }}' but no default was specified') while processing template 'Template<template=({{ (states('sensor.power_meter_active_power') | float* -1 ) | round(1) }}) renders=32>' for attribute '_attr_native_value' in entity 'sensor.from_to_grid'
2024-01-18 10:32:28.884 ERROR (MainThread) [homeassistant.components.shelly] Error fetching shellyem-34945473E8DA data: Error fetching data: DeviceConnectionError()
2024-01-18 10:32:28.890 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{ states('sensor.shellyem_34945473e8da_channel_1_power') | float + states('sensor.duosida_power') | float }}' but no default was specified') while processing template 'Template<template=({{ states('sensor.shellyem_34945473e8da_channel_1_power') | float + states('sensor.duosida_power') | float }}) renders=40>' for attribute '_attr_native_value' in entity 'sensor.template_total_acumulated_power'
2024-01-18 10:32:36.814 ERROR (MainThread) [homeassistant.components.switch] Error adding entities for domain switch with platform huawei_solar
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 616, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial_number'
2024-01-18 10:32:36.817 ERROR (MainThread) [homeassistant.components.switch] Error while setting up huawei_solar platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 616, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial_number'
2024-01-18 10:32:37.504 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform huawei_solar
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 616, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial_number'
2024-01-18 10:32:37.506 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 616, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial_number'
2024-01-18 10:40:47.923 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 32064 with length 52 from slave 0
2024-01-18 10:40:47.924 DEBUG (MainThread) [pymodbus.logging] send: 0x0 0x87 0x0 0x0 0x0 0x6 0x0 0x3 0x7d 0x40 0x0 0x34
2024-01-18 10:40:47.925 DEBUG (MainThread) [pymodbus.logging] Adding transaction 135
2024-01-18 10:40:47.972 DEBUG (MainThread) [pymodbus.logging] recv: 0x0 0x87 0x0 0x0 0x0 0x6b 0x0 0x3 0x68 0x0 0x0 0x4 0x1d 0x8 0xfb 0x0 0x0 0x0 0x0 0x4 0x8b 0x0 0x2 0x0 0x0 0x0 0x0 0x3b 0x93 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x12 0x3d 0x0 0x0 0xd 0x91 0xff 0xff 0xff 0xff 0x3 0xe8 0x13 0x89 0x27 0x10 0x1 0x54 0xb 0xb8 0x2 0x0 0x1a 0x93 0x65 0xa8 0xd9 0x5e 0xff 0xff 0xff 0xff 0x0 0x0 0xd 0xa9 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x1 0x9 0x0 0x1 0xeb 0xf4 0x0 0x2 0xe 0x4e 0x65 0xa9 0x0 0x2e 0x0 0x0 0x0 0xc1 0x0 0x0 0x0 0xc1 old_data:  addr=None
2024-01-18 10:40:47.972 DEBUG (MainThread) [pymodbus.logging] Processing: 0x0 0x87 0x0 0x0 0x0 0x6b 0x0 0x3 0x68 0x0 0x0 0x4 0x1d 0x8 0xfb 0x0 0x0 0x0 0x0 0x4 0x8b 0x0 0x2 0x0 0x0 0x0 0x0 0x3b 0x93 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x12 0x3d 0x0 0x0 0xd 0x91 0xff 0xff 0xff 0xff 0x3 0xe8 0x13 0x89 0x27 0x10 0x1 0x54 0xb 0xb8 0x2 0x0 0x1a 0x93 0x65 0xa8 0xd9 0x5e 0xff 0xff 0xff 0xff 0x0 0x0 0xd 0xa9 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x1 0x9 0x0 0x1 0xeb 0xf4 0x0 0x2 0xe 0x4e 0x65 0xa9 0x0 0x2e 0x0 0x0 0x0 0xc1 0x0 0x0 0x0 0xc1
2024-01-18 10:40:47.972 DEBUG (MainThread) [pymodbus.logging] Factory Response[ReadHoldingRegistersResponse': 3]
2024-01-18 10:40:47.973 DEBUG (MainThread) [pymodbus.logging] Getting transaction 135
2024-01-18 10:40:47.973 DEBUG (MainThread) [pymodbus.logging] [0, 1053, 2299, 0, 0, 1163, 2, 0, 0, 15251, 0, 0, 0, 0, 0, 4669, 0, 3473, 65535, 65535, 1000, 5001, 10000, 340, 3000, 512, 6803, 26024, 55646, 65535, 65535, 0, 3497, 0, 0, 0, 0, 0, 0, 0, 0, 265, 1, 60404, 2, 3662, 26025, 46, 0, 193, 0, 193]
2024-01-18 10:40:47.973 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x04\x1d']
2024-01-18 10:40:47.973 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b';\x93']
2024-01-18 10:40:47.973 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x00\x00']
2024-01-18 10:40:47.973 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x00\x00']
2024-01-18 10:40:47.973 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x12=']
2024-01-18 10:40:47.973 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\r\x91']
2024-01-18 10:40:47.973 DEBUG (MainThread) [pymodbus.logging] handle: [b'\xff\xff', b'\xff\xff']
2024-01-18 10:40:47.973 DEBUG (MainThread) [pymodbus.logging] handle: [b'e\xa8', b'\xd9^']
2024-01-18 10:40:47.974 DEBUG (MainThread) [pymodbus.logging] handle: [b'\xff\xff', b'\xff\xff']
2024-01-18 10:40:47.974 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x01', b'\xeb\xf4']
2024-01-18 10:40:47.974 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x00\xc1']
2024-01-18 10:40:48.024 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 32000 with length 20 from slave 0
2024-01-18 10:40:48.025 DEBUG (MainThread) [pymodbus.logging] send: 0x0 0x88 0x0 0x0 0x0 0x6 0x0 0x3 0x7d 0x0 0x0 0x14
2024-01-18 10:40:48.025 DEBUG (MainThread) [pymodbus.logging] Adding transaction 136
2024-01-18 10:40:48.068 DEBUG (MainThread) [pymodbus.logging] recv: 0x0 0x88 0x0 0x0 0x0 0x2b 0x0 0x3 0x28 0x0 0x6 0x0 0x0 0x0 0x7 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x2 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x90 0xa9 0xe 0x59 0x1 0x26 0x0 0x0 0x0 0x0 old_data:  addr=None
2024-01-18 10:40:48.068 DEBUG (MainThread) [pymodbus.logging] Processing: 0x0 0x88 0x0 0x0 0x0 0x2b 0x0 0x3 0x28 0x0 0x6 0x0 0x0 0x0 0x7 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x2 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x90 0xa9 0xe 0x59 0x1 0x26 0x0 0x0 0x0 0x0
2024-01-18 10:40:48.068 DEBUG (MainThread) [pymodbus.logging] Factory Response[ReadHoldingRegistersResponse': 3]
2024-01-18 10:40:48.068 DEBUG (MainThread) [pymodbus.logging] Getting transaction 136
2024-01-18 10:40:48.069 DEBUG (MainThread) [pymodbus.logging] [6, 0, 7, 0, 0, 0, 0, 0, 0, 512, 0, 0, 0, 0, 0, 37033, 3673, 294, 0, 0]
2024-01-18 10:40:48.069 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x00\x00']
2024-01-18 10:40:48.120 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 37100 with length 38 from slave 0
2024-01-18 10:40:48.120 DEBUG (MainThread) [pymodbus.logging] send: 0x0 0x89 0x0 0x0 0x0 0x6 0x0 0x3 0x90 0xec 0x0 0x26
2024-01-18 10:40:48.120 DEBUG (MainThread) [pymodbus.logging] Adding transaction 137
2024-01-18 10:40:48.160 DEBUG (MainThread) [pymodbus.logging] recv: 0x0 0x89 0x0 0x0 0x0 0x4f 0x0 0x3 0x4c 0x0 0x1 0x0 0x0 0x8 0xe8 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff 0xff 0xff 0xff 0x5f 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff 0xff 0xff 0xfe 0xc1 0xff 0xff 0xff 0x5a 0x3 0x7a 0x13 0x88 0x0 0x0 0x79 0x96 0x0 0x3 0x81 0xbd 0x0 0x0 0x0 0x0 0x0 0x0 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff old_data:  addr=None
2024-01-18 10:40:48.160 DEBUG (MainThread) [pymodbus.logging] Processing: 0x0 0x89 0x0 0x0 0x0 0x4f 0x0 0x3 0x4c 0x0 0x1 0x0 0x0 0x8 0xe8 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff 0xff 0xff 0xff 0x5f 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff 0xff 0xff 0xfe 0xc1 0xff 0xff 0xff 0x5a 0x3 0x7a 0x13 0x88 0x0 0x0 0x79 0x96 0x0 0x3 0x81 0xbd 0x0 0x0 0x0 0x0 0x0 0x0 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff 0x7f 0xff 0xff 0xff
2024-01-18 10:40:48.160 DEBUG (MainThread) [pymodbus.logging] Factory Response[ReadHoldingRegistersResponse': 3]
2024-01-18 10:40:48.160 DEBUG (MainThread) [pymodbus.logging] Getting transaction 137
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] [1, 0, 2280, 32767, 65535, 32767, 65535, 65535, 65375, 32767, 65535, 32767, 65535, 65535, 65217, 65535, 65370, 890, 5000, 0, 31126, 3, 33213, 0, 0, 0, 32767, 65535, 32767, 65535, 32767, 65535, 32767, 65535, 32767, 65535, 32767, 65535]
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x08\xe8']
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x7f\xff', b'\xff\xff']
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x7f\xff', b'\xff\xff']
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\xff\xff', b'\xff_']
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x7f\xff', b'\xff\xff']
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x7f\xff', b'\xff\xff']
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\xff\xff', b'\xfe\xc1']
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\xff\xff', b'\xffZ']
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'y\x96']
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x03', b'\x81\xbd']
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x00\x00']
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x7f\xff', b'\xff\xff']
2024-01-18 10:40:48.161 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x7f\xff', b'\xff\xff']
2024-01-18 10:40:48.162 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x7f\xff', b'\xff\xff']
2024-01-18 10:40:48.162 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x7f\xff', b'\xff\xff']
2024-01-18 10:40:48.162 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x7f\xff', b'\xff\xff']
2024-01-18 10:40:48.162 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x7f\xff', b'\xff\xff']
2024-01-18 10:40:48.212 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 37760 with length 28 from slave 0
2024-01-18 10:40:48.213 DEBUG (MainThread) [pymodbus.logging] send: 0x0 0x8a 0x0 0x0 0x0 0x6 0x0 0x3 0x93 0x80 0x0 0x1c
2024-01-18 10:40:48.213 DEBUG (MainThread) [pymodbus.logging] Adding transaction 138
2024-01-18 10:40:48.228 DEBUG (MainThread) [pymodbus.logging] recv: 0x0 0x8a 0x0 0x0 0x0 0x3b 0x0 0x3 0x38 0x3 0x2 0x0 0x0 0x0 0x2 0x10 0xa1 0xff 0xc5 0xff 0xff 0xf6 0x8c 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x5 0x3f 0x6e 0x0 0x5 0x17 0x2c 0x0 0x0 0x0 0x12 0x0 0x0 0x0 0x60 old_data:  addr=None
2024-01-18 10:40:48.228 DEBUG (MainThread) [pymodbus.logging] Processing: 0x0 0x8a 0x0 0x0 0x0 0x3b 0x0 0x3 0x38 0x3 0x2 0x0 0x0 0x0 0x2 0x10 0xa1 0xff 0xc5 0xff 0xff 0xf6 0x8c 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x5 0x3f 0x6e 0x0 0x5 0x17 0x2c 0x0 0x0 0x0 0x12 0x0 0x0 0x0 0x60
2024-01-18 10:40:48.229 DEBUG (MainThread) [pymodbus.logging] Factory Response[ReadHoldingRegistersResponse': 3]
2024-01-18 10:40:48.229 DEBUG (MainThread) [pymodbus.logging] Getting transaction 138
2024-01-18 10:40:48.229 DEBUG (MainThread) [pymodbus.logging] [770, 0, 2, 4257, 65477, 65535, 63116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 16238, 5, 5932, 0, 18, 0, 96]
2024-01-18 10:40:48.229 DEBUG (MainThread) [pymodbus.logging] handle: [b'\xff\xff', b'\xf6\x8c']
2024-01-18 10:40:48.229 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x05', b'?n']
2024-01-18 10:40:48.229 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x05', b'\x17,']
2024-01-18 10:40:48.229 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x00\x12']
2024-01-18 10:40:48.229 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x00`']
2024-01-18 10:40:48.229 DEBUG (MainThread) [custom_components.huawei_solar] Finished fetching 102285825065_data_update_coordinator data in 0.307 seconds (success: True)
2024-01-18 10:40:54.061 DEBUG (MainThread) [pymodbus.logging] send: 0x0 0x8b 0x0 0x0 0x0 0x6 0x0 0x6 0xc3 0x4f 0x0 0x1
2024-01-18 10:40:54.062 DEBUG (MainThread) [pymodbus.logging] Adding transaction 139
2024-01-18 10:40:54.095 DEBUG (MainThread) [pymodbus.logging] recv: 0x0 0x8b 0x0 0x0 0x0 0x6 0x0 0x6 0xc3 0x4f 0x0 0x1 old_data:  addr=None
2024-01-18 10:40:54.095 DEBUG (MainThread) [pymodbus.logging] Processing: 0x0 0x8b 0x0 0x0 0x0 0x6 0x0 0x6 0xc3 0x4f 0x0 0x1
2024-01-18 10:40:54.095 DEBUG (MainThread) [pymodbus.logging] Factory Response[WriteSingleRegisterResponse': 6]
2024-01-18 10:40:54.095 DEBUG (MainThread) [pymodbus.logging] Getting transaction 139
2024-01-18 10:40:54.095 DEBUG (MainThread) [huawei_solar.huawei_solar] Heartbeat succeeded

Please confirm the following:

wlcrs commented 7 months ago

Duplicate of #565