Git Product home page Git Product logo

Comments (12)

cyrils avatar cyrils commented on August 15, 2024

I've removed libscrc dependency.

from renogy-bt.

Abudinka avatar Abudinka commented on August 15, 2024

well now iam dealing with missing dbus, probably gonna look at Issue #12 and google a bit.

edit: i am indeed running into the same issues as @marcuslib did, now something about 'gi' - no idea what this is

could go with the nested docker, but not sure if i like it. overhead seem a bit unnecessary.
but a new HA/debian based raspi installation seem overkill as well.

from renogy-bt.

cyrils avatar cyrils commented on August 15, 2024

Were you able to resolve the issue? May be installing dbus-python will help

from renogy-bt.

Abudinka avatar Abudinka commented on August 15, 2024

unfortunately no, terminal says dbus is installed, but wont find it when running the script.

when i finally got dbus out of the way, its complaining about gi instead

i dont know if the script some kind of raspberry exclusive, but couldnt make gatt work with ubuntu either

from renogy-bt.

marcuslib avatar marcuslib commented on August 15, 2024

I got it to work in the end by installing HA in docker and then had to install python within a VM. To run it i then had to create a service to run the python script, it will also check if its running and if not run it, as I did find it took a few times to run the script for it to pickup the BT-1.

from renogy-bt.

Abudinka avatar Abudinka commented on August 15, 2024

I got it to work in the end by installing HA in docker and then had to install python within a VM. To run it i then had to create a service to run the python script, it will also check if its running and if not run it, as I did find it took a few times to run the script for it to pickup the BT-1.

yes, i noticed. But i dont want to move HA back to docker. I used to use docker, but couldnt use addons, so i switched to native.

I dont really understand why gatt is behaving the way it does. maybe we can dockerize the whole thing to make it easier? i tried something along the lines, but ran into the very same issues. plus you need some way to expose bt to the docker.

I will most likely try a different ble interface and clone the renogy logic, dont know tbh

from renogy-bt.

Abudinka avatar Abudinka commented on August 15, 2024

update: since the SoC supplied by the bluetooth is not accurate, so there is no need to implement it in HA for me

from renogy-bt.

didi767 avatar didi767 commented on August 15, 2024

@Abudinka is there a guide on how to implement this in HA? I'm not an expert, but I was planning to install Ubuntu and then HA on my orange pi zero 3.
Im sure it would be an adventure to figure this out, but if you have any clear steps on how to achieve it that would be awesome.
At first i thought about going with the RS485 method until I saw that we can actually interpret the BL2, which is amazing!

from renogy-bt.

Abudinka avatar Abudinka commented on August 15, 2024

sorry cant help here, as i said i dropped attempting renogy bluetooth communication since there is nothing to gain for me. if available i recommend using the home assistant raspberry pi image directly instead of using ubuntu. initially i used ubuntu and HA docker, but it has some drawbacks like no addon support. switched to raspberry pi 4B and used the HA image available in Raspberry Pi Imager.

from renogy-bt.

lbeckingsale avatar lbeckingsale commented on August 15, 2024

I'd still be interested in getting this to work directly in HA. I'll have a tinker with it and see if I can work it out.

from renogy-bt.

cruscio avatar cruscio commented on August 15, 2024

Ran into Module 'dbus' not found on headless Raspberry PI. Something in all of this fixed it:

pip3 install --user -r requirements.txt
sudo apt-get install python3-dbus
sudo apt install libdbus-1-3 libdbus-1-dev
sudo apt-get install libglib2.0-dev
sudo apt install python3-pydbus
python3 -m pip install --user dbus-python

And then I ran into

  File "/home/cruscio/.local/lib/python3.12/site-packages/gatt/gatt_linux.py", line 13, in <module>
    from gi.repository import GObject
ModuleNotFoundError: No module named 'gi'

Which should be fixed by running

pip3 install --user PyGObject

But that fails ... So then:

sudo apt install libcairo2 libcairo2-dev
pip3 install --user PyGObject

Another new failure. Log says to install libgirepository1.0-dev

sudo apt install libgirepository1.0-dev
pip3 install --user PyGObject

Finally! The PyGObject install worked, though it might have been easier to install libgtk2.0-dev (which a stackoverflow post for libglib2.0-dev mentioned

And now I get

ModuleNotFoundError: No module named 'requests'

./facepalm

pip3 install --user requests

ANNNNND finally ...

python3 ./example.py config.ini
INFO:root:Init BatteryClient: BT-TH-XXXXXXXX => XX:XX:XX:XX:XX:XX
INFO:root:Adapter status - Powered: True
INFO:root:Starting discovery...

Couple thoughts:

  1. @cyrils - It seems a few requirements are missing from requirements.txt (not complaining. I definitely appreciate all the work you've shared here. Just wanted to call out that it may be worth adding all the requirements to requirements.txt :) )
  2. I don't understand why there are so many things (glib2, cairo, GObject) that seem tied to GTK in a non-gui application...? (maybe this has something to do with accessing BT?)

Now if only I could figure out how to discover my battery info without needing to dismantle my battery box to muck with the daisy chain. (Bluetooth logging while running the android app shows chatter in wireshark, but I'm not smart enough to decipher it :( )

Anyway - I hope this helps others with similar issues.

from renogy-bt.

cyrils avatar cyrils commented on August 15, 2024

Hm.. I think the gatt library uses these for some reason. A regular raspberry pi image includes all of these by default, never tested it over headless image. Doesn't hurt to include them into requirements.txt though.

And unfortunately the app does not show the device id. Currently the only way to get the individual Ids is to connect one device at a time. However you can try some usual suspects for batteries:

33, 34, 35.. series
48, 49, 50..
97, 98..
247, 248..

from renogy-bt.

Related Issues (20)

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.