Patrick762 / hassio-bluetti-bt

Bluetti Integration for Home Assistant
MIT License
49 stars 14 forks source link

[Bug]: Entities are 'unknown' for AC500 #50

Closed twister36 closed 4 months ago

twister36 commented 8 months ago

What happened?

Just added the integration and configured integration for a AC500, which completed successfully. However, all entities for the this AC500 have a state of 'unknown'

image

Running beta version 0.0.16 for support of PBOX. USB device is internal USB/Wifi module of the Raspberry Pi 4

Version

0.0.11

What device are you seeing the problem on?

AC500

What bluetooth connection are you using?

USB dongle

Have you changed the integration settings?

false

Integration settings (if you changed them)

No response

Relevant log output

No response

twister36 commented 8 months ago

For the logs for this HACS integration, where are they located, so that I can get relevant output?

Patrick762 commented 8 months ago

For the logs for this HACS integration, where are they located, so that I can get relevant output?

You can find the logs in HA in the Settings

twister36 commented 8 months ago

For the logs for this HACS integration, where are they located, so that I can get relevant output?

You can find the logs in HA in the Settings

I mean which log?, HA has several logs. I didn't see anything related to this integration.

GammaPotato commented 7 months ago

same issue on EB3A. The are comming up after serveral hours without connection. And updating sensors need arround 5 minutes. i have them set to update every 10 seconds

debug log

2024-03-02 16:29:04.089 WARNING (MainThread) [custom_components.bluetti_bt.coordinator] Polling timed out for device XX:XX:XX:XX:XX:9B
2024-03-02 16:29:04.091 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXdc_input_power
2024-03-02 16:29:04.091 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXac_input_power
2024-03-02 16:29:04.091 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXac_output_power
2024-03-02 16:29:04.092 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXdc_output_power
2024-03-02 16:29:04.092 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXtotal_battery_percent
2024-03-02 16:29:04.092 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXac_input_voltage
2024-03-02 16:29:04.093 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXled_mode
2024-03-02 16:29:04.093 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXeco_shutdown
2024-03-02 16:29:04.093 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXcharging_mode

chrome_gAyDRDpmEC

i have "Unbekannt" thats german for "unknown"

Patrick762 commented 7 months ago

For the logs for this HACS integration, where are they located, so that I can get relevant output?

You can find the logs in HA in the Settings

I mean which log?, HA has several logs. I didn't see anything related to this integration.

Now I understand what you meant. Have the same problem now. I'll look into it as soon as possible. The strange thing about it is, it worked fine for many days. Maybe it's just a problem in the integration init part.

GammaPotato commented 7 months ago

For the logs for this HACS integration, where are they located, so that I can get relevant output?

You can find the logs in HA in the Settings

I mean which log?, HA has several logs. I didn't see anything related to this integration.

Now I understand what you meant. Have the same problem now. I'll look into it as soon as possible. The strange thing about it is, it worked fine for many days. Maybe it's just a problem in the integration init part.

That means a fix is on the way? The unkown issue comes here after arround 8 hours without connection to the EB3A

GammaPotato commented 7 months ago

@Patrick762 i found something new out. The messages

2024-03-02 16:29:04.091 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXdc_input_power
2024-03-02 16:29:04.091 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXac_input_power
2024-03-02 16:29:04.091 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXac_output_power
2024-03-02 16:29:04.092 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXdc_output_power
2024-03-02 16:29:04.092 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXtotal_battery_percent
2024-03-02 16:29:04.092 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXac_input_voltage
2024-03-02 16:29:04.093 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXled_mode
2024-03-02 16:29:04.093 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXeco_shutdown
2024-03-02 16:29:04.093 WARNING (MainThread) [custom_components.bluetti_bt.sensor] Data from coordinator is None. Skipping update for eb3a23XXXXXXXXXXcharging_mode

are showing up while the Integration is still connected. After no data get updated (No output_state input_state or all other stats is changing because the Bluetti is not in use) after arround 5 - 8 Hours the logs show "Data is none"

Patrick762 commented 7 months ago

It would be much easier if debug logging would work. But the feature seems to be no longer working. I'm working on it, but currently I don't have too much spare time (maybe I have some time on friday next week).

GammaPotato commented 7 months ago

Everything is fine, take ur time. I found an Temporary fix for it. Set refesh to 10 second and turn off permenent connection. When u get data "none" reboot home assistant and turn ON DC output while home assistant is rebooting. After rebbot u get data in arround 5 minutes.

Model: EB3A

GammaPotato commented 7 months ago

