Git Product home page Git Product logo

Comments (18)

marcuslib avatar marcuslib commented on July 17, 2024 1

Did not work, as it kept trying to run again and cancel the previous one; in the end, I set up a service that runs the script at the start and if it stops, restarts it. works a treat.

Copied this https://gist.github.com/emxsys/a507f3cad928e66f6410e7ac28e2990f

from renogy-bt.

cyrils avatar cyrils commented on July 17, 2024

Hello,
I haven't tested the code with Home Assistant image, its designed primarily to run on Raspberry Pi OS, and then it sends data to Home Assistant using MQTT protocol.

from renogy-bt.

marcuslib avatar marcuslib commented on July 17, 2024

from renogy-bt.

cyrils avatar cyrils commented on July 17, 2024

Yeah that might work, it makes a clean install on new raspberry image. Not sure how the IP address looks like from docker though. But ideally a dedicated hardware is better for HA.

from renogy-bt.

marcuslib avatar marcuslib commented on July 17, 2024

i have now got it working in docker, I keep getting ERROR:root:Connection failed: le-connection-abort-by-local when running python3 ./example.py, some times it works, due to know what this might be, is this because its already connected. it not connected to anything else.

from renogy-bt.

marcuslib avatar marcuslib commented on July 17, 2024

this is full out put.
(venv) xxxxxxxx@raspberry:/opt/path/to/venv/bin/renogy$ python3 ./example.py
INFO:root:Starting client: BT-TH-xxxxxxxx => ac:xxx:xxx:1c:a4:xxx
INFO:root:Adapter status - Powered: True
INFO:root:Starting discovery...
INFO:root:Devices found: 8
INFO:root:Found matching device BT-TH-xxxxxxxx => [ac:xxx:xxx:1c:a4:xxx]
ERROR:root:Connection failed: le-connection-abort-by-local

from renogy-bt.

cyrils avatar cyrils commented on July 17, 2024

Are you close enough to the device?

from renogy-bt.

marcuslib avatar marcuslib commented on July 17, 2024

from renogy-bt.

cyrils avatar cyrils commented on July 17, 2024

Is the enable_polling flag set to true in config.ini?

from renogy-bt.

marcuslib avatar marcuslib commented on July 17, 2024

from renogy-bt.

marcuslib avatar marcuslib commented on July 17, 2024

it seems to work after about 30 tries of running "python3 ./example.py" within terminal

from renogy-bt.

marcuslib avatar marcuslib commented on July 17, 2024

it seems to connect now and run, how do I get it to auto-run all the time without having to manually run the example file. thanks again

from renogy-bt.

cyrils avatar cyrils commented on July 17, 2024

If polling is enabled it should keep running. If you want to auto-start it on restarts add it to /etc/rc.local. Or you can disable polling and schedule a periodic cron job using crontab.

from renogy-bt.

marcuslib avatar marcuslib commented on July 17, 2024

im not very good with Python,

/etc/rc.local does not really work, as i want it running all the time, and if it stops, I want it to restart, I tried cron job, but cant get that to run; the only way really is to run the code below in terminal.

source /opt/path/to/venv/bin/activate && cd /opt/path/to/venv/bin/renogy && python3 ./example.py >> /opt/path/to/venv/bin/renogy/log_file.log 2>&1

from renogy-bt.

cyrils avatar cyrils commented on July 17, 2024

Run crontab -e and insert the following command:

*/5 * * * * /opt/path/to/venv/bin/renogy/example.py 

This will run every 5 minutes (turn off polling in config.ini)

from renogy-bt.

marcuslib avatar marcuslib commented on July 17, 2024

from renogy-bt.

cyrils avatar cyrils commented on July 17, 2024

Yes, you can replace it with the full command. But you get the idea, */5 means it runs every five minutes.

from renogy-bt.

marcuslib avatar marcuslib commented on July 17, 2024

Finally got it working, had to add it as */5 * * * * /opt/path/to/venv/bin/python3 /opt/path/to/venv/bin/renogy/example.py

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.