Giter VIP home page Giter VIP logo

Comments (8)

peterpiglet avatar peterpiglet commented on August 14, 2024 1

Okay, I tried it from the Raspberry OS and the same error appeared.

Traceback (most recent call last):
File "/home/arnispeicher/Docker/bms-monitoring-stack-master/bms-db/bms-db", line 158, in
main()
File "/home/arnispeicher/Docker/bms-monitoring-stack-master/bms-db/bms-db", line 149, in main
device = AnyDevice(mac_address=sys.argv[1], manager=manager, c=c, conn=conn)
File "/home/arnispeicher/Docker/bms-monitoring-stack-master/bms-db/bms-db", line 23, in init
super().init(**kwargs)
File "/usr/local/lib/python3.9/dist-packages/gatt/gatt_linux.py", line 256, in init
device_object = self._bus.get_object('org.bluez', self._device_path)
File "/usr/lib/python3/dist-packages/dbus/bus.py", line 241, in get_object
return self.ProxyObjectClass(self, bus_name, object_path,
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 246, in init
_dbus_bindings.validate_object_path(object_path)
ValueError: Invalid object path '/org/bluez/hci0/dev_BMSINFO.PY': contains invalid character '.'

So I guess your suggestion that code changes are needed due to new versions of those packages is correct. Read something similar concerning a invalid character '-' error in a forum somewhere.

Thanks for your help!

Maybe my googling skills will get me somewhere. If I should manage to solve the problem, I will post the solution. Just in case someone stumbles upon this.

Cheers!

from bms-monitoring-stack.

stefanandres avatar stefanandres commented on August 14, 2024

I didn't encounter this behavior, but my guess is:
https://github.com/stefanandres/bms-monitoring-stack/blob/master/bms-exporter/bms_exporter/main.py#L34
This reads the returned values from the sqlite file.
I could imagine this will fail when don't have any entries in the db yet.

Can you check if you have any records in the sqlite database yet? (those are written by the bms-db container)

from bms-monitoring-stack.

peterpiglet avatar peterpiglet commented on August 14, 2024

Hi,
I am a noob trying to run your code :-D

I have encountered the same error on the exporter side.

Tried to look into the problem on the bms-db side as you suggested @stefanandres. The database, so the file bms.db seems to have no content except for the header. I ran the following command to start bms-db in terminal:

$ sudo docker run -it -v /home/arnispeicher/Docker/bms-monitoring-stack-master/bms-db:/app -v /run/dbus/system_bus_socket:/run/dbus/system_bus_socket --privileged bms-db

From here, I tried to run python3 bms-db bmsinfo.py A4:C1:38:91:C6:XY within the app directory. This outputs the following Error:

Traceback (most recent call last):
File "bms-db", line 158, in
main()
File "bms-db", line 149, in main
device = AnyDevice(mac_address=sys.argv[1], manager=manager, c=c, conn=conn)
File "bms-db", line 23, in init
super().init(**kwargs)
File "/usr/local/lib/python3.6/dist-packages/gatt/gatt_linux.py", line 256, in init
device_object = self._bus.get_object('org.bluez', self._device_path)
File "/usr/lib/python3/dist-packages/dbus/bus.py", line 241, in get_object
follow_name_owner_changes=follow_name_owner_changes)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 244, in init
_dbus_bindings.validate_object_path(object_path)
ValueError: Invalid object path '/org/bluez/hci0/dev_BMSINFO.PY': contains invalid character '.'

So there seems to be an invalid path due to the character '.'

btw, I looked into bluetooth functionality, because I read that this might be related to the dbus access set in the docker run. I ran bluetoothctl and scan on then connect A4:C1:38:91:C6:XY from within the container. Which shows and connects to my Liontron. And when I check from the host via ps aux | grep blue I see a root user accessing bluetoothd. So i guess bluetooth access from the container side is fine.

Sorry, if my approach makes no sense :-D Maybe you could help me out, point me in the right direction?

Cheers!

from bms-monitoring-stack.

stefanandres avatar stefanandres commented on August 14, 2024

Well, honestly I have no idea.
I think I sometimes used hcitool to manually check some stuff.
Are you sure your bt device is also named hci0? I've just hard coded that in https://github.com/stefanandres/bms-monitoring-stack/blob/master/bms-db/bms-db#L19

I basically only use it with Raspberry Pi OS.

from bms-monitoring-stack.

peterpiglet avatar peterpiglet commented on August 14, 2024

I am also running this on Raspberry Pi OS (Lite).

I just checked with hcitool dev the output states:

Devices:
hci0 DC:A6:32:18:A2:XY

To my understanding, this indicates that the hci0 is indeed correct?

from bms-monitoring-stack.

stefanandres avatar stefanandres commented on August 14, 2024

Yep, you could also try running it without docker
For this you have to install all the dependencies manually directly on the OS and run the ./bms-db python script.

See https://github.com/stefanandres/bms-monitoring-stack/blob/master/bms-db/Dockerfile for all the required packages. It's also possible that newer versions of any of those requirements needs changing of the code, but my Pi is shutoff and I probably won't put any more effort into this project.

from bms-monitoring-stack.

santi903 avatar santi903 commented on August 14, 2024

hello stefan,

today i've found some time to check your suspect. You were right, this is the solution! There were no entries in the sqlite db. The problem was, that there was no automatic connection established between my pi and the bms. I connected manually via shell in docker container. Now it's working fine, thanks for your help!

from bms-monitoring-stack.

stefanandres avatar stefanandres commented on August 14, 2024

Cool, how did you connect it? Usually this is not needed since the bms-db does the connection itself 🤔

from bms-monitoring-stack.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.