found another issue. After 5 times trying to connect it dont to pause. it always trys all entert seconds

Eyeanman commented 7 months ago

I thought id try the beta version 0.0.19 as i wanted to get my AC70 working, but when i updated I also got Unknowns for my AC300 which was previously working fine. I downgraded to 0.0.11 (Which i THINK i was on before) and still had the problem.

I compared devices/ac300.py vs https://github.com/warhammerkid/bluetti_mqtt/blob/main/bluetti_mqtt/core/devices/ac300.py and noticed that the bottom section differed and wondered if that was the issue (I have no idea what its doing so could be totally wrong), i replaced it and it is now working again.

From warhammerkid: ` @property def pack_num_max(self): return 4

@property
def polling_commands(self) -> List[ReadHoldingRegisters]:
    return [
        ReadHoldingRegisters(10, 40),
        ReadHoldingRegisters(70, 21),
        ReadHoldingRegisters(3001, 61),
    ]

@property
def pack_polling_commands(self) -> List[ReadHoldingRegisters]:
    return [ReadHoldingRegisters(91, 37)]

@property
def logging_commands(self) -> List[ReadHoldingRegisters]:
    return [
        ReadHoldingRegisters(0, 70),
        ReadHoldingRegisters(70, 21),
        ReadHoldingRegisters(3000, 62),
    ]

@property
def pack_logging_commands(self) -> List[ReadHoldingRegisters]:
    return [ReadHoldingRegisters(91, 119)]

@property
def writable_ranges(self) -> List[range]:
    return [range(3000, 3062)]`

From this repo: ` @property def pack_num_max(self): return 4

@property
def polling_commands(self) -> List[ReadHoldingRegisters]:
    return super().polling_commands + [
        ReadHoldingRegisters(70, 10),
        ReadHoldingRegisters(86, 3),
    ]

@property
def writable_ranges(self) -> List[range]:
    return super().writable_ranges + [
        range(3001, 3016),
        3061,
    ]

@property
def pack_polling_commands(self) -> List[ReadHoldingRegisters]:
    return super().pack_polling_commands + [
        ReadHoldingRegisters(105, 16),
        ReadHoldingRegisters(201, 2),
    ]`

(I also got my AC70 working, will look to raise a PR once I understand it, credit goes to https://github.com/warhammerkid/bluetti_mqtt/pull/79/files#diff-7aa5b0d59d4ef05cd54a94d747e6425bd1d696332414295a2f03bf6c907e7e8e as thats where i got the values from )

Patrick762 commented 7 months ago

@Eyeanman Feel free to open a PR if you already figured it out. I copied over most of the parts, but tried to keep it as lightweight as possible. Maybe I just forgot some parts

GammaPotato commented 7 months ago

I cant talk with that but have u seen the ossue wirh timeout?

ItsMe00007 commented 7 months ago

@Eyeanman "I compared devices/ac300.py vs" Where did you find the devices/ac300.py in your Bluetti BT integration ?

I have an AC500 and the battery information is missing, but I have not found an ac500.py file in the local directory: /homeassistant/custom_components/bluetti_bt/ Maybe that is the reason ???

Or how can I be sure that my Bluetti bt installation is using the ac500 definitions ?

Patrick762 commented 7 months ago

Today I got my new EB3A and most likely found the "problem". I'll publish the next version later

Patrick762 commented 7 months ago

The "problem" was the writable_ranges part

Patrick762 commented 7 months ago

@twister36 @Eyeanman @ItsMe00007 Should be solved in version 0.0.20

GammaPotato commented 7 months ago

@Patrick762 New warning since the new update

2024-03-14 22:37:36.038 WARNING (MainThread) [custom_components.bluetti_bt.bluetti_bt_lib.bluetooth.device_reader] Got an invalid request error for WriteSingleRegister(address=3006, value=0x01): MODBUS Exception WriteSingleRegister(address=3006, value=0x01): 2
2024-03-14 22:37:56.588 WARNING (MainThread) [custom_components.bluetti_bt.bluetti_bt_lib.bluetooth.device_reader] Got an invalid request error for WriteSingleRegister(address=3006, value=0x01): MODBUS Exception WriteSingleRegister(address=3006, value=0x01): 2
Patrick762 commented 6 months ago

@GammaPotato Should be working. Is this still an issue with 0.0.21?

GammaPotato commented 6 months ago

@Patrick762 Yes. when your reboot HA or full system its still there as long HA didnt has a connection to powerstation again.

EDIT but not when your not connecting after a while. only after reboot but i think its is normal

Patrick762 commented 6 months ago

That's what I would describe normal

GammaPotato commented 6 months ago

then its fixed.