Git Product home page Git Product logo

fenecon-solar-dashboard's Introduction

Fenecon-Solar-Dashboard

A web app for logging and displaying solar voltage values for a fenecon solar collector system.
It primarly displays the average (average over all battery cells) voltage for every battery module. Every module has 14 cells. These values are collected from the battery tower using the fenecon API and then stored in a csv file.

Installation Linux/RaspberryPi
Installation Windows
Data Location
Some docker commands
Troubleshooting

There are two applications each is run as its own process or docker container:

  • The data logging script at data_logging_Scripts/collectDataVoltageV5.py
  • the dashboard app (the files outside data_logging_scripts)

The IP and the number of modules in the config.json may need to be changed depending on your battery module and it's ip address.

biggif_example

biggif_example

deploying using docker

I recommend using a raspberry pi, as both the data collection script and the dashboard server are supposed to run permanent.

On the host machine:

On Linux / raspberry pi

1. install docker (here with convenience script)

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

Other options on docker docs.
Full raspberry docker installation guide here.

2. Check installation by running hello-world

sudo docker run hello-world

3. Clone this repository (git should be preinstalled in most linux systems)
navigate to a target directory then:

git clone https://github.com/Pyrokahd/Fenecon-Solar-Dashboard.git

Setting a static IP for your raspberry pi

Note you still have to set a static IP in your router settings.

If the server is a raspberry pi (i am using a raspberry pi 4) then you might want to set a static ip adress for it:

  1. Get Router IP and DNS IP
    Enter in a terminal
ip r
grep "namesever" /etc/resolv.conf

The ROUTER IP is the first ip after "default via". The DNS IP is the IP from the second command.

  1. Edit dhcpcd.conf
nano /etc/dhcpcd.conf
  1. Add the following lines at the end
interface [INTERFACE]
static_routers=[ROUTER IP]
static domain_name_servers=[DNS IP]
static ip_address=[STATIC IP ADDRESS YOU WANT]/24
  1. save and close the file, restart the raspberry

Interface is either wlan0 or eth0 depending on wifi or ethernet connection.
Example:

interface eth0
static_routers=192.168.1.1
static domain_name_servers=192.168.1.1
static ip_address=192.168.1.200/24

Start data collections script

1. Open a terminal

2. Navigate to data_logging_scripts directory in this repo (...\Fenecon-Solar-Dashboard\data_logging_scripts)

3. Change API URL and amount of modules to your battery tower
Open the config.json file and adjust the IP address (batteryIP) to your local adress from your battery tower, including the port.
Also adjust the number of modules (module_count) to the correct amount.

4. Create docker image
(this may take some time)

docker build -t datacollection-docker .

5. Create a docker Volume (to persistently save the data outside a docker container)

docker volume create fenDataVolume

6. Run image in a docker container (with mounted volume)

docker run --mount source=fenDataVolume,destination=/app/data datacollection-docker

Start Dashboard server

1. Open a new terminal

2. Navigate to this repo (...\Fenecon-Solar-Dashboard)

3. Create docker image
(this may take even more time)

docker build -t fdashboard-docker .

4. Create a docker Volume (should already be there from step 4 in the previous section, but calling it twice doesn't hurt)

docker volume create fenDataVolume

5. Run image in a docker container (with access to port 80 and with mounted volume)

docker run --publish 80:80 --mount source=fenDataVolume,destination=/app/data fdashboard-docker

6. Wait 4 minutes (The data collection first needs to create the csv file by making API requests)

7. check your local ip adress
In a new Terminal enter:

ifconfig

The Ip adress is something like 192.168.1...

8. Enter that IP adress into a browser on a machine connected to the same network

Note: Installation via SSH

When using SSH to connect to the host machine (in example a raspberry pi) make sure to run the docker run ... commands in a virtual terminal like Linux screen. So you open a terminal on your computer, connect to the raspberry or linux machine via SSH, then you run the commands and before the docker run command enter a screen. This way you can close the terminal on your computer without interrupting the running programs (docker container). To install linux screen on the host machine use sudo apt-get install screen.

Linux Screen commands

create screen

screen -S NAME

enter screen

screen -r NAME

leave screen press: ctrl+a+d

list screens

screen -ls

On Windows

1. Enable WSL See Microsoft WSL installation Guide

2. Install docker desktop Docker installation guide

3. Restart your computer

4. Check installation by running hello-world
In a terminal enter:

docker run hello-world

5. Download this Repo as ZIP, unzip at target directory

Start data collections script

1. Open a terminal

2. Navigate to data_logging_scripts directory in this repo (...\Fenecon-Solar-Dashboard\data_logging_scripts)

3. Change API URL and amount of modules to your battery tower
Open the config.json file and adjust the IP address (batteryIP) to your local adress from your battery tower, including the port.
Also adjust the number of modules (module_count) to the correct amount.

4. Create docker image

docker build -t datacollection-docker .

5. Create a docker Volume (to persistently save the data outside a docker container)

docker volume create fenDataVolume

6. Run image in a docker container (with mounted volume)

docker run --mount source=fenDataVolume,destination=/app/data datacollection-docker

Start Dashboard server

1. Open a new terminal

2. Navigate to this repo (...\Fenecon-Solar-Dashboard)

3. Create docker image

docker build -t fdashboard-docker .

4. Create a docker Volume (should already be there from step 4 in the previous section, but calling it twice doesn't hurt)

docker volume create fenDataVolume

5. Run image in a docker container (with access to port 80 and with mounted volume)

docker run --publish 80:80 --mount source=fenDataVolume,destination=/app/data fdashboard-docker

6. Wait 4 minutes (The data collection first needs to create the csv file by making API requests)

7. check your local ip adress
In a new Terminal enter:

ipconfig

The Ip adress is something like 192.168.1...

8. Enter that IP adress into a browser on a machine connected to the same network

file storage - Where is my data?

The created csv file is stored in the docker containers and shared on the volume.

Docker volumes can be found in windows (with WSL enabled - linux for windows) via the filebrowser,
enter: \\wsl$\docker-desktop-data\data\docker\volumes

In Linux the path is (you need admin/root rights): /var/lib/docker/volumes/

Some docker commands

Show Images installed:

docker image ls

Show created volumes:

docker volume ls

Show docker container:

docker container ls

Stop and remove docker container:

docker stop <Container_ID> docker rm <Container_ID>

Troubleshooting

If the dashboard server is not running after 5 minutes, remove the docker container running it (see section Some docker commands). Then recreate and run the container with the docker run command in the installation guide.

If this doesn't help you can check if the csv file has been generated or not (section file storage). If there is a csv file then the server should run unless the connection is somehow prevented.

fenecon-solar-dashboard's People

Contributors

pyrokahd avatar

Watchers

Stefan Feilmeier avatar  avatar Jens Breitung avatar

fenecon-solar-dashboard's Issues

Update of "requirements.txt" needed for Python 3.12.0

Both files "requirements.txt" list
"numpy==1.24.3".

Python 3.12.0 (Oct. 02 -2023) does not digest that version and throws an error when building a docker container.
Recommendation:
update to "numpy==1.26.2"
With this change both docker containers are build.
I cannot verify any side effects of the new numpy version at the moment.

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.