question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: Huawei sensors are going unavailable sometimes

See original GitHub issue

System Health details

System Health

version core-2022.2.7
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.7
os_name Linux
os_version 5.10.98
arch x86_64
timezone Europe/Brussels
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 5000
Installed Version 1.22.0
Stage running
Available Repositories 1060
Downloaded Repositories 36
Home Assistant Supervisor
host_os Home Assistant OS 7.4
update_channel beta
supervisor_version supervisor-2022.01.1
docker_version 20.10.9
disk_total 457.7 GB
disk_used 112.5 GB
healthy true
supported true
board generic-x86-64
supervisor_api ok
version_api ok
installed_addons Samba share (9.5.1), AdGuard Home (4.4.4), AppDaemon 4 (0.8.1), Caddy (1.6), Check Home Assistant configuration (3.9.0), Duck DNS (1.14.0), ESPHome (2022.1.4), Mosquitto broker (6.0.1), Studio Code Server (4.1.0), WireGuard (0.6.0), MariaDB (2.4.0), Samba Backup (5.0.0), InfluxDB (4.3.0), Grafana (7.4.1), Frigate NVR (2.3), SSH & Web Terminal (10.0.2), Glances (0.14.2), phpMyAdmin (0.7.0), Mealie (0.5.6), Arpspoof (1.0.0), Caddy 2 (1.1.0), Firefly iii (5.6.14-2)
Lovelace
dashboards 3
resources 17
views 18
mode storage
Spotify
api_endpoint_reachable ok

Describe the issue

My HA instance is connected to the internal wifi of the inverter And I’m using your latest version 1.0.0.a3, in the manifest.json it is still 1.0.0.a1

All Huawei sensors are going unavailable for some time. Schermafbeelding 2022-02-16 om 14 07 47

Schermafbeelding 2022-02-16 om 14 10 03

Reproduction steps

  1. Connect to internal wifi
  2. Install integration
  3. Just wait …

Relevant debug logs

This is the moment everything becomes unavailable

Deze fout is ontstaan door een aangepaste integratie.

Logger: custom_components.huawei_solar
Source: helpers/update_coordinator.py:193
Integration: Huawei Solar
First occurred: 11:40:50 (1 occurrences)
Last logged: 11:40:50

Timeout fetching HV20C0092844_data_update_coordinator data
Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py:270
First occurred: 11:46:01 (1 occurrences)
Last logged: 11:46:01

Could not read register value, has another device interrupted the connection?
Logger: pymodbus.client.asynchronous.async_io
Source: /usr/local/lib/python3.9/site-packages/pymodbus/client/asynchronous/async_io/__init__.py:307
First occurred: 12:02:41 (20 occurrences)
Last logged: 13:00:56

Failed to connect: [Errno 113] Connect call failed ('192.168.200.1', 6607)
Failed to connect: [Errno 110] Connect call failed ('192.168.200.1', 6607)
Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py:246
First occurred: 12:02:31 (105 occurrences)
Last logged: 13:05:51

Modbus client is not connected to the inverter.
NoneType: None

And this are all debug logs from going unavailable to available again, sorry for the very long logs…

https://paste.ubuntu.com/p/mFwtgHDwPK/

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
wlcrscommented, Aug 16, 2022

I understand that it would be nice to have those entities report as 0, but that is not easy to implement: returning 0 for some registers would cause all kinds of problems and unintended consequences (monotonically increasing registers like total yield for example).

I think that your approach with templates is the best way forward to be honest.

1reaction
tfribergcommented, Aug 16, 2022

I built a template to manage when the inverter is unresponsive, or turned off at night.

template:
  sensors:
    template_inverter_active_power_availability: 
      friendly_name: Inverter active power
      device_class: energy
      unit_of_measurement: 'W'
      value_template: '{{ 0 if states ("sensor.inverter_active_power") == "unavailable" else states ("sensor.inverter_active_power") }}'
image

This gives me live updates (and live daily yield numbers when the inverter is unreachable) on the front page (the gauges using sensor_inverter_active_power reports 0 when unavailable and does not replace the gauges with an error message). The calculations I do to present what the house consumes at the moment (solar power PLUS from grid MINUS to grid) is another template sensor;

    template_active_power_consumption:
      friendly_name: Power consumption
      device_class: energy
      unit_of_measurement: 'W'
      value_template: '{{ states ("sensor.inverter_active_power")|int(0) + states ("sensor.lgf_active_power_import") | int(0) - states ("sensor.lgf_active_power_export")|int(0) }}'

Hope this helps @gieljnssns.

It would, however, be very nice if the inverter reported 0 “out-of-the-box” when not reachable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sensor Access Degraded or Unavailable - Huawei Support
The power supply is unstable, or the mainboard is malfunctioning. As a result, the BH620 cannot start after being powered on. Solution. 1....
Read more >
Next Alarm State Unavailable, Local Time empty #774 - GitHub
Ok so this is an issue with the actual alarm app that Huawei uses, it seems they are not using the AlarmManager API...
Read more >
Sensors Off | Android Open Source Project
When Sensors off is enabled, access to the microphone is still possible but only silence is returned. If an app is using the...
Read more >
Integration Solar inverter huawei 2000L - Feature Requests
Sometimes the 2 devices appear (inverter and powermeter), but my entities stay unavailable. Any ideas? Logger: huawei_solar.huawei_solar ...
Read more >
What to Do if Your Android Phone's Proximity Sensor Stops ...
Bugs and glitches can always occur and mess with your phone. This can be due to incompatible software updates or just end up...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found