Patrick762 / hassio-bluetti-bt

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

[Bug]: Adding AC200L says failed to setup #68

Closed bradpraz closed 1 month ago

bradpraz commented 6 months ago

What happened?

Hi is it possible to install the AC200L?

It finds it on Bluetooth ok but then fails to setup entity’s for the device.

Using Raspberry Pi4 for HA and Bluetooth

image

Version

0.0.17

What device are you seeing the problem on?

AC200M

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

Error setting up entry AC200L234xxxxxxxxxx for bluetti_bt
20:18:36 - (ERROR) config_entries.py - message first occurred at 14:57:39 and shows up 3 times
filippo5589 commented 6 months ago

Hi, I have the same problem, has anyone managed to solve it?

Patrick762 commented 4 months ago

Should work in the latest beta version. There were some reports that the internal Bluetooth might not work on the RPi

Patrick762 commented 4 months ago

@bradpraz @filippo5589 You can now also use Release 0.1. All changes are now in there

bradpraz commented 4 months ago

@bradpraz @filippo5589 You can now also use Release 0.1. All changes are now in there

Thanks @Patrick762 for the updates, I’ve tested with the AC200L and it automatically finds it when turned on.

Some of the values are out by a factor of 10, see below.

AC Frequency should be 50Hz AC Voltage should be 229V Internal DC Input voltage should be 18.6V Internal DC input power should be 148W Total battery voltage should be 54.38V Is Battery pack 1 the internal battery? If so not displaying. I don’t have external batteries to test yet.

IMG_9493 IMG_9494

Patrick762 commented 4 months ago

Thanks for the detailed feedback. Next version will include the fix

Patrick762 commented 4 months ago

Regarding the pack 1, I don't know if it's the internal. The values are based on the AC200M, so there might be some differences after all

Patrick762 commented 4 months ago

Release 0.1.1 is now available with the value fixes

bradpraz commented 4 months ago

Thanks for the update, I installed 0.1.1 and got the below error and device entities unavailable. I trIed uninstalling and installing fresh but made no difference. Rolled back to 0.1 and AC200L device back online.

Log Details (ERROR) This error originated from a custom integration. Logger: custom_components.bluetti_bt.coordinator Source: helpers/update_coordinator.py:315 integration: Bluetti BT (documentation, issues) First occurred: 11:54:15 (7 occurrences) Last logged: 11:56:01

Unexpected error fetching Bluetti polling coordinator data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/bluetti_bt/coordinator.py", line 78, in _async_update_data return await self.reader.read_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/bluetti_bt/bluetti_bt_lib/bluetooth/device_reader.py", line 91, in read_data parsed = self.bluetti_device.parse( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/bluetti_bt/bluetti_bt_lib/base_devices/BluettiDevice.py", line 20, in parse return self.struct.parse(address, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/bluetti_bt/bluetti_bt_lib/utils/struct.py", line 199, in parse val = f.parse(field_data) ^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/bluetti_bt/bluetti_bt_lib/utils/struct.py", line 94, in parse return (val / 10 * self.scale) self.multiplier


TypeError: unsupported operand type(s) for *: 'decimal.Decimal' and 'float'
KardelSniper commented 3 months ago

I'm having the same issue with AC200L, so I went into the file /config/custom_components/bluetti_bt/bluetti_bt_lib/utils/struct.py (this is inside the config directory of Home Assistant), at line 94, changed the code from return (val / 10 ** self.scale) * self.multiplier to return (float(val) / 10 ** self.scale) * self.multiplier and now it no longer gives the error. Not sure if this is the best solution but it works for now. Hope this helps.

However I'm still facing the issue where it seems polling doesn't work and all entities become unavailable after some time. Restarting Home Assistant fixes the issue though, but I would imagine this might be the same bug like the AC200Max has as discussed in another issue found in this repo. Anybody else has this problem?

bradpraz commented 1 month ago

Upgraded to v0.1.4 seems to be working ok now.