nakla / sbfspot

Scripts for building and running the docker container
18 stars 10 forks source link

sbfspot

This Docker Image provides SBFspot, an open source project located at github (SBFspot on github). It includes:

Prerequisites

To run SBFspot, you must provide a configuration file (SBFspot.cfg) and map it in the container. Please also make a backup of your config as the container edits the file. To run SBFspotUploadDaemon, you must provide a configuration file (SBFspotUpload.cfg) and map it in the container.

Caveats

If your Inverters communicate with Bluetooth, you have to start the SBFspot container in the host network (Option --network host, see usage examples below). Thereby every device including Bluetooth devices are mapped to the container. The bad about this is, that every host-device is also accessible in the container. If someone knows a workaround or besser solution for this, then please let me know.

Volumes

The mapped host volumes should be read- and writeable for user with ID 5000 or group with ID 5000, the config files also.

Environment variables

General

ENABLE_SBFSPOT

ENABLE_SBFSPOT_UPLOAD

SBFSPOT_INTERVAL

TZ

List of all time zones can be found on wikipedias tz database site, column "TZ database name".

DB_STORAGE

If you want to upload your production data to PVoutput, you have to store them in a database. Otherwise, it is optional. Read the paragraph "Database initialization" to setup your DB.

CSV_STORAGE

If you want to store your production data in CSV files, chose this option. You can additionally store your data in a Database and/or publish them through MQTT.

MQTT_ENABLE

If you want to publish your production data to an MQTT Broker, chose this option. You can additionally store your data in a Database and/or CSV files.

(If you want to use MQTT, setup the MQTT Options in the SBFspot.cfg file.)

SBFspot options

The following Options can be used directly as environment variables.

QUIET

FINQ or alternatively FORCE

SBFSPOT_ARGS

Database initialization

INIT_DB

If you choose sqlite in the DB_STORAGE variable, a new database file under /var/sbfspot will be created and set up.

If you choose mysql or mariadb, a connection to the DB Server configured in SBFspot.cfg will be opened and a SBFspot database and user created. (You have to setup your user and DB Connection in SBFspot.cfg.)

DB_ROOT_USER

DB_ROOT_PW

After the Database is set up, please delete the three database initialization variables. For security reasons, normal operation is prohibited, if administrative accounts are provided.

Usage

Examples for using the container: Initialize a new mysql Database

docker run -e "DB_STORAGE=mysql" -e "INIT_DB=1" -e "DB_ROOT_USER=root" -e "DB_ROOT_PW=secret" 
   -v /path/to/your/config/dir/on/host:/etc/sbfspot -v /path/to/your/data/dir/on/host:/var/sbfspot nakla/sbfspot:latest

Start only SBFspot and store inverters data in a mariadb Database configured in SBFspot.conf

docker run --network host -e "DB_STORAGE=mariadb" -e "ENABLE_SBFSPOT=1" -e "TZ=Europe/Berlin" 
   -v /path/to/your/config/dir/on/host:/etc/sbfspot -v /path/to/your/data/dir/on/host:/var/sbfspot nakla/sbfspot:latest

Start only SBFspot and store inverters data in csv files on the host in the directory /path/to/your/data/dir/on/host

docker run --network host -e "CSV_STORAGE=1" -e "ENABLE_SBFSPOT=1" -e "TZ=Europe/Berlin" 
   -v /path/to/your/config/dir/on/host:/etc/sbfspot -v /path/to/your/data/dir/on/host:/var/sbfspot nakla/sbfspot:latest

Start SBFspot, store inverters data in a mysql Database and upload inverters Data to pvoutput.org

docker run --network host -e "DB_STORAGE=mysql" -e "ENABLE_SBFSPOT=1" -e "ENABLE_SBFSPOT_UPLOAD=1" 
   -v /path/to/your/config/dir/on/host:/etc/sbfspot -v /path/to/your/data/dir/on/host:/var/sbfspot nakla/sbfspot:latest

You can also use the following docker-compose.yaml file to start your container.

version: '3'

services:
    sbfspot:
        image: nakla/sbfspot:latest
        network_mode: host
        volumes:
            - ~/sbfspot/etc:/etc/sbfspot
            - ~/sbfspot/data:/var/sbfspot
        environment:
            TZ: Europe/Berlin
            ENABLE_SBFSPOT: 1
            SBFSPOT_INTERVAL: 600
            ENABLE_SBFSPOT_UPLOAD: 0
            DB_STORAGE: sqlite
            CSV_STORAGE: 1
            MQTT_ENABLE: 1
            QUIET: 0
            SBFSPOT_ARGS: -d0 -v2
            INIT_DB: 0
        restart: always

License

Attribution - NonCommercial - ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)

In short, you are free:

Disclaimer

A user of SBFspot software acknowledges that he or she is receiving this software on an "as is" basis and the user is not relying on the accuracy or functionality of the software for any purpose. The user further acknowledges that any use of this software will be at his own risk and the copyright owner accepts no responsibility whatsoever arising from the use or application of the software.

SMA, Speedwire are registered trademarks of SMA Solar Technology AG