warhammerkid / bluetti_mqtt

MQTT interface for Bluetti power stations
MIT License
139 stars 53 forks source link

Get Error AC200MAX and Python 3.10 on Windows10 #7

Closed fluchderpixel closed 2 years ago

fluchderpixel commented 2 years ago

Hi warhammerkid,

at first, thanks for your work!!!!

I'm not a programmer and my english is terribel :-)

At first I used the "bluetti-logger --scan" options and get an Error:

PS C:\Users\fluch> bluetti-logger --scan

Scanning.... Traceback (most recent call last): File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\Scripts\bluetti-logger.exe__main__.py", line 7, in File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\site-packages\bluetti_mqtt\logger_cli.py", line 119, in main asyncio.run(scan()) File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete return future.result() File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\site-packages\bluetti_mqtt\logger_cli.py", line 24, in scan bluetti_devices = [d for d in devices if prefix.match(d.name)] File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\site-packages\bluetti_mqtt\logger_cli.py", line 24, in bluetti_devices = [d for d in devices if prefix.match(d.name)] TypeError: expected string or bytes-like object

I changed the Code in logger_cli.py at line 24 and I dont get any error now:

bluetti_devices = [d for d in devices if d.name and prefix.match(d.name)]

I think some bluetooth devices has no name and we must check this.

PS C:\Users\fluch\bluetti> bluetti-logger --scan Scanning.... Found AC200M214200020XXXX: address 00:15:83:8A:F4:71

In the next step I used the "bluetti-logger--log" option and get an Error:

PS C:\Users\fluch\bluetti> bluetti-logger --log test.log 00:15:83:8A:F4:71 Connecting to 00:15:83:8A:F4:71 Waiting for connection... Task exception was never retrieved future: <Task finished name='Task-2' coro=<BluetoothClient.run() done, defined at C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\site-packages\bluetti_mqtt\bluetooth\client.py:36> exception=TimeoutError()> Traceback (most recent call last): File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\asyncio\locks.py", line 214, in wait await fut asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 456, in wait_for return fut.result() asyncio.exceptions.CancelledError

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

Traceback (most recent call last): File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\site-packages\bluetti_mqtt\bluetooth\client.py", line 51, in run await self.client.disconnect() File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\site-packages\bleak\backends\winrt\client.py", line 314, in disconnect await asyncio.wait_for(event.wait(), timeout=10) File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 458, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError

When I use the "bluetti-mqtt" I get this error:

PS C:\Users\fluch\bluetti> bluetti-mqtt --broker 192.168.188.204 --username Mqtt --password test 00:15:83:8A:F4:71 INFO:root:Connecting to clients: {'00:15:83:8A:F4:71'} INFO:root:Starting to poll clients... INFO:root:Connecting to MQTT broker... Traceback (most recent call last): File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\Scripts\bluetti-mqtt.exe__main__.py", line 7, in File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\site-packages\bluetti_mqtt\server_cli.py", line 116, in main cli.execute() File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\site-packages\bluetti_mqtt\server_cli.py", line 58, in execute asyncio.run(self.start(args)) File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete return future.result() File "C:\Users\fluch\AppData\Local\Programs\Python\Python310\lib\site-packages\bluetti_mqtt\server_cli.py", line 88, in start signals = (signal.SIGHUP, signal.SIGTERM, signal.SIGINT) AttributeError: module 'signal' has no attribute 'SIGHUP'

I don't now, is the error in bluetti-mqtt or in the MQTT-Broker. The MQTT-Broker is runing as Mosquito MQTT on a Home Assistant Raspberry 4.

So, I hope you can help :-)

Thanks so lot!!!

warhammerkid commented 2 years ago

@fluchderpixel This will be fixed in the next version released some time later today (I still have some work I want to do).