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

install ok, but execute shows 'The name is not activatable' error. #6

Open
notterme opened this issue Nov 21, 2024 · 1 comment
Open

Comments

@notterme
Copy link

Ran the install process as per the README:

Successfully built bluetti_mqtt
Installing collected packages: crcmod, paho-mqtt, dbus-fast, bleak, aiomqtt, bluetti_mqtt
Successfully installed aiomqtt-2.3.0 bleak-0.22.3 bluetti_mqtt-0.16.0 crcmod-1.7 dbus-fast-2.24.4 paho-mqtt-2.1.0

But on executing 'bluetti-mqtt --scan' I'm greeted with the following error messages:

(venv) [me@myhost venv]$ bluetti-mqtt --scan
Scanning....
Traceback (most recent call last):
  File "/home/me/bin/bluetti/venv/bin/bluetti-mqtt", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/me/bin/bluetti/venv/lib/python3.12/site-packages/bluetti_mqtt/server_cli.py", line 156, in main
    cli.execute()
  File "/home/me/bin/bluetti/venv/lib/python3.12/site-packages/bluetti_mqtt/server_cli.py", line 68, in execute
    asyncio.run(scan_devices())
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/me/bin/bluetti/venv/lib/python3.12/site-packages/bluetti_mqtt/bluetooth/__init__.py", line 17, in scan_devices
    devices = await BleakScanner.discover()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/bin/bluetti/venv/lib/python3.12/site-packages/bleak/__init__.py", line 320, in discover
    async with cls(**kwargs) as scanner:
               ^^^^^^^^^^^^^
  File "/home/me/bin/bluetti/venv/lib/python3.12/site-packages/bleak/__init__.py", line 158, in __aenter__
    await self._backend.start()
  File "/home/me/bin/bluetti/venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/scanner.py", line 168, in start
    manager = await get_global_bluez_manager()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/bin/bluetti/venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/manager.py", line 1058, in get_global_bluez_manager
    await instance.async_init()
  File "/home/me/bin/bluetti/venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/manager.py", line 286, in async_init
    assert_reply(reply)
  File "/home/me/bin/bluetti/venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/utils.py", line 20, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.freedesktop.DBus.Error.ServiceUnknown] The name is not activatable
(venv) [me@myhost venv]$ 

Did I miss installing some dependency?

@notterme
Copy link
Author

Ah, I think I forgot to install bluez.. It is running now. Sorry for the confusion.

Since I'm super-new at using mqtt from the commandline, how do I query the current state of the battery? I'm not using anything HA or node-red.

I've got the client connected to the broker:

(venv) [me@myhost bluetti]$ bluetti-mqtt --broker 127.0.0.1 F4:D9:19:48:1F:DE
2024-11-21 20:47:46 INFO     Connecting to MQTT broker...
2024-11-21 20:47:46 INFO     Starting to poll clients...
2024-11-21 20:47:46 INFO     Connecting to clients: ['F4:D9:19:48:1F:DE']
2024-11-21 20:47:46 INFO     Connected to MQTT broker
2024-11-21 20:47:51 INFO     Connected to device: F4:D9:19:48:1F:DE
2024-11-21 20:47:51 INFO     Device F4:D9:19:48:1F:DE has name: EB3A2314000970412
2024-11-21 20:47:52 INFO     Sent discovery message of EB3A-2314000970412 to Home Assistant

and I've subscribed to the topic:
$ mosquitto_sub -h localhost -t "/bluetti/state/F4:D9:19:48:1F:DE/total_battery_percent"

But I'm completely stuck with getting it to trigger spitting out a percentage.

mosquitto_pub -h 127.0.0.1 -t "bluetti/command/F4:D9:19:48:1F:DE" -m "total_battery_voltage"

produces this on the bluetti-mqtt client console:
WARNING unknown command topic: bluetti/command/F4:D9:19:48:1F:DE

..and this on journalctl -u mosquitto -f

Nov 21 20:54:39 myhost mosquitto[812]: 1732182879: New connection from 127.0.0.1:40740 on port 1883.
Nov 21 20:54:39 myhost mosquitto[812]: 1732182879: New client connected from 127.0.0.1:40740 as auto-AA16A47A-4249-7D79-6263-D961832AE725 (p2, c1, k60).
Nov 21 20:54:39 myhost mosquitto[812]: 1732182879: Client auto-AA16A47A-4249-7D79-6263-D961832AE725 disconnected.

I checked the READMEs from warhammerkid and this one, but they don't provide any examples on how to interrogate the bluetti using mqtt.

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

1 participant