Giter Club home page Giter Club logo

Comments (6)

corbinbs avatar corbinbs commented on July 27, 2024

Hi @lygris - I've been working up some additional setup/wiring how-to information for the project's README. I'll see if I can get that commit'ed tonight (I'm on US/Eastern time) so you'll have the information you need for this weekend.

Some very quick notes off the top of my head to help out in the interim...

You should be able to pip install solarshed if you want to use the latest official release.
https://pypi.org/project/solarshed/

python -m solarshed.server

is the command to run the process that will periodically collect data from a Renogy Rover solar charge controller connected to /dev/ttyUSB0 on your Raspberry Pi / computer over USB.
/dev/ttyUSB0 is not yet a configurable setting but will be soon. If for some reason, you have other USB stuff connected to your Pi/computer and the Rover doesn't show up as /dev/ttyUSB0, you can change it up at https://github.com/corbinbs/solarshed/blob/master/solarshed/server.py#L31

If you're using a system that has systemd available, there's a template https://github.com/corbinbs/solarshed/blob/master/systemd/solarshed.service for installing this as a service so it's launched on boot up.

With the solarshed.server process up and running, you should be able to point your prometheus server to the Pi/computer running it and start scraping the data it exposes at /metrics

There's a very basic grafana dashboard that will show off most of the basic data collection
https://github.com/corbinbs/solarshed/blob/master/grafana/basic_solarshed_dashboard.json
and you can extend/customize it once it's loaded up on your grafana server.

Thanks for the interest in the solarshed library!
I'll follow up with the more "official" setup soon.

Brian
🚜💻

from solarshed.

corbinbs avatar corbinbs commented on July 27, 2024

Hi @lygris - I've updated the README with more information.

The https://github.com/corbinbs/solarshed#installation section contains information about how to get started with the library (for both development and just using the library's server process to expose metrics data to prometheus so you can get stuff showing up in grafana)

I also added a wiring sketch for the reference implementation solarshed trailer.

I'm interest in feedback on other things that are still missing or what might be helpful.

Thanks,

Brian
🚜 💻

from solarshed.

lygris avatar lygris commented on July 27, 2024

Thanks for the update! I come from a sysadmin/network engineer background so excuse me if this is a dumb question. Is there a simple way i can have something scrape data from Prometheus when it is available? I have solar panels mounted on a van i'm converting to a camper and i would like to keep the stats on a server i run in my house along with the grafana server. So when the van is in my drive way things are accessible, but if i'm taking it on a trip i would like to be able to pull the duration of the trips metrics when i return home. Currently i'm using another system that runs on nodejs and have an influxdb running on the raspberry pi in the van, i'm having trouble coming up with a way to sync all the stats that reside on the raspi to my home server, and the raspi has limited storage.

from solarshed.

corbinbs avatar corbinbs commented on July 27, 2024

Hi @lygris - this scenario is something I've also been considering for cases where our solarshed trailer is on the move. 95% of the time, it's in a field where WiFi is available and I've been collecting data on it from that location for over a year with the solarshed.server <- prometheus <- grafana set up.

Right now, if you wanted to capture and retain metrics when on the go, you'd need to use the library to construct a program that basically does what the solarshed.server process is doing except it writes it to some local storage (like influxdb, sqlite, etc) and then that can sync up or export/import when back online. I've been 🤔 about bundling a process like this in the library in a future release that will help bridge this gap in time when your off-grid power is really off-grid (no local WiFi , no Internet connectivity) If I want to keep years of data on these solarshed trailers, then I also probably need to consider how that data should migrate to "long term storage"
Grafana can support a variety of data sources https://grafana.com/docs/features/datasources/ and I could probably flip to one of those other options.

My home grafana / prometheus server is also a Raspberry Pi though. It's been doing pretty well running with a larger memory card. It's currently used 10% of a 32GB card. So you probably could pack a good chunk of data just on local storage.

Another possible solution could be running prometheus locally on the Pi connected to the solar charge controller and then exporting the data from it into one of the other data source options that grafana supports. There's a script to export metrics from prometheus bundled in the project now:
https://github.com/corbinbs/solarshed/blob/master/prometheus/metrics_export.py
I've used this to export collected data as a CSV for analysis by other tools.

Prometheus also has some other options like https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations that includes the option of https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write
I've not really looked into these configuration options too deeply for this specific problem.

It may be possible to run prometheus locally to scrape the existing solarshed.server process and store that data locally until it can successfully write it out for remote/long term storage.
I suspect the queue_config in that documentation section is important for "off line" mode since it looks like that's where you can set up the number of retries, how long data sits in queue before they get dropped, etc. I'm now curious about that remote write handling so I might just give that a try when I can get to it.

If you have other suggestions/feedback for handling this online/offline switching to retain all of the metrics data, I'd be interesting in hearing that to see if we can come up with something to strengthen this area of the library/process.

Thanks,

Brian

from solarshed.

lygris avatar lygris commented on July 27, 2024

I've gotten everything up and running, was wondering where i can change the collection interval? looks like it is at 10 minutes right now and i'd like to bring that down to 1-5 minutes i think.

from solarshed.

corbinbs avatar corbinbs commented on July 27, 2024

Hi @lygris - I need to get this extracted into a configuration setting but for now, you can just change https://github.com/corbinbs/solarshed/blob/master/solarshed/server.py#L9 to the value you want and restart the service and it should start to poll more frequently for solar charge controller changes.

I've been 🤔 more about the "airplane mode" for solarshed and we might be able to introduce something that writes to influxdb locally and then syncs that data up to another influxdb instance when WiFi/Internet connectivity is restored. I'm interested in something like that for my own work and might take a shot at throwing up a MR for it.
We'd still expose data as gauges for prometheus scraping but could also enable local influxdb writes via a configuration option. Then bundle some other tools to help sync data that was written locally while offline to a primary influxdb for graphana usage. I think prometheus also has support for relaying data to influxdb as a long term storage option.

Thanks
Brian

from solarshed.

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.