Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Avoid Negative House Load - Poll/Timing optimization #767

Closed
2 tasks done
heinemannj opened this issue Jul 11, 2024 · 4 comments
Closed
2 tasks done

Comments

@heinemannj
Copy link

heinemannj commented Jul 11, 2024

Describe your feature request

Negative House Load (for my setup NOT possible) - potentially due to Poll/Timing mismatch between Inverter Active power and Power meter Active power:

NOT recognized in versions 1.3.x.

My proposal:

  • dedicated update interval for all power related sensors (inverter, power-meter, batteries): interval 1-10s
  • dedicated update interval for all energy related sensors (inverter, power-meter, batteries): interval 10-30s
  • for remaining sensors (inverter, power-meter, batteries): interval 30-60s
template:
  - trigger:
      - platform: state
        entity_id: sensor.inverter_input_power
        not_from:
          - "unknown"
          - "unavailable"
          - "none"
        not_to:
          - "unknown"
          - "unavailable"
          - "none"
      - platform: state
        entity_id: sensor.inverter_active_power
        not_from:
          - "unknown"
          - "unavailable"
          - "none"
        not_to:
          - "unknown"
          - "unavailable"
          - "none"
      - platform: state
        entity_id: sensor.power_meter_active_power
        not_from:
          - "unknown"
          - "unavailable"
          - "none"
        not_to:
          - "unknown"
          - "unavailable"
          - "none"
    action:
      - variables:
          inv_input_power: "{{ states('sensor.inverter_input_power')|int(0) }}"
          inv_active_power: "{{ states('sensor.inverter_active_power')|int(0) }}"
          bat_charge_discharge_power: "{{ (inv_input_power - inv_active_power)|int(0) }}"
          bat_charge_power: "{{ max(0, bat_charge_discharge_power) }}"
          bat_discharge_power: "{{ -min(0, bat_charge_discharge_power) }}"
          pm_active_power: "{{ states('sensor.power_meter_active_power')|int(0) }}"
          grid_export_power: "{{ max(0, pm_active_power) }}"
          grid_import_power: "{{ -min(0, pm_active_power) }}"
          house_power: "{{ inv_active_power - pm_active_power }}"
          house_power_with_correction: >-
            {% if house_power > 0 %}
              {{ house_power }}
            {% else %}
              {{ states('sensor.house_consumption_power')|float(0) }}
            {% endif %}
    sensor:
      #
      # Correction for House power (to avoid negative load)
      #
      - name: house_consumption_power
        unique_id: house_consumption_power
        #friendly_name: "Power meter House power"
        state_class: measurement
        device_class: power
        unit_of_measurement: "W"
        icon: mdi:home-lightning-bolt
        state: "{{ house_power_with_correction }}"
      #
      # House power without correction (negative load possible)
      #
      - name: house_consumption_power_without_correction
        unique_id: house_consumption_power_without_correction
        #friendly_name: "Power meter House power without_correction"
        state_class: measurement
        device_class: power
        unit_of_measurement: "W"
        icon: mdi:home-lightning-bolt
        state: "{{ house_power }}"

HA log is clean no Huawei solar log entries.

Connection directly to inverter internal WLAN (NOT to the dongle) via dedicated HA WLAN interface - works 100% as expected!!!

image
image

Customized update interval in const.py:

INVERTER_UPDATE_INTERVAL = timedelta(seconds=1)
POWER_METER_UPDATE_INTERVAL = timedelta(seconds=1)
ENERGY_STORAGE_UPDATE_INTERVAL = timedelta(seconds=1)
UPDATE_TIMEOUT = timedelta(seconds=29)
# configuration can only change when edited through FusionSolar web or app
CONFIGURATION_UPDATE_INTERVAL = timedelta(minutes=15)
CONFIGURATION_UPDATE_TIMEOUT = timedelta(minutes=1)
# optimizer data is only refreshed every 5 minutes by the inverter.
OPTIMIZER_UPDATE_INTERVAL = timedelta(minutes=5)
OPTIMIZER_UPDATE_TIMEOUT = timedelta(minutes=1)

Increasing the timedelta seconds to it's default of 30seconds will increasing this issue!!! - No workarround

image

Last version of HA and Huawei Solar Integration:

System Information

version core-2024.7.2
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 6.6.33-haos
arch x86_64
timezone Europe/Berlin
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.34.0
Stage running
Available Repositories 1474
Downloaded Repositories 53
HACS Data ok
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 12.4
update_channel stable
supervisor_version supervisor-2024.06.2
agent_version 1.6.0
docker_version 26.1.4
disk_total 30.8 GB
disk_used 10.5 GB
healthy true
supported true
host_connectivity true
supervisor_connectivity true
ntp_synchronized true
virtualization kvm
board ova
supervisor_api ok
version_api ok
installed_addons Filebrowser (2.23.0_14), Samba Backup (5.2.0), Terminal & SSH (9.14.0), Studio Code Server (5.15.0), step-ca-client (1.0.2), EMHASS (0.10.4)
Dashboards
dashboards 8
resources 34
views 51
mode storage
Recorder
oldest_recorder_run June 11, 2024 at 03:54
current_recorder_run July 11, 2024 at 15:30
estimated_db_size 20580.62 MiB
database_engine mysql
database_version 11.2.3
Solcast PV Forecast
can_reach_server ok
used_requests 6
rooftop_site_count 1

Proper usage

  • I confirm that this is not a bug report or support request
  • I confirm that this feature request is within the stated scope of the integration
@wlcrs
Copy link
Owner

wlcrs commented Jul 21, 2024

Technical feasibility of how registers can be read in batch is limited to how those registers are laid out in the inverter. Registers which are not close to each other numerically cannot be read together.

I've already gone above and beyond to get the batching of closely located registers to the best technical solution. There is nothing left to be done here.

@wlcrs wlcrs closed this as not planned Won't fix, can't repro, duplicate, stale Jul 21, 2024
@heinemannj
Copy link
Author

I've already gone above and beyond to get the batching of closely located registers to the best technical solution. There is nothing left to be done here.

Thanks for your clarifications, but please implement at least: #718 (reply in thread)

@heinemannj
Copy link
Author

I'll test out possible HA filter options to reduce this announcing impact.

house_power: "{{ inv_active_power - pm_active_power }}" - but quite an tricky issue.

@wlcrs
Copy link
Owner

wlcrs commented Jul 21, 2024

Thanks for your clarifications, but please implement at least: #718 (reply in thread)

This is against the architecture guidelines of HA, as explained in home-assistant/core#105163 (comment) .

You can see that all requests / PRs in HA core to add a configurable scan interval are denied. For example home-assistant/core#122294

I already explain in the README how this can be done using the method outlined by the HA core maintainers: https://github.com/wlcrs/huawei_solar?tab=readme-ov-file#inverter-polling-frequency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants