dev upload
This commit is contained in:
parent
6905772edd
commit
3d93f8863b
18 changed files with 1077 additions and 374 deletions
96
.github/workflows/addon-ci.yaml
vendored
96
.github/workflows/addon-ci.yaml
vendored
|
@ -1,11 +1,12 @@
|
|||
---
|
||||
name: CI
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
# yamllint disable-line rule:true
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
workflow_call:
|
||||
inputs:
|
||||
slug:
|
||||
|
@ -51,7 +52,7 @@ jobs:
|
|||
- name: 🚀 Run Add-on Lint
|
||||
uses: frenck/action-addon-linter@v2.9.0
|
||||
with:
|
||||
community: true
|
||||
community: false
|
||||
path: "./${{ needs.information.outputs.target }}"
|
||||
|
||||
lint-hadolint:
|
||||
|
@ -119,94 +120,3 @@ jobs:
|
|||
prettier_options: --write **/*.{json,js,md,yaml}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
build:
|
||||
name: Build ${{ matrix.architecture }}
|
||||
needs:
|
||||
- information
|
||||
- lint-addon
|
||||
- lint-hadolint
|
||||
- lint-json
|
||||
- lint-markdown
|
||||
- lint-prettier
|
||||
- lint-shellcheck
|
||||
- lint-yamllint
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
architecture: ${{ fromJson(needs.information.outputs.architectures) }}
|
||||
steps:
|
||||
- name: ⤵️ Check out code from GitHub
|
||||
uses: actions/checkout@v3
|
||||
- name: 🏗 Set up build cache
|
||||
id: cache
|
||||
uses: actions/cache@v3.0.6
|
||||
with:
|
||||
path: /tmp/.docker-cache
|
||||
key: docker-${{ matrix.architecture }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
docker-${{ matrix.architecture }}
|
||||
- name: 🏗 Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2.0.0
|
||||
- name: 🏗 Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2.0.0
|
||||
- name: 🏗 Set up Codenotary Community Attestation Service (CAS)
|
||||
uses: frenck/action-setup-cas@v0.1.0
|
||||
- name: ℹ️ Compose build flags
|
||||
id: flags
|
||||
run: |
|
||||
echo "::set-output name=date::$(date +"%Y-%m-%dT%H:%M:%SZ")"
|
||||
from=$(yq --no-colors eval ".build_from.${{ matrix.architecture }}" "${{ needs.information.outputs.build }}")
|
||||
echo "::set-output name=from::${from}"
|
||||
|
||||
if [[ "${{ matrix.architecture}}" = "amd64" ]]; then
|
||||
echo "::set-output name=platform::linux/amd64"
|
||||
elif [[ "${{ matrix.architecture }}" = "i386" ]]; then
|
||||
echo "::set-output name=platform::linux/386"
|
||||
elif [[ "${{ matrix.architecture }}" = "armhf" ]]; then
|
||||
echo "::set-output name=platform::linux/arm/v6"
|
||||
elif [[ "${{ matrix.architecture }}" = "armv7" ]]; then
|
||||
echo "::set-output name=platform::linux/arm/v7"
|
||||
elif [[ "${{ matrix.architecture }}" = "aarch64" ]]; then
|
||||
echo "::set-output name=platform::linux/arm64/v8"
|
||||
else
|
||||
echo "::error ::Could not determine platform for architecture ${{ matrix.architecture }}"
|
||||
exit 1
|
||||
fi
|
||||
- name: ⤵️ Download base image
|
||||
if: steps.flags.outputs.from != 'null'
|
||||
run: docker pull "${{ steps.flags.outputs.from }}"
|
||||
- name: ✅ Verify authenticity of base image
|
||||
if: steps.flags.outputs.from != 'null' && needs.information.outputs.base_image_signer != 'null'
|
||||
run: |
|
||||
cas authenticate \
|
||||
--signerID "${{ needs.information.outputs.base_image_signer }}" \
|
||||
"docker://${{ steps.flags.outputs.from }}"
|
||||
- name: 🚀 Build
|
||||
uses: docker/build-push-action@v3.1.1
|
||||
with:
|
||||
push: false
|
||||
context: ${{ needs.information.outputs.target }}
|
||||
file: ${{ needs.information.outputs.target }}/Dockerfile
|
||||
cache-from: |
|
||||
type=local,src=/tmp/.docker-cache
|
||||
ghcr.io/${{ github.repository_owner }}/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:edge
|
||||
cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new
|
||||
platforms: ${{ steps.flags.outputs.platform }}
|
||||
build-args: |
|
||||
BUILD_ARCH=${{ matrix.architecture }}
|
||||
BUILD_DATE=${{ steps.flags.outputs.date }}
|
||||
BUILD_DESCRIPTION=${{ needs.information.outputs.description }}
|
||||
BUILD_FROM=${{ steps.flags.outputs.from }}
|
||||
BUILD_NAME=${{ needs.information.outputs.name }}
|
||||
BUILD_REF=${{ github.sha }}
|
||||
BUILD_REPOSITORY=${{ github.repository }}
|
||||
BUILD_VERSION=edge
|
||||
# This ugly bit is necessary, or our cache will grow forever...
|
||||
# Well until we hit GitHub's limit of 5GB :)
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
# https://github.com/moby/buildkit/issues/1896
|
||||
- name: 🚚 Swap build cache
|
||||
run: |
|
||||
rm -rf /tmp/.docker-cache
|
||||
mv /tmp/.docker-cache-new /tmp/.docker-cache
|
||||
|
|
2
.github/workflows/builder.yaml
vendored
2
.github/workflows/builder.yaml
vendored
|
@ -3,7 +3,7 @@ name: Builder
|
|||
|
||||
env:
|
||||
# BUILD_ARGS: "--test"
|
||||
MONITORED_FILES: "build.* config.* Dockerfile"
|
||||
MONITORED_FILES: "config.*"
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
4
.hadolint.yaml
Normal file
4
.hadolint.yaml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
ignored:
|
||||
- DL3006
|
||||
# Always tag the version of an image explicitly.
|
2
.mdlrc
Normal file
2
.mdlrc
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Exclude line length
|
||||
rules "~MD013", "~MD026", "~MD022"
|
3
.prettierignore
Normal file
3
.prettierignore
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
.images/Example_Config.yaml
|
||||
.github/workflows/addon-ci.yaml
|
66
.yamllint
Normal file
66
.yamllint
Normal file
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
rules:
|
||||
braces:
|
||||
level: error
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 1
|
||||
min-spaces-inside-empty: -1
|
||||
max-spaces-inside-empty: -1
|
||||
brackets:
|
||||
level: error
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 0
|
||||
min-spaces-inside-empty: -1
|
||||
max-spaces-inside-empty: -1
|
||||
colons:
|
||||
level: error
|
||||
max-spaces-before: 0
|
||||
max-spaces-after: 1
|
||||
commas:
|
||||
level: error
|
||||
max-spaces-before: 0
|
||||
min-spaces-after: 1
|
||||
max-spaces-after: 1
|
||||
comments:
|
||||
level: error
|
||||
require-starting-space: true
|
||||
min-spaces-from-content: 2
|
||||
comments-indentation:
|
||||
level: error
|
||||
document-end:
|
||||
level: error
|
||||
present: false
|
||||
document-start:
|
||||
level: error
|
||||
present: true
|
||||
empty-lines:
|
||||
level: error
|
||||
max: 1
|
||||
max-start: 0
|
||||
max-end: 1
|
||||
hyphens:
|
||||
level: error
|
||||
max-spaces-after: 1
|
||||
indentation:
|
||||
level: error
|
||||
spaces: 2
|
||||
indent-sequences: true
|
||||
check-multi-line-strings: false
|
||||
key-duplicates:
|
||||
level: error
|
||||
line-length:
|
||||
ignore: |
|
||||
.github/support.yml
|
||||
level: warning
|
||||
max: 120
|
||||
allow-non-breakable-words: true
|
||||
allow-non-breakable-inline-mappings: true
|
||||
new-line-at-end-of-file:
|
||||
level: error
|
||||
new-lines:
|
||||
level: error
|
||||
type: unix
|
||||
trailing-spaces:
|
||||
level: error
|
||||
truthy:
|
||||
level: warning
|
|
@ -1,56 +1,68 @@
|
|||
# Community Hass.io Add-ons: SBFspot
|
||||
# SBFspot addon for HAOS
|
||||
|
||||
![project-stage-shield] ![Project Maintenance][maintenance-shield]
|
||||

|
||||

|
||||

|
||||
![Project Maintenance][maintenance-shield] [](https://github.com/habuild/hassio-addons/actions/workflows/addon-ci.yaml)
|
||||
|
||||
[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg
|
||||
[maintenance-shield]: https://img.shields.io/maintenance/yes/2022.svg
|
||||
|
||||

|
||||

|
||||
[](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fhabuild%2Fhassio-addons)
|
||||
|
||||
This [home assistant](https://www.home-assistant.io/getting-started/) add-on provides the installation, configuration, and integration for the **Bluetooth** version of [SBFspot 3.9.4](https://github.com/SBFspot/SBFspot/releases/latest). This version is for the OS installation method of Home assistant.
|
||||
This [home assistant](https://www.home-assistant.io/getting-started/) add-on provides a wrapper for the **Bluetooth** version of [SBFspot 3.9.5](https://github.com/SBFspot/SBFspot/releases/latest).
|
||||
|
||||
This add-on installs a cron service for SPFspot uploader at 5 minutely daytime interval, [PVoutput](https://pvoutput.org/) account and API are required, it also requires an SQL database like Mariadb.
|
||||
It also sends a MQTT message to home assistant, therefore a MQTT broker is required.
|
||||
This add-on runs a crontab service for SBFspot and SPFspotUploader at 5 minutely daytime interval.
|
||||
|
||||
# Installation
|
||||
[PVoutput](https://pvoutput.org/) account and API are required to use the upload feature.
|
||||
|
||||
[Mariadb addon](https://github.com/home-assistant/addons/tree/master/mariadb) or similiar SQL database, is needed to store the data for upload to PVOutput.
|
||||
|
||||
[phpMyAdmin](https://github.com/hassio-addons/addon-phpmyadmin) is required to create the DB structure.
|
||||
|
||||
[MQTT broker](https://github.com/home-assistant/addons/tree/master/mosquitto) is needed to send MQTT messages to home Assistant.
|
||||
|
||||
## Installation
|
||||
|
||||
### Initial database creation.
|
||||
|
||||
Download and import either [No Drop DB create](https://github.com/habuild/hassio-addons/blob/main/.images/CreateMySQLDB_no_drop.sql) **or** [Create My SQL.sql](https://github.com/SBFspot/SBFspot/blob/master/SBFspot/CreateMySQLDB.sql) in [phpMyAdmin](https://github.com/hassio-addons/addon-phpmyadmin) to create your database. **IF** you haven't already created the database previously, use the NO Drop version. You will also need to add the Database and User/Password to MariaDB and allocate the port.
|
||||
|
||||

|
||||
|
||||
### MQTT
|
||||
[sbfspot_sensors.yaml](https://github.com/habuild/hassio-addons/blob/main/.images/sbfspot_sensors.yaml) I use packages to include these yaml sensors. You will need to change to match your plant name and serial as you have set in the add-on configuration options.
|
||||
|
||||
**MQTT arument options** [configuration options](https://github.com/habuild/hassio-addons/blob/main/.images/Example_Config.yaml) The MQTT Username, and Password need to be hardcoded into the **MQTT_PublisherArgs:** The **{host}** **{topic}** and **{{message}}** will be picked up from options.
|
||||
[haos-sbfspot_sensors.yaml](https://github.com/habuild/hassio-addons/blob/main/.images/sbfspot_sensors.yaml) I use packages to include these yaml sensors. You will need to change to match your plant name and serial as you have set in the add-on configuration options.
|
||||
|
||||
**MQTT options argument** [configuration options](https://github.com/habuild/hassio-addons/blob/main/.images/Example_Config.yaml). The MQTT Username, and Password need to be hardcoded into the **MQTT_PublisherArgs:** The **{host}** **{topic}** and **{{message}}** will be picked up from options.
|
||||
|
||||
**MQTT_PublisherArgs:** **'-h {host} -u Your_MQTT_Username -P Your_MQTT_password -t {topic} -m "{{message}}" -d -r'**
|
||||
|
||||
**-d** is for MQTT debug in log. This is helpful for confirming the MQTT messages are actually being sent.
|
||||
**-d** is for MQTT debug in log. Which is helpful for confirming the MQTT messages are actually being sent.
|
||||
|
||||
**-r** is to retain messages. retain is not advised.
|
||||
|
||||
### Find your Local BT device address with Bluetoothctl
|
||||
You can use the **bluetoothctl** command from the console(terminal or ssh addon) in homeassistant. This will list your controller mac address so you can add it to SBFspot addon config. You can also do this via portainer and connecting to this addon directly.
|
||||
**-r** is to retain messages. it is advised against using retain flag
|
||||
|
||||
### Example Configuration Options.
|
||||
can be copy/pasted as [Example Config](https://github.com/habuild/hassio-addons/blob/main/.images/Example_Config.yaml) or entered via UI
|
||||
|
||||
can be copy/pasted as [Example Config](https://github.com/habuild/hassio-addons/blob/main/haos-sbfspot/.images/Example_Config.yaml) or entered via UI
|
||||

|
||||
|
||||
### Data paths
|
||||
In HAOS (home assistant operating system) the /data/ path arrives at /mnt/data/supervisor/addons/data/{slug}_haos-sbfspot on the host.
|
||||
|
||||
In HAOS (home assistant operating system) the /data/ path arrives at /mnt/data/supervisor/addons/data/{slug}\_haos-sbfspot on the host.
|
||||
|
||||
### Upload logs
|
||||
|
||||
Logs delete after 3 days now. You would need SSH with Root host access to find them anyway.
|
||||
|
||||
### **Link to SBFspot Documentation**
|
||||
Refer to the [Wiki](https://github.com/SBFspot/SBFspot/wiki) for documentation and FAQ.
|
||||
### **Link to haos-sbfspot Documentation**
|
||||
|
||||
Refer to the [SBFspot Wiki](https://github.com/sbfspot/sbfspot/wiki) for documentation and FAQ about SBFspot.
|
||||
|
||||
### **Special thanks to:**
|
||||
* LauR3y/hassio-addons which this version is cleaned up from.
|
||||
* The SBFspot team for SPFspot.
|
||||
|
||||
- LauR3y/hassio-addons-addons which this version is cleaned up from.
|
||||
- The sbfspot team for SPFspot.
|
||||
|
||||
![Supports aarch64 Architecture][aarch64-shield]
|
||||
![Supports armhf Architecture][armhf-shield]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile
|
||||
## https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile
|
||||
ARG BUILD_FROM
|
||||
FROM $BUILD_FROM AS builder
|
||||
FROM $BUILD_FROM AS builder-base
|
||||
|
||||
# Execute during the build of the image
|
||||
ARG TEMPIO_VERSION BUILD_ARCH
|
||||
|
@ -8,28 +8,34 @@ RUN \
|
|||
curl -sSLf -o /usr/bin/tempio \
|
||||
"https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}"
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV MQTT_ENABLE 1
|
||||
|
||||
# Copy root filesystem
|
||||
COPY rootfs /
|
||||
# Set shell
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
# install requirements
|
||||
RUN apk update && apk upgrade && apk add --no-cache git g++ make mysql-dev bluez bluez-dev boost-dev curl-dev tzdata mosquitto-clients mariadb-dev
|
||||
RUN apk update && apk add --no-cache \
|
||||
bluez=5.65-r0 \
|
||||
bluez-dev=5.65-r0 \
|
||||
boost-dev=1.78.0-r1 \
|
||||
curl-dev=7.83.1-r2 \
|
||||
git=2.36.2-r0 \
|
||||
g++=11.2.1_git20220219-r2 \
|
||||
make=4.3-r0 \
|
||||
mariadb-dev=10.6.8-r0 \
|
||||
mosquitto-clients=2.0.14-r1 \
|
||||
nginx=1.22.0-r1 \
|
||||
tzdata=2022a-r0
|
||||
|
||||
# download and build SBFspot
|
||||
WORKDIR /tmp
|
||||
RUN \
|
||||
cd /tmp \
|
||||
&& git clone https://github.com/sbfspot/SBFspot.git . \
|
||||
&& cd SBFspot \
|
||||
&& sed -i s/mariadbclient/mariadb/ makefile \
|
||||
&& make mariadb \
|
||||
&& cd .. \
|
||||
&& cd SBFspotUploadDaemon \
|
||||
&&sed -i s/mariadbclient/mariadb/ makefile \
|
||||
&& make mariadb
|
||||
git clone https://github.com/sbfspot/SBFspot.git . \
|
||||
&& sed -i s/mariadbclient/mariadb/ ./SBFspot/makefile \
|
||||
&& make -C ./SBFspot mariadb \
|
||||
&& sed -i s/mariadbclient/mariadb/ ./SBFspotUploadDaemon/makefile \
|
||||
&& make -C ./SBFspotUploadDaemon mariadb
|
||||
|
||||
|
||||
# runtinme container
|
||||
FROM $BUILD_FROM
|
||||
|
@ -41,26 +47,42 @@ RUN \
|
|||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
RUN apk update && apk upgrade && apk add --no-cache boost-date_time bluez bluez-libs libstdc++ tzdata mariadb-common mariadb-connector-c ncurses-libs libcurl mosquitto-clients
|
||||
COPY rootfs /
|
||||
|
||||
RUN apk update && apk add --no-cache \
|
||||
bluez=5.65-r0 \
|
||||
nano=6.3-r0 \
|
||||
bluez-libs=5.65-r0 \
|
||||
libstdc++=11.2.1_git20220219-r2 \
|
||||
mariadb-common=10.6.8-r0 \
|
||||
mariadb-connector-c=3.1.13-r4 \
|
||||
ncurses-libs=6.3_p20220521-r0 \
|
||||
libcurl=7.83.1-r2 \
|
||||
mosquitto-clients=2.0.14-r1 \
|
||||
nginx=1.22.0-r1
|
||||
|
||||
#tzdata=2022a-r0
|
||||
#boost-date_time1.78
|
||||
|
||||
|
||||
|
||||
# Copy data for add-on
|
||||
WORKDIR /usr/bin/sbfspot
|
||||
|
||||
RUN mkdir -p /usr/bin/sbfspot
|
||||
|
||||
COPY --from=builder /tmp/SBFspot/mariadb/bin/SBFspot /tmp/SBFspot/mariadb/bin/SBFspot
|
||||
COPY --from=builder /tmp/SBFspotUploadDaemon/mariadb/bin/SBFspotUploadDaemon /tmp/SBFspotUploadDaemon/mariadb/bin/SBFspotUploadDaemon
|
||||
COPY --from=builder /tmp/SBFspot/date_time_zonespec.csv /tmp/SBFspot/date_time_zonespec.csv
|
||||
COPY --from=builder /tmp/SBFspot/TagList* /tmp/SBFspot/
|
||||
COPY --from=builder-base /tmp/SBFspot/mariadb/bin/SBFspot /usr/bin/sbfspot/SBFspot
|
||||
COPY --from=builder-base /tmp/SBFspotUploadDaemon/mariadb/bin/SBFspotUploadDaemon /usr/bin/sbfspot/SBFspotUploadDaemon
|
||||
COPY --from=builder-base /tmp/SBFspot/date_time_zonespec.csv /usr/bin/sbfspot/date_time_zonespec.csv
|
||||
COPY --from=builder-base /tmp/SBFspot/TagList* /usr/bin/sbfspot/
|
||||
|
||||
|
||||
RUN cp /tmp/SBFspot/mariadb/bin/SBFspot /usr/bin/sbfspot
|
||||
RUN cp /tmp/SBFspotUploadDaemon/mariadb/bin/SBFspotUploadDaemon /usr/bin/sbfspot
|
||||
RUN cp /tmp/SBFspot/date_time_zonespec.csv /usr/bin/sbfspot
|
||||
RUN cp /tmp/SBFspot/TagList* /usr/bin/sbfspot
|
||||
|
||||
RUN chmod a+x etc/services.d/sbfspot/run etc/services.d/sbfspot/finish /usr/bin/sbfspot/taillog.sh /usr/bin/sbfspot/generateConfig.sh /usr/bin/sbfspot/SBFspot /usr/bin/sbfspot/SBFspotUploadDaemon /usr/bin/sbfspot/SBFspot.default.cfg /usr/bin/sbfspot/SBFspotUpload.default.cfg
|
||||
#RUN cp /tmp/SBFspot/mariadb/bin/SBFspot /usr/bin/sbfspot \
|
||||
# && cp /tmp/SBFspotUploadDaemon/mariadb/bin/SBFspotUploadDaemon /usr/bin/sbfspot \
|
||||
# && cp /tmp/SBFspot/date_time_zonespec.csv /usr/bin/sbfspot \
|
||||
# && cp /tmp/SBFspot/TagList* /usr/bin/sbfspot
|
||||
|
||||
COPY rootfs /
|
||||
|
||||
RUN chmod a+x /etc/services.d/sbfspot/run /etc/services.d/sbfspot/finish /usr/bin/sbfspot/taillog.sh /usr/bin/sbfspot/generateConfig.sh /usr/bin/sbfspot/genBluetoothConfig.sh /usr/bin/sbfspot/genEthernetConfig.sh /usr/bin/sbfspot/SBFspot /usr/bin/sbfspot/SBFspotUploadDaemon /usr/bin/sbfspot/SBFspot.default.cfg /usr/bin/sbfspot/SBFspotUpload.default.cfg
|
||||
|
||||
# --- install cron ---
|
||||
# set shell
|
||||
|
@ -72,21 +94,21 @@ RUN echo '*/5 6-22 * * * /usr/bin/sbfspot/SBFspot -v -ad1 -am0 -ae0 -mqtt > /
|
|||
# monthly data SBFspot
|
||||
RUN echo '55 05 * * * /usr/bin/sbfspot/SBFspot -v -sp0 -ad0 -am1 -ae1 -finq > /dev/stdout' >> /etc/crontabs/root
|
||||
# start SBFspotUpload 1 min after boot
|
||||
RUN echo '@reboot sleep 60 && /usr/bin/sbfspot/SBFspotUploadDaemon -c /usr/bin/sbfspot/SBFspotUpload.cfg' >> /etc/crontabs/root
|
||||
RUN echo '@reboot sleep 60 && /usr/bin/sbfspot/SBFspotUploadDaemon -c /usr/bin/sbfspot/SBFspotUpload.cfg > /dev/stdout' >> /etc/crontabs/root
|
||||
# Log SBFspotUpload to HA logging window
|
||||
RUN echo '*/5 6-22 * * * /usr/bin/sbfspot/taillog.sh > /dev/stdout' >> /etc/crontabs/root
|
||||
|
||||
# Labels
|
||||
LABEL \
|
||||
io.hass.name="SBFspot" \
|
||||
io.hass.description="Home Assitant addon for Bluetooth SBFspot, is an open source project to get actual and archive data out of an SMA® inverter over Bluetooth or Ethernet (Speedwire®)" \
|
||||
io.hass.name="HAOS-SBFspot" \
|
||||
io.hass.description="Home Assistant addon for Bluetooth SBFspot, is an open source project to get actual and archive data out of an SMA® inverter over Bluetooth or Ethernet (Speedwire®)" \
|
||||
io.hass.arch="${BUILD_ARCH}" \
|
||||
io.hass.type="addon" \
|
||||
io.hass.version=${BUILD_VERSION} \
|
||||
maintainer="Hasqt <https://community.home-assistant.io/u/hasqt>" \
|
||||
org.label-schema.description="Home Assitant addon for Bluetooth SBFspot, is an open source project to get actual and archive data out of an SMA® inverter over Bluetooth or Ethernet (Speedwire®)" \
|
||||
org.label-schema.description="Home Assistant addon for Bluetooth SBFspot, is an open source project to get actual and archive data out of an SMA® inverter over Bluetooth or Ethernet (Speedwire®)" \
|
||||
org.label-schema.build-date=${BUILD_DATE} \
|
||||
org.label-schema.name="SBFspot" \
|
||||
org.label-schema.name="HAOS-SBFspot" \
|
||||
org.label-schema.schema-version="1.0" \
|
||||
org.label-schema.url="https://github.com/habuild/hassio-addons/tree/main/haos-sbfspot" \
|
||||
org.label-schema.usage="https://github.com/habuild/hassio-addons/tree/main/haos-sbfspot/README.md" \
|
||||
|
@ -95,4 +117,5 @@ LABEL \
|
|||
org.label-schema.vendor="Hasqt"
|
||||
|
||||
|
||||
##CMD [ "/run.sh" ] not needed with rootfs/etc/init.d/{slug}run
|
||||
#Launch nginx with debug options. not working yet
|
||||
#CMD [ "nginx","-g","daemon off;error_log /dev/stdout debug;" ]
|
||||
|
|
|
@ -1,29 +1,37 @@
|
|||
# Community Hass.io Add-ons: haos-sbfspot
|
||||
# SBFspot addon for HAOS
|
||||
|
||||
![project-stage-shield] ![Project Maintenance][maintenance-shield]
|
||||

|
||||

|
||||

|
||||
![Project Maintenance][maintenance-shield] [](https://github.com/habuild/hassio-addons/actions/workflows/addon-ci.yaml)
|
||||
|
||||
[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg
|
||||
[maintenance-shield]: https://img.shields.io/maintenance/yes/2022.svg
|
||||
|
||||

|
||||

|
||||
|
||||
[](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fhabuild%2Fhassio-addons)
|
||||
|
||||
This [home assistant](https://www.home-assistant.io/getting-started/) add-on provides a wrapper for the **Bluetooth** version of [SBFspot 3.9.5](https://github.com/SBFspot/SBFspot/releases/latest).
|
||||
|
||||
This [home assistant](https://www.home-assistant.io/getting-started/) add-on provides the installation, configuration, and integration for the **Bluetooth** version of [sbfspot 3.9.5](https://github.com/SBFspot/SBFspot). This version is for the OS installation method of Home assistant.
|
||||
This add-on runs a crontab service for SBFspot and SPFspotUploader at 5 minutely daytime interval.
|
||||
|
||||
This add-on installs a cron service for SPFspot uploader at 5 minutely daytime interval, [PVoutput](https://pvoutput.org/) account and API are required, it also requires an SQL database like Mariadb.
|
||||
It also sends a MQTT message to home assistant, therefore a MQTT broker is required.
|
||||
[PVoutput](https://pvoutput.org/) account and API are required to use the upload feature.
|
||||
|
||||
# Installation
|
||||
[Mariadb addon](https://github.com/home-assistant/addons/tree/master/mariadb) or similiar SQL database, is needed to store the data for upload to PVOutput.
|
||||
|
||||
[phpMyAdmin](https://github.com/hassio-addons/addon-phpmyadmin) is required to create the DB structure.
|
||||
|
||||
[MQTT broker](https://github.com/home-assistant/addons/tree/master/mosquitto) is needed to send MQTT messages to home Assistant.
|
||||
|
||||
## Installation
|
||||
|
||||
### Initial database creation.
|
||||
|
||||
Download and import either [No Drop DB create](https://github.com/habuild/hassio-addons/blob/main/.images/CreateMySQLDB_no_drop.sql) **or** [Create My SQL.sql](https://github.com/SBFspot/SBFspot/blob/master/SBFspot/CreateMySQLDB.sql) in [phpMyAdmin](https://github.com/hassio-addons/addon-phpmyadmin) to create your database. **IF** you haven't already created the database previously, use the NO Drop version. You will also need to add the Database and User/Password to MariaDB and allocate the port.
|
||||
|
||||

|
||||
|
||||
### MQTT
|
||||
|
||||
[haos-sbfspot_sensors.yaml](https://github.com/habuild/hassio-addons/blob/main/.images/sbfspot_sensors.yaml) I use packages to include these yaml sensors. You will need to change to match your plant name and serial as you have set in the add-on configuration options.
|
||||
|
||||
**MQTT options argument** [configuration options](https://github.com/habuild/hassio-addons/blob/main/.images/Example_Config.yaml). The MQTT Username, and Password need to be hardcoded into the **MQTT_PublisherArgs:** The **{host}** **{topic}** and **{{message}}** will be picked up from options.
|
||||
|
@ -34,26 +42,27 @@ Download and import either [No Drop DB create](https://github.com/habuild/hassio
|
|||
|
||||
**-r** is to retain messages. it is advised against using retain flag
|
||||
|
||||
### Find your Local BT device address with Bluetoothctl
|
||||
You can use the **bluetoothctl** command from the console(terminal or ssh addon) in homeassistant. This will list your controller mac address so you can add it to SBFspot addon config. You can also do this via portainer and connecting to this addon directly.
|
||||
|
||||
### Example Configuration Options.
|
||||
|
||||
can be copy/pasted as [Example Config](https://github.com/habuild/hassio-addons/blob/main/haos-sbfspot/.images/Example_Config.yaml) or entered via UI
|
||||

|
||||
|
||||
### Data paths
|
||||
In HAOS (home assistant operating system) the /data/ path arrives at /mnt/data/supervisor/addons/data/{slug}_haos-sbfspot on the host.
|
||||
|
||||
In HAOS (home assistant operating system) the /data/ path arrives at /mnt/data/supervisor/addons/data/{slug}\_haos-sbfspot on the host.
|
||||
|
||||
### Upload logs
|
||||
|
||||
Logs delete after 3 days now. You would need SSH with Root host access to find them anyway.
|
||||
|
||||
### **Link to haos-sbfspot Documentation**
|
||||
Refer to the [Wiki](https://github.com/sbfspot/sbfspot/wiki) for documentation and FAQ.
|
||||
|
||||
Refer to the [SBFspot Wiki](https://github.com/sbfspot/sbfspot/wiki) for documentation and FAQ about SBFspot.
|
||||
|
||||
### **Special thanks to:**
|
||||
* LauR3y/hassio-addons which this version is cleaned up from.
|
||||
* The sbfspot team for SPFspot.
|
||||
|
||||
- LauR3y/hassio-addons-addons which this version is cleaned up from.
|
||||
- The sbfspot team for SPFspot.
|
||||
|
||||
![Supports aarch64 Architecture][aarch64-shield]
|
||||
![Supports armhf Architecture][armhf-shield]
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
{
|
||||
"name": "HAOS-SBFspot",
|
||||
"version": "2022.8.1",
|
||||
"slug": "haos-sbfspot",
|
||||
"description": "Manage SBFspot with a simple interface",
|
||||
"url": "https://github.com/habuild/hassio-addons/tree/main/haos-sbfspot",
|
||||
"arch": [
|
||||
"armhf",
|
||||
"armv7",
|
||||
"aarch64",
|
||||
"amd64",
|
||||
"i386"
|
||||
],
|
||||
"init": false,
|
||||
"hassio_api": true,
|
||||
"services": [
|
||||
"mysql:need",
|
||||
"mqtt:want"
|
||||
],
|
||||
"options": {
|
||||
"BTAddress": "null",
|
||||
"Password": "0000",
|
||||
"LocalBTAddress":"00:00:00:00:00:00",
|
||||
"MIS_Enabled": 0,
|
||||
"Plantname": "MyPlant",
|
||||
"OutputPath": "/data/sbfspot/%Y",
|
||||
"OutputPathEvents": "/data/sbfspot/%Y/events",
|
||||
"Latitude": "null",
|
||||
"Longitude": "null",
|
||||
"CalculateMissingSpotValues": 1,
|
||||
"DateTimeFormat": "%d/%m/%Y %H:%M:%S",
|
||||
"DateFormat": "%d/%m/%Y",
|
||||
"DecimalPoint": "comma",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"SynchTime": 0,
|
||||
"SynchTimeLow": 1,
|
||||
"SynchTimeHigh": 3600,
|
||||
"SunRSOffset": 900,
|
||||
"Locale": "en-US",
|
||||
"Timezone": "Europe/Brussels",
|
||||
"BTConnectRetries": 10,
|
||||
"CSV_Export": 0,
|
||||
"CSV_ExtendedHeader": 1,
|
||||
"CSV_Header": 1,
|
||||
"CSV_SaveZeroPower": 1,
|
||||
"CSV_Delimiter": "semicolon",
|
||||
"CSV_Spot_TimeSource": "Inverter",
|
||||
"CSV_Spot_WebboxHeader": 0,
|
||||
"SQL_Database": "null",
|
||||
"SQL_Hostname": "core-mariadb",
|
||||
"SQL_Port": "3306",
|
||||
"SQL_Username": "null",
|
||||
"SQL_Password": null,
|
||||
"MQTT_Publisher": "/usr/bin/mosquitto_pub",
|
||||
"MQTT_Host": "core-mosquitto",
|
||||
"MQTT_Port": "null",
|
||||
"MQTT_Topic": "homeassistant/sbfspot_{plantname}/sbfspot_{serial}",
|
||||
"MQTT_ItemFormat": "\"{key}\": {value}",
|
||||
"MQTT_ItemDelimiter": "comma",
|
||||
"MQTT_PublisherArgs": "-h {host} -u {MQTT_Username} -P {MQTT_Password} -t {topic} -m \"{{message}}\" -d",
|
||||
"MQTT_Data": "Timestamp,SunRise,SunSet,InvSerial,InvName,InvTime,InvStatus,InvTemperature,InvGridRelay,EToday,ETotal,GridFreq,PACTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2",
|
||||
"LogDir": "/data/sbfspot/log/",
|
||||
"LogLevel": "info",
|
||||
"PVoutput_SID": "yourSID11111111:22222",
|
||||
"PVoutput_Key": null,
|
||||
"MQTT_ENABLE": "1"
|
||||
},
|
||||
"schema": {
|
||||
"BTAddress": "str",
|
||||
"Password": "str",
|
||||
"LocalBTAddress":"str",
|
||||
"MIS_Enabled": "int",
|
||||
"Plantname": "str",
|
||||
"OutputPath": "str",
|
||||
"OutputPathEvents": "str",
|
||||
"Latitude": "float",
|
||||
"Longitude": "float",
|
||||
"CalculateMissingSpotValues": "int",
|
||||
"DateTimeFormat": "str",
|
||||
"DateFormat": "str",
|
||||
"DecimalPoint": "str",
|
||||
"TimeFormat": "str",
|
||||
"SynchTime": "int",
|
||||
"SynchTimeLow": "int",
|
||||
"SynchTimeHigh": "int",
|
||||
"SunRSOffset": "int",
|
||||
"Locale": "str",
|
||||
"Timezone": "str",
|
||||
"BTConnectRetries": "int",
|
||||
"CSV_Export": "int",
|
||||
"CSV_ExtendedHeader": "int",
|
||||
"CSV_Header": "int",
|
||||
"CSV_SaveZeroPower": "int",
|
||||
"CSV_Delimiter": "str",
|
||||
"CSV_Spot_TimeSource": "str",
|
||||
"CSV_Spot_WebboxHeader": "int",
|
||||
"SQL_Database": "str",
|
||||
"SQL_Hostname": "str",
|
||||
"SQL_Port": "str",
|
||||
"SQL_Username": "str",
|
||||
"SQL_Password": "str",
|
||||
"MQTT_Publisher": "str",
|
||||
"MQTT_Host": "str",
|
||||
"MQTT_Port": "str",
|
||||
"MQTT_Topic": "str",
|
||||
"MQTT_ItemFormat": "str",
|
||||
"MQTT_ItemDelimiter": "str",
|
||||
"MQTT_PublisherArgs": "str",
|
||||
"MQTT_Data": "str",
|
||||
"LogDir": "str",
|
||||
"LogLevel": "str",
|
||||
"PVoutput_SID": "str",
|
||||
"PVoutput_Key": "str",
|
||||
"MQTT_ENABLE": "int"
|
||||
},
|
||||
"host_network": true,
|
||||
"privileged": ["SYS_MODULE"],
|
||||
"host_dbus": true,
|
||||
"image": "ghcr.io/habuild/{arch}-addon-haos-sbfspot"
|
||||
}
|
119
haos-sbfspot/config.yaml
Normal file
119
haos-sbfspot/config.yaml
Normal file
|
@ -0,0 +1,119 @@
|
|||
---
|
||||
name: HAOS-SBFspot
|
||||
version: 2022.8.3
|
||||
slug: haos-sbfspot
|
||||
description: Manage SBFspot with a simple interface
|
||||
url: "https://github.com/habuild/hassio-addons/tree/main/haos-sbfspot"
|
||||
stage: experimental
|
||||
arch:
|
||||
- armhf
|
||||
- armv7
|
||||
- aarch64
|
||||
- amd64
|
||||
init: false
|
||||
homeassistant_api: true
|
||||
panel_icon: mdi:solar-power-variant
|
||||
services:
|
||||
- mysql:need
|
||||
- mqtt:want
|
||||
options:
|
||||
Connection_Type: "Bluetooth"
|
||||
BTAddress: ""
|
||||
Password: "0000"
|
||||
LocalBTAddress: "00:00:00:00:00:00"
|
||||
IP_Address: "255.255.255.255"
|
||||
MIS_Enabled: 0
|
||||
Plantname: MyPlant
|
||||
OutputPath: /data/sbfspot/%Y
|
||||
OutputPathEvents: /data/sbfspot/%Y/events
|
||||
Latitude: "null"
|
||||
Longitude: "null"
|
||||
CalculateMissingSpotValues: 1
|
||||
DateTimeFormat: "%d/%m/%Y %H:%M:%S"
|
||||
DateFormat: "%d/%m/%Y"
|
||||
DecimalPoint: comma
|
||||
TimeFormat: "%H:%M:%S"
|
||||
SynchTime: 0
|
||||
SynchTimeLow: 1
|
||||
SynchTimeHigh: 3600
|
||||
SunRSOffset: 900
|
||||
Locale: en-US
|
||||
Timezone: Europe/Brussels
|
||||
BTConnectRetries: 10
|
||||
CSV_Export: 0
|
||||
CSV_ExtendedHeader: 1
|
||||
CSV_Header: 1
|
||||
CSV_SaveZeroPower: 1
|
||||
CSV_Delimiter: semicolon
|
||||
CSV_Spot_TimeSource: Inverter
|
||||
CSV_Spot_WebboxHeader: 0
|
||||
SQL_Database: "SBFspot"
|
||||
SQL_Hostname: core-mariadb
|
||||
SQL_Port: "3306"
|
||||
SQL_Username: "sbfspot"
|
||||
SQL_Password: ""
|
||||
MQTT_Publisher: /usr/bin/mosquitto_pub
|
||||
MQTT_Host: core-mosquitto
|
||||
MQTT_Port: "1883"
|
||||
MQTT_Topic: "homeassistant/sbfspot_{plantname}/sbfspot_{serial}"
|
||||
MQTT_ItemFormat: '"{key}": {value}'
|
||||
MQTT_ItemDelimiter: comma
|
||||
MQTT_PublisherArgs: >-
|
||||
-h {host} -u MQTT_Username -P MQTT_Password -t {topic} -m "{{message}}" -d
|
||||
MQTT_Data: >-
|
||||
Timestamp,SunRise,SunSet,InvSerial,InvName,InvTime,InvStatus,InvTemperature,InvGridRelay,EToday,ETotal,GridFreq,PACTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2
|
||||
PVoutput_SID: "0123456789:12345"
|
||||
PVoutput_Key: "fake9364fake4545fake834fake"
|
||||
LogDir: /data/sbfspot/log/
|
||||
LogLevel: info
|
||||
schema:
|
||||
Connection_Type: list(Bluetooth|Ethernet)?
|
||||
BTAddress: "str"
|
||||
Password: "str"
|
||||
LocalBTAddress: "str"
|
||||
IP_Address: "str"
|
||||
Plantname: "str"
|
||||
MIS_Enabled: "int?"
|
||||
OutputPath: "str?"
|
||||
OutputPathEvents: "str?"
|
||||
Latitude: "float"
|
||||
Longitude: "float"
|
||||
Timezone: "str"
|
||||
DateTimeFormat: "str"
|
||||
DateFormat: "str"
|
||||
DecimalPoint: "str"
|
||||
TimeFormat: "str"
|
||||
SynchTime: "int?"
|
||||
SynchTimeLow: "int?"
|
||||
SynchTimeHigh: "int?"
|
||||
SunRSOffset: "int?"
|
||||
Locale: "str"
|
||||
CalculateMissingSpotValues: "int?"
|
||||
BTConnectRetries: "int?"
|
||||
CSV_Export: "int?"
|
||||
CSV_ExtendedHeader: "int?"
|
||||
CSV_Header: "int?"
|
||||
CSV_SaveZeroPower: "int?"
|
||||
CSV_Delimiter: "str?"
|
||||
CSV_Spot_TimeSource: "str?"
|
||||
CSV_Spot_WebboxHeader: "int?"
|
||||
SQL_Database: "str?"
|
||||
SQL_Hostname: "str?"
|
||||
SQL_Port: "str?"
|
||||
SQL_Username: "str?"
|
||||
SQL_Password: "str?"
|
||||
MQTT_Publisher: "str?"
|
||||
MQTT_Host: "str"
|
||||
MQTT_Port: "str"
|
||||
MQTT_Topic: "str"
|
||||
MQTT_ItemFormat: "str"
|
||||
MQTT_ItemDelimiter: str
|
||||
MQTT_PublisherArgs: str
|
||||
MQTT_Data: "str"
|
||||
PVoutput_SID: "str"
|
||||
PVoutput_Key: "str"
|
||||
LogDir: "str?"
|
||||
LogLevel: "str"
|
||||
host_network: true
|
||||
host_dbus: true
|
||||
image: "ghcr.io/habuild/{arch}-addon-ether-sbfspot"
|
|
@ -5,26 +5,72 @@
|
|||
# ==============================================================================
|
||||
|
||||
|
||||
#CFG_PATH=/usr/bin/sbfspot/SBFspot.cfg
|
||||
#CFG_UPLOAD_PATH=/usr/bin/sbfspot/SBFspotUpload.cfg
|
||||
|
||||
# --- GENERATE CONFIG --
|
||||
echo "PWD is current directory $(pwd)"
|
||||
message=$(echo "PWD is current directory $(pwd)")
|
||||
bashio::log.debug "${message:=""}"
|
||||
cd /
|
||||
|
||||
echo "PWD is current directory $(pwd)"
|
||||
/usr/bin/sbfspot/generateConfig.sh /usr/bin/sbfspot/SBFspot.cfg /usr/bin/sbfspot/SBFspotUpload.cfg
|
||||
message=$(echo "PWD is current directory $(pwd)")
|
||||
bashio::log.debug "${message:=""}"
|
||||
|
||||
# ---- Print Host sys info
|
||||
message=$(echo "$(uname -smrv)")
|
||||
bashio::log.info
|
||||
bashio::log.info ${__BASHIO_COLORS_CYAN} "${message:="Hello World..."}"
|
||||
bashio::log.info
|
||||
|
||||
# ---- Print Host BT Controller
|
||||
## Get the 'message' key from the user config options.
|
||||
message=$(echo "[Host Bluetooth MAC Address] $(bluetoothctl list)")
|
||||
bashio::log.info
|
||||
bashio::log.info ${__BASHIO_COLORS_BLUE} "${message:="Hello World..."}"
|
||||
bashio::log.info
|
||||
|
||||
#set -x
|
||||
value=$(bashio::config 'Connection_Type')
|
||||
if bashio::var.equals "${value}" "Bluetooth"; then
|
||||
/usr/bin/sbfspot/genBluetoothConfig.sh /usr/bin/sbfspot/SBFspot.cfg /usr/bin/sbfspot/SBFspotUpload.cfg
|
||||
bashio::log.info
|
||||
bashio::log.info
|
||||
message=$(echo "|| Generating Bluetooth Configs ||")
|
||||
bashio::log.info ${__BASHIO_COLORS_BLUE} "${message:=""}"
|
||||
message=$(echo "|| /usr/bin/sbfspot/SBFspot.cfg ||")
|
||||
bashio::log.info ${__BASHIO_COLORS_BLUE} "${message:=""}"
|
||||
message=$(echo "|| /usr/bin/sbfspot/SBFspotUpload.cfg ||")
|
||||
bashio::log.info ${__BASHIO_COLORS_BLUE} "${message:=""}"
|
||||
bashio::log.info
|
||||
elif bashio::var.equals "${value}" "Ethernet"; then
|
||||
/usr/bin/sbfspot/genEthernetConfig.sh /usr/bin/sbfspot/SBFspot.cfg /usr/bin/sbfspot/SBFspotUpload.cfg
|
||||
bashio::log.info
|
||||
bashio::log.info
|
||||
message=$(echo "|| Generating Ethernet Configs ||")
|
||||
bashio::log.info ${__BASHIO_COLORS_MAGENTA} "${message:=""}"
|
||||
message=$(echo "|| /usr/bin/sbfspot/SBFspot.cfg ||")
|
||||
bashio::log.info ${__BASHIO_COLORS_MAGENTA} "${message:=""}"
|
||||
message=$(echo "|| /usr/bin/sbfspot/SBFspotUpload.cfg ||")
|
||||
bashio::log.info ${__BASHIO_COLORS_MAGENTA} "${message:=""}"
|
||||
bashio::log.info
|
||||
bashio::log.info
|
||||
else
|
||||
bashio::log.info ${__BASHIO_COLORS_RED} ================================
|
||||
bashio::log.info ${__BASHIO_COLORS_RED} "Setup failed to create Configs"
|
||||
bashio::log.info ${__BASHIO_COLORS_RED} ================================
|
||||
fi
|
||||
set +x
|
||||
|
||||
## Print the message the user supplied, defaults to "Hello World..."
|
||||
bashio::log.info "${message:="Hello World..."}"
|
||||
|
||||
# ---- RUN ----
|
||||
message=$(echo "[Starting SBFspotUpload]")
|
||||
bashio::log.info ${__BASHIO_COLORS_MAGENTA} "${message:=""}"
|
||||
|
||||
echo 'Starting daemon'
|
||||
|
||||
# ---- Symbolic Links ----
|
||||
ln -sf /usr/bin/sbfspot/SBFspot /SBFspot
|
||||
ln -sf /usr/bin/sbfspot/SBFspot.cfg /SBFspot.cfg
|
||||
ln -sf /usr/bin/sbfspot/SBFspotUpload.cfg /SBFspotUpload.cfg
|
||||
|
||||
# cron
|
||||
echo 'Starting cron in foreground'
|
||||
message=$(echo "[Starting cron in foreground]")
|
||||
bashio::log.info "${message:=""}"
|
||||
exec /usr/sbin/crond -f
|
312
haos-sbfspot/rootfs/usr/bin/sbfspot/genBluetoothConfig.sh
Normal file
312
haos-sbfspot/rootfs/usr/bin/sbfspot/genBluetoothConfig.sh
Normal file
|
@ -0,0 +1,312 @@
|
|||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
# export CFG_PATH
|
||||
# export CFG_PATH_UPLOAD
|
||||
CFG_PATH=$1
|
||||
CFG_PATH_UPLOAD=$2
|
||||
CONFIG_PATH=/data/options.json
|
||||
|
||||
# CONFIG_CONNECTION_TYPE="$(jq --raw-output '.Connection_Type' $CONFIG_PATH)"
|
||||
CONFIG_BTADDRESS="$(jq --raw-output '.BTAddress' $CONFIG_PATH)"
|
||||
CONFIG_LOCALBTADDRESS="$(jq --raw-output '.LocalBTAddress' $CONFIG_PATH)"
|
||||
CONFIG_PASSWORD="$(jq --raw-output '.Password' $CONFIG_PATH)"
|
||||
CONFIG_MSI_ENABLED="$(jq --raw-output '.MIS_Enabled' $CONFIG_PATH)"
|
||||
CONFIG_PLANTNAME="$(jq --raw-output '.Plantname' $CONFIG_PATH)"
|
||||
CONFIG_OUTPUTPATH="$(jq --raw-output '.OutputPath' $CONFIG_PATH)"
|
||||
CONFIG_OUTPUTPATHEVENTS="$(jq --raw-output '.OutputPathEvents' $CONFIG_PATH)"
|
||||
CONFIG_LATITUDE="$(jq --raw-output '.Latitude' $CONFIG_PATH)"
|
||||
CONFIG_LONGITUDE="$(jq --raw-output '.Longitude' $CONFIG_PATH)"
|
||||
CONFIG_CALCULATEMISSINGSPOTVALUES="$(jq --raw-output '.CalculateMissingSpotValues' $CONFIG_PATH)"
|
||||
CONFIG_DATETIMEFORMAT="$(jq --raw-output '.DateTimeFormat' $CONFIG_PATH)"
|
||||
CONFIG_DATEFORMAT="$(jq --raw-output '.DateFormat' $CONFIG_PATH)"
|
||||
CONFIG_DECIMALPOINT="$(jq --raw-output '.DecimalPoint' $CONFIG_PATH)"
|
||||
CONFIG_TIMEFORMAT="$(jq --raw-output '.TimeFormat' $CONFIG_PATH)"
|
||||
CONFIG_SYNCHTIME="$(jq --raw-output '.SynchTime' $CONFIG_PATH)"
|
||||
CONFIG_SYNCHTIMELOW="$(jq --raw-output '.SynchTimeLow' $CONFIG_PATH)"
|
||||
CONFIG_SYNCHTIMEHIGH="$(jq --raw-output '.SynchTimeHigh' $CONFIG_PATH)"
|
||||
CONFIG_SUNRSOFFSET="$(jq --raw-output '.SunRSOffset' $CONFIG_PATH)"
|
||||
CONFIG_LOCALE="$(jq --raw-output '.Locale' $CONFIG_PATH)"
|
||||
CONFIG_TIMEZONE="$(jq --raw-output '.Timezone' $CONFIG_PATH)"
|
||||
CONFIG_BTCONNECTRETRIES="$(jq --raw-output '.BTConnectRetries' $CONFIG_PATH)"
|
||||
CONFIG_CSV_EXPORT="$(jq --raw-output '.CSV_Export' $CONFIG_PATH)"
|
||||
CONFIG_CSV_EXTENDEDHEADER="$(jq --raw-output '.CSV_ExtendedHeader' $CONFIG_PATH)"
|
||||
CONFIG_CSV_HEADER="$(jq --raw-output '.CSV_Header' $CONFIG_PATH)"
|
||||
CONFIG_CSV_SAVEZEROPOWER="$(jq --raw-output '.CSV_SaveZeroPower' $CONFIG_PATH)"
|
||||
CONFIG_CSV_DELIMITER="$(jq --raw-output '.CSV_Delimiter' $CONFIG_PATH)"
|
||||
CONFIG_CSV_SPOT_TIMESOURCE="$(jq --raw-output '.CSV_Spot_TimeSource' $CONFIG_PATH)"
|
||||
CONFIG_CSV_SPOT_WEBBOXHEADER="$(jq --raw-output '.CSV_Spot_WebboxHeader' $CONFIG_PATH)"
|
||||
CONFIG_SQL_DATABASE="$(jq --raw-output '.SQL_Database' $CONFIG_PATH)"
|
||||
CONFIG_SQL_HOSTNAME="$(jq --raw-output '.SQL_Hostname' $CONFIG_PATH)"
|
||||
CONFIG_SQL_PORT="$(jq --raw-output '.SQL_Port' $CONFIG_PATH)"
|
||||
CONFIG_SQL_USERNAME="$(jq --raw-output '.SQL_Username' $CONFIG_PATH)"
|
||||
CONFIG_SQL_PASSWORD="$(jq --raw-output '.SQL_Password' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_PUBLISHER="$(jq --raw-output '.MQTT_Publisher' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_HOST="$(jq --raw-output '.MQTT_Host' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_PORT="$(jq --raw-output '.MQTT_Port' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_TOPIC="$(jq --raw-output '.MQTT_Topic' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_ITEMFORMAT="$(jq --raw-output '.MQTT_ItemFormat' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_ITEMDELIMITER="$(jq --raw-output '.MQTT_ItemDelimiter' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_PUBLISHERARGS="$(jq --raw-output '.MQTT_PublisherArgs' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_DATA="$(jq --raw-output '.MQTT_Data' $CONFIG_PATH)"
|
||||
CONFIG_LOGDIR="$(jq --raw-output '.LogDir' $CONFIG_PATH)"
|
||||
CONFIG_LOGLEVEL="$(jq --raw-output '.LogLevel' $CONFIG_PATH)"
|
||||
CONFIG_PVOUTPUT_SID="$(jq --raw-output '.PVoutput_SID' $CONFIG_PATH)"
|
||||
CONFIG_PVOUTPUT_KEY="$(jq --raw-output '.PVoutput_Key' $CONFIG_PATH)"
|
||||
|
||||
cat > "$CFG_PATH" <<EOL
|
||||
################################################################################
|
||||
# ____ ____ _____ _
|
||||
# / ___|| __ )| ___|__ _ __ ___ | |_
|
||||
# \___ \| _ \| |_ / __| '_ \ / _ \| __|
|
||||
# ___) | |_) | _|\__ \ |_) | (_) | |_
|
||||
# |____/|____/|_| |___/ .__/ \___/ \__|
|
||||
# |_|
|
||||
#
|
||||
# SBFspot.cfg - Configuration file for SBFspot.exe
|
||||
# SBFspot - Yet another tool to read power production of SMA<4D> solar inverters
|
||||
# (c)2012-2018, SBF
|
||||
#
|
||||
# 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 and Speedwire are registered trademarks of SMA Solar Technology AG
|
||||
################################################################################
|
||||
|
||||
# SMA Inverter's Bluetooth address
|
||||
# Windows: smaspot -scan
|
||||
# Linux : hcitool scan
|
||||
# IMPORTANT FOR SPEEDWIRE USERS: COMMENT OUT BTADDRESS (PUT # IN FRONT)
|
||||
BTAddress=$CONFIG_BTADDRESS
|
||||
|
||||
# If multiple local BT adapters are available, select the one to use
|
||||
LocalBTAddress=$CONFIG_LOCALBTADDRESS
|
||||
|
||||
# SMA Inverter's Speedwire IP address
|
||||
# If IP_Address is not set or is 0.0.0.0 SBFspot will try to detect the speedwire inverter by broadcast
|
||||
# If IP_Address is set to a valid IP, SBFspot will try to connect directly to that IP without broadcast detection
|
||||
# Multiple IP addresses can be provided (comma separated)
|
||||
# IP_Address=0.0.0.0
|
||||
|
||||
# User password (default 0000)
|
||||
Password=$CONFIG_PASSWORD
|
||||
|
||||
# MIS_Enabled (Multi Inverter Support: Default=0 Disabled)
|
||||
# +------------+-------+-------------+
|
||||
# | #Inverters | NetID | MIS_Enabled |
|
||||
# +------------+-------+-------------+
|
||||
# | 1 | 1 | Don't Care |
|
||||
# +------------+-------+-------------+
|
||||
# | 1 | >1 | 0 |
|
||||
# +------------+-------+-------------+
|
||||
# | >1 | >1 | 1 |
|
||||
# +------------+-------+-------------+
|
||||
MIS_Enabled=$CONFIG_MSI_ENABLED
|
||||
|
||||
# Plantname
|
||||
Plantname=$CONFIG_PLANTNAME
|
||||
|
||||
# OutputPath (Place to store CSV files)
|
||||
#
|
||||
# Windows: C:\Users\Public\SMAdata\%Y
|
||||
# Linux : /home/pi/smadata/%Y
|
||||
# %Y %m and %d will be expanded to Year Month and Day
|
||||
OutputPath=$CONFIG_OUTPUTPATH
|
||||
|
||||
# OutputPathEvents (Place to store CSV files for events)
|
||||
# If omitted, OutputPath is used
|
||||
OutputPathEvents=$CONFIG_OUTPUTPATHEVENTS
|
||||
|
||||
# Position of pv-plant http://itouchmap.com/latlong.html
|
||||
# Example for Ukkel, Belgium
|
||||
Latitude=$CONFIG_LATITUDE
|
||||
Longitude=$CONFIG_LONGITUDE
|
||||
|
||||
# Calculate Missing SpotValues
|
||||
# If set to 1, values not provided by inverter will be calculated
|
||||
# eg: Pdc1 = Idc1 * Udc1
|
||||
CalculateMissingSpotValues=$CONFIG_CALCULATEMISSINGSPOTVALUES
|
||||
|
||||
# DateTimeFormat (default %d/%m/%Y %H:%M:%S)
|
||||
# For details see strftime() function
|
||||
# http://www.cplusplus.com/reference/clibrary/ctime/strftime/
|
||||
DateTimeFormat=$CONFIG_DATETIMEFORMAT
|
||||
|
||||
# DateFormat (default %d/%m/%Y)
|
||||
DateFormat=$CONFIG_DATEFORMAT
|
||||
|
||||
# DecimalPoint (comma/point default comma)
|
||||
DecimalPoint=$CONFIG_DECIMALPOINT
|
||||
|
||||
# TimeFormat (default %H:%M:%S)
|
||||
TimeFormat=$CONFIG_TIMEFORMAT
|
||||
|
||||
# SynchTime (0-30 - 0=disabled, 1=once a day (default), 7=once a week, 30=once a month)
|
||||
# If set to non-zero value, the plant time is synchronised with local host time
|
||||
# Some inverters don't have a real-time clock
|
||||
SynchTime=$CONFIG_SYNCHTIME
|
||||
|
||||
# SynchTimeLow (1-120 - default 1)
|
||||
# SynchTimeHigh (1200-3600 - default 3600)
|
||||
# Plant time is adjusted to local host time when SynchTime=1 and
|
||||
# time difference is between SynchTimeLow and SynchTimeHigh limits
|
||||
SynchTimeLow=$CONFIG_SYNCHTIMELOW
|
||||
SynchTimeHigh=$CONFIG_SYNCHTIMEHIGH
|
||||
|
||||
# SunRSOffset
|
||||
# Offset to start before sunrise and end after sunset (0-3600 - default 900 seconds)
|
||||
SunRSOffset=$CONFIG_SUNRSOFFSET
|
||||
|
||||
# Locale
|
||||
# Translate Entries in CSV files
|
||||
# Supported locales: de-DE;en-US;fr-FR;nl-NL;es-ES;it-IT
|
||||
# Default en-US
|
||||
Locale=$CONFIG_LOCALE
|
||||
|
||||
# Timezone
|
||||
# Select the right timezone in date_time_zonespec.csv
|
||||
# e.g. Timezone=Europe/Brussels
|
||||
Timezone=$CONFIG_TIMEZONE
|
||||
|
||||
# BTConnectRetries
|
||||
# Number of Bluetooth Connection attempts (1-15; Default=10)
|
||||
BTConnectRetries=$CONFIG_BTCONNECTRETRIES
|
||||
|
||||
###########################
|
||||
### CSV Export Settings ###
|
||||
###########################
|
||||
# With CSV_* settings you can define the CSV file format
|
||||
|
||||
# CSV_Export (default 1 = Enabled)
|
||||
# Enables or disables the CSV Export functionality
|
||||
CSV_Export=$CONFIG_CSV_EXPORT
|
||||
|
||||
# CSV_ExtendedHeader (default 1 = On)
|
||||
# Enables or disables the SMA extended header info (8 lines)
|
||||
# isep=;
|
||||
# Version CSV1|Tool SBFspot|Linebreaks CR/LF|Delimiter semicolon|Decimalpoint comma|Precision 3
|
||||
# etc...
|
||||
# This is usefull for manual data upload to pvoutput.org
|
||||
CSV_ExtendedHeader=$CONFIG_CSV_EXTENDEDHEADER
|
||||
|
||||
# CSV_Header (default 1 = On)
|
||||
# Enables or disables the CSV data header info (1 line)
|
||||
# dd/MM/yyyy HH:mm:ss;kWh;kW
|
||||
# This is usefull for manual data upload to pvoutput.org
|
||||
# If CSV_ExtendedHeader is enabled, CSV_Header is also enabled
|
||||
CSV_Header=$CONFIG_CSV_HEADER
|
||||
|
||||
# CSV_SaveZeroPower (default 1 = On)
|
||||
# When enabled, daily csv files contain all data from 00:00 to 23:55
|
||||
# This is usefull for manual data upload to pvoutput.org
|
||||
CSV_SaveZeroPower=$CONFIG_CSV_SAVEZEROPOWER
|
||||
|
||||
# CSV_Delimiter (comma/semicolon default semicolon)
|
||||
CSV_Delimiter=$CONFIG_CSV_DELIMITER
|
||||
|
||||
# CSV_Spot_TimeSource (Inverter|Computer default Inverter)
|
||||
CSV_Spot_TimeSource=$CONFIG_CSV_SPOT_TIMESOURCE
|
||||
|
||||
# CSV_Spot_WebboxHeader (Default 0 = Off)
|
||||
# When enabled, use Webbox style header (DcMs.Watt[A];DcMs.Watt[B]...)
|
||||
CSV_Spot_WebboxHeader=$CONFIG_CSV_SPOT_WEBBOXHEADER
|
||||
|
||||
###########################
|
||||
### SQL DB Settings ###
|
||||
###########################
|
||||
|
||||
# SQLite
|
||||
# SQL_Database (Fullpath to SQLite DB)
|
||||
# Windows: C:\Users\Public\SMAdata\SBFspot.db
|
||||
# Linux : /home/pi/smadata/SBFspot.db
|
||||
#SQL_Database=/home/pi/smadata/SBFspot.db
|
||||
|
||||
# MySQL
|
||||
SQL_Database=$CONFIG_SQL_DATABASE
|
||||
SQL_Hostname=$CONFIG_SQL_HOSTNAME
|
||||
SQL_Port=$CONFIG_SQL_PORT
|
||||
SQL_Username=$CONFIG_SQL_USERNAME
|
||||
SQL_Password=$CONFIG_SQL_PASSWORD
|
||||
|
||||
#########################
|
||||
### MQTT Settings ###
|
||||
#########################
|
||||
|
||||
|
||||
MQTT_Publisher=$CONFIG_MQTT_PUBLISHER
|
||||
MQTT_Host=$CONFIG_MQTT_HOST
|
||||
MQTT_Port=$CONFIG_MQTT_PORT
|
||||
MQTT_Topic=$CONFIG_MQTT_TOPIC
|
||||
MQTT_ItemFormat=$CONFIG_MQTT_ITEMFORMAT
|
||||
MQTT_ItemDelimiter=$CONFIG_MQTT_ITEMDELIMITER
|
||||
MQTT_PublisherArgs=$CONFIG_MQTT_PUBLISHERARGS
|
||||
MQTT_Data=$CONFIG_MQTT_DATA
|
||||
EOL
|
||||
|
||||
#cat $1
|
||||
|
||||
cat > "$CFG_PATH_UPLOAD" <<EOL
|
||||
################################################################################
|
||||
# SBFspotUpload.cfg - Configuration file for SBFspotUploadService/Daemon
|
||||
# (c)2012-2014, SBF (https://sbfspot.codeplex.com)
|
||||
#
|
||||
# DISCLAIMER:
|
||||
# A user of SBFspotUploadService/Daemon 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.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
|
||||
################################
|
||||
### Log Settings ###
|
||||
################################
|
||||
# Windows: C:\Users\Public\SMAdata\Logs
|
||||
# Linux : /home/pi/smadata/logs
|
||||
#LogDir=C:\Users\Public\SMAdata\Logs
|
||||
LogDir=$CONFIG_LOGDIR
|
||||
|
||||
#LogLevel=debug|info|warning|error (default info)
|
||||
LogLevel=$CONFIG_LOGLEVEL
|
||||
|
||||
################################
|
||||
### PVoutput Upload Settings ###
|
||||
################################
|
||||
#PVoutput_SID
|
||||
#Map inverters to PVoutput System ID's
|
||||
#PVoutput_SID=SerialNmbrInverter_1:PVoutput_System_ID_1,SerialNmbrInverter_2:PVoutput_System_ID_2
|
||||
#e.g. PVoutput_SID=200212345:4321
|
||||
PVoutput_SID=$CONFIG_PVOUTPUT_SID
|
||||
|
||||
#PVoutput_Key
|
||||
#Sets PVoutput API Key
|
||||
PVoutput_Key=$CONFIG_PVOUTPUT_KEY
|
||||
|
||||
################################
|
||||
### SQL DB Settings ###
|
||||
################################
|
||||
# SQL_Database (Fullpath to SQLite DB)
|
||||
# Windows: C:\Users\Public\SMAdata\SBFspot.db
|
||||
# Linux : /home/pi/smadata/SBFspot.db
|
||||
#SQL_Database=C:\Users\Public\SMAdata\SBFspot.db
|
||||
#SQL_Database=/home/pi/smadata/SBFspot.db
|
||||
|
||||
# Reserved for MySQL
|
||||
SQL_Database=$CONFIG_SQL_DATABASE
|
||||
SQL_Hostname=$CONFIG_SQL_HOSTNAME
|
||||
SQL_Username=$CONFIG_SQL_USERNAME
|
||||
SQL_Password=$CONFIG_SQL_PASSWORD
|
||||
EOL
|
||||
|
||||
#cat $CFG_PATH_UPLOAD
|
||||
|
||||
# create folders
|
||||
mkdir -p "$CONFIG_OUTPUTPATH"
|
||||
mkdir -p "$CONFIG_LOGDIR"
|
314
haos-sbfspot/rootfs/usr/bin/sbfspot/genEthernetConfig.sh
Normal file
314
haos-sbfspot/rootfs/usr/bin/sbfspot/genEthernetConfig.sh
Normal file
|
@ -0,0 +1,314 @@
|
|||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
#export CFG_PATH
|
||||
#export CFG_PATH_UPLOAD
|
||||
|
||||
CFG_PATH=$1
|
||||
CFG_PATH_UPLOAD=$2
|
||||
CONFIG_PATH=/data/options.json
|
||||
|
||||
#CONFIG_CONNECTION_TYPE="$(jq --raw-output '.Connection_Type' $CONFIG_PATH)"
|
||||
#CONFIG_BTADDRESS="$(jq --raw-output '.BTAddress' $CONFIG_PATH)"
|
||||
#CONFIG_LOCALBTADDRESS="$(jq --raw-output '.LocalBTAddress' $CONFIG_PATH)"
|
||||
CONFIG_IP_ADDRESS="$(jq --raw-output '.IP_Address' $CONFIG_PATH)"
|
||||
CONFIG_PASSWORD="$(jq --raw-output '.Password' $CONFIG_PATH)"
|
||||
CONFIG_MSI_ENABLED="$(jq --raw-output '.MIS_Enabled' $CONFIG_PATH)"
|
||||
CONFIG_PLANTNAME="$(jq --raw-output '.Plantname' $CONFIG_PATH)"
|
||||
CONFIG_OUTPUTPATH="$(jq --raw-output '.OutputPath' $CONFIG_PATH)"
|
||||
CONFIG_OUTPUTPATHEVENTS="$(jq --raw-output '.OutputPathEvents' $CONFIG_PATH)"
|
||||
CONFIG_LATITUDE="$(jq --raw-output '.Latitude' $CONFIG_PATH)"
|
||||
CONFIG_LONGITUDE="$(jq --raw-output '.Longitude' $CONFIG_PATH)"
|
||||
CONFIG_CALCULATEMISSINGSPOTVALUES="$(jq --raw-output '.CalculateMissingSpotValues' $CONFIG_PATH)"
|
||||
CONFIG_DATETIMEFORMAT="$(jq --raw-output '.DateTimeFormat' $CONFIG_PATH)"
|
||||
CONFIG_DATEFORMAT="$(jq --raw-output '.DateFormat' $CONFIG_PATH)"
|
||||
CONFIG_DECIMALPOINT="$(jq --raw-output '.DecimalPoint' $CONFIG_PATH)"
|
||||
CONFIG_TIMEFORMAT="$(jq --raw-output '.TimeFormat' $CONFIG_PATH)"
|
||||
CONFIG_SYNCHTIME="$(jq --raw-output '.SynchTime' $CONFIG_PATH)"
|
||||
CONFIG_SYNCHTIMELOW="$(jq --raw-output '.SynchTimeLow' $CONFIG_PATH)"
|
||||
CONFIG_SYNCHTIMEHIGH="$(jq --raw-output '.SynchTimeHigh' $CONFIG_PATH)"
|
||||
CONFIG_SUNRSOFFSET="$(jq --raw-output '.SunRSOffset' $CONFIG_PATH)"
|
||||
CONFIG_LOCALE="$(jq --raw-output '.Locale' $CONFIG_PATH)"
|
||||
CONFIG_TIMEZONE="$(jq --raw-output '.Timezone' $CONFIG_PATH)"
|
||||
CONFIG_BTCONNECTRETRIES="$(jq --raw-output '.BTConnectRetries' $CONFIG_PATH)"
|
||||
CONFIG_CSV_EXPORT="$(jq --raw-output '.CSV_Export' $CONFIG_PATH)"
|
||||
CONFIG_CSV_EXTENDEDHEADER="$(jq --raw-output '.CSV_ExtendedHeader' $CONFIG_PATH)"
|
||||
CONFIG_CSV_HEADER="$(jq --raw-output '.CSV_Header' $CONFIG_PATH)"
|
||||
CONFIG_CSV_SAVEZEROPOWER="$(jq --raw-output '.CSV_SaveZeroPower' $CONFIG_PATH)"
|
||||
CONFIG_CSV_DELIMITER="$(jq --raw-output '.CSV_Delimiter' $CONFIG_PATH)"
|
||||
CONFIG_CSV_SPOT_TIMESOURCE="$(jq --raw-output '.CSV_Spot_TimeSource' $CONFIG_PATH)"
|
||||
CONFIG_CSV_SPOT_WEBBOXHEADER="$(jq --raw-output '.CSV_Spot_WebboxHeader' $CONFIG_PATH)"
|
||||
CONFIG_SQL_DATABASE="$(jq --raw-output '.SQL_Database' $CONFIG_PATH)"
|
||||
CONFIG_SQL_HOSTNAME="$(jq --raw-output '.SQL_Hostname' $CONFIG_PATH)"
|
||||
CONFIG_SQL_PORT="$(jq --raw-output '.SQL_Port' $CONFIG_PATH)"
|
||||
CONFIG_SQL_USERNAME="$(jq --raw-output '.SQL_Username' $CONFIG_PATH)"
|
||||
CONFIG_SQL_PASSWORD="$(jq --raw-output '.SQL_Password' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_PUBLISHER="$(jq --raw-output '.MQTT_Publisher' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_HOST="$(jq --raw-output '.MQTT_Host' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_PORT="$(jq --raw-output '.MQTT_Port' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_TOPIC="$(jq --raw-output '.MQTT_Topic' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_ITEMFORMAT="$(jq --raw-output '.MQTT_ItemFormat' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_ITEMDELIMITER="$(jq --raw-output '.MQTT_ItemDelimiter' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_PUBLISHERARGS="$(jq --raw-output '.MQTT_PublisherArgs' $CONFIG_PATH)"
|
||||
CONFIG_MQTT_DATA="$(jq --raw-output '.MQTT_Data' $CONFIG_PATH)"
|
||||
CONFIG_LOGDIR="$(jq --raw-output '.LogDir' $CONFIG_PATH)"
|
||||
CONFIG_LOGLEVEL="$(jq --raw-output '.LogLevel' $CONFIG_PATH)"
|
||||
CONFIG_PVOUTPUT_SID="$(jq --raw-output '.PVoutput_SID' $CONFIG_PATH)"
|
||||
CONFIG_PVOUTPUT_KEY="$(jq --raw-output '.PVoutput_Key' $CONFIG_PATH)"
|
||||
|
||||
cat > "$CFG_PATH" <<EOL
|
||||
################################################################################
|
||||
# ____ ____ _____ _
|
||||
# / ___|| __ )| ___|__ _ __ ___ | |_
|
||||
# \___ \| _ \| |_ / __| '_ \ / _ \| __|
|
||||
# ___) | |_) | _|\__ \ |_) | (_) | |_
|
||||
# |____/|____/|_| |___/ .__/ \___/ \__|
|
||||
# |_|
|
||||
#
|
||||
# SBFspot.cfg - Configuration file for SBFspot.exe
|
||||
# SBFspot - Yet another tool to read power production of SMA<4D> solar inverters
|
||||
# (c)2012-2018, SBF
|
||||
#
|
||||
# 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 and Speedwire are registered trademarks of SMA Solar Technology AG
|
||||
################################################################################
|
||||
|
||||
# SMA Inverter's Bluetooth address
|
||||
# Windows: smaspot -scan
|
||||
# Linux : hcitool scan
|
||||
# IMPORTANT FOR SPEEDWIRE USERS: COMMENT OUT BTADDRESS (PUT # IN FRONT)
|
||||
# BTAddress=$CONFIG_BTADDRESS
|
||||
|
||||
# If multiple local BT adapters are available, select the one to use
|
||||
# LocalBTAddress=$CONFIG_LOCALBTADDRESS
|
||||
|
||||
# SMA Inverter's Speedwire IP address
|
||||
# If IP_Address is not set or is 0.0.0.0 SBFspot will try to detect the speedwire inverter by broadcast
|
||||
# If IP_Address is set to a valid IP, SBFspot will try to connect directly to that IP without broadcast detection
|
||||
# Multiple IP addresses can be provided (comma separated)
|
||||
IP_Address=$CONFIG_IP_ADDRESS
|
||||
|
||||
# User password (default 0000)
|
||||
# Password=$CONFIG_PASSWORD
|
||||
|
||||
# MIS_Enabled (Multi Inverter Support: Default=0 Disabled)
|
||||
# +------------+-------+-------------+
|
||||
# | #Inverters | NetID | MIS_Enabled |
|
||||
# +------------+-------+-------------+
|
||||
# | 1 | 1 | Don't Care |
|
||||
# +------------+-------+-------------+
|
||||
# | 1 | >1 | 0 |
|
||||
# +------------+-------+-------------+
|
||||
# | >1 | >1 | 1 |
|
||||
# +------------+-------+-------------+
|
||||
MIS_Enabled=$CONFIG_MSI_ENABLED
|
||||
|
||||
# Plantname
|
||||
Plantname=$CONFIG_PLANTNAME
|
||||
|
||||
# OutputPath (Place to store CSV files)
|
||||
#
|
||||
# Windows: C:\Users\Public\SMAdata\%Y
|
||||
# Linux : /home/pi/smadata/%Y
|
||||
# %Y %m and %d will be expanded to Year Month and Day
|
||||
OutputPath=$CONFIG_OUTPUTPATH
|
||||
|
||||
# OutputPathEvents (Place to store CSV files for events)
|
||||
# If omitted, OutputPath is used
|
||||
OutputPathEvents=$CONFIG_OUTPUTPATHEVENTS
|
||||
|
||||
# Position of pv-plant http://itouchmap.com/latlong.html
|
||||
# Example for Ukkel, Belgium
|
||||
Latitude=$CONFIG_LATITUDE
|
||||
Longitude=$CONFIG_LONGITUDE
|
||||
|
||||
# Calculate Missing SpotValues
|
||||
# If set to 1, values not provided by inverter will be calculated
|
||||
# eg: Pdc1 = Idc1 * Udc1
|
||||
CalculateMissingSpotValues=$CONFIG_CALCULATEMISSINGSPOTVALUES
|
||||
|
||||
# DateTimeFormat (default %d/%m/%Y %H:%M:%S)
|
||||
# For details see strftime() function
|
||||
# http://www.cplusplus.com/reference/clibrary/ctime/strftime/
|
||||
DateTimeFormat=$CONFIG_DATETIMEFORMAT
|
||||
|
||||
# DateFormat (default %d/%m/%Y)
|
||||
DateFormat=$CONFIG_DATEFORMAT
|
||||
|
||||
# DecimalPoint (comma/point default comma)
|
||||
DecimalPoint=$CONFIG_DECIMALPOINT
|
||||
|
||||
# TimeFormat (default %H:%M:%S)
|
||||
TimeFormat=$CONFIG_TIMEFORMAT
|
||||
|
||||
# SynchTime (0-30 - 0=disabled, 1=once a day (default), 7=once a week, 30=once a month)
|
||||
# If set to non-zero value, the plant time is synchronised with local host time
|
||||
# Some inverters don't have a real-time clock
|
||||
SynchTime=$CONFIG_SYNCHTIME
|
||||
|
||||
# SynchTimeLow (1-120 - default 1)
|
||||
# SynchTimeHigh (1200-3600 - default 3600)
|
||||
# Plant time is adjusted to local host time when SynchTime=1 and
|
||||
# time difference is between SynchTimeLow and SynchTimeHigh limits
|
||||
SynchTimeLow=$CONFIG_SYNCHTIMELOW
|
||||
SynchTimeHigh=$CONFIG_SYNCHTIMEHIGH
|
||||
|
||||
# SunRSOffset
|
||||
# Offset to start before sunrise and end after sunset (0-3600 - default 900 seconds)
|
||||
SunRSOffset=$CONFIG_SUNRSOFFSET
|
||||
|
||||
# Locale
|
||||
# Translate Entries in CSV files
|
||||
# Supported locales: de-DE;en-US;fr-FR;nl-NL;es-ES;it-IT
|
||||
# Default en-US
|
||||
Locale=$CONFIG_LOCALE
|
||||
|
||||
# Timezone
|
||||
# Select the right timezone in date_time_zonespec.csv
|
||||
# e.g. Timezone=Europe/Brussels
|
||||
Timezone=$CONFIG_TIMEZONE
|
||||
|
||||
# BTConnectRetries
|
||||
# Number of Bluetooth Connection attempts (1-15; Default=10)
|
||||
BTConnectRetries=$CONFIG_BTCONNECTRETRIES
|
||||
|
||||
###########################
|
||||
### CSV Export Settings ###
|
||||
###########################
|
||||
# With CSV_* settings you can define the CSV file format
|
||||
|
||||
# CSV_Export (default 1 = Enabled)
|
||||
# Enables or disables the CSV Export functionality
|
||||
CSV_Export=$CONFIG_CSV_EXPORT
|
||||
|
||||
# CSV_ExtendedHeader (default 1 = On)
|
||||
# Enables or disables the SMA extended header info (8 lines)
|
||||
# isep=;
|
||||
# Version CSV1|Tool SBFspot|Linebreaks CR/LF|Delimiter semicolon|Decimalpoint comma|Precision 3
|
||||
# etc...
|
||||
# This is usefull for manual data upload to pvoutput.org
|
||||
CSV_ExtendedHeader=$CONFIG_CSV_EXTENDEDHEADER
|
||||
|
||||
# CSV_Header (default 1 = On)
|
||||
# Enables or disables the CSV data header info (1 line)
|
||||
# dd/MM/yyyy HH:mm:ss;kWh;kW
|
||||
# This is usefull for manual data upload to pvoutput.org
|
||||
# If CSV_ExtendedHeader is enabled, CSV_Header is also enabled
|
||||
CSV_Header=$CONFIG_CSV_HEADER
|
||||
|
||||
# CSV_SaveZeroPower (default 1 = On)
|
||||
# When enabled, daily csv files contain all data from 00:00 to 23:55
|
||||
# This is usefull for manual data upload to pvoutput.org
|
||||
CSV_SaveZeroPower=$CONFIG_CSV_SAVEZEROPOWER
|
||||
|
||||
# CSV_Delimiter (comma/semicolon default semicolon)
|
||||
CSV_Delimiter=$CONFIG_CSV_DELIMITER
|
||||
|
||||
# CSV_Spot_TimeSource (Inverter|Computer default Inverter)
|
||||
CSV_Spot_TimeSource=$CONFIG_CSV_SPOT_TIMESOURCE
|
||||
|
||||
# CSV_Spot_WebboxHeader (Default 0 = Off)
|
||||
# When enabled, use Webbox style header (DcMs.Watt[A];DcMs.Watt[B]...)
|
||||
CSV_Spot_WebboxHeader=$CONFIG_CSV_SPOT_WEBBOXHEADER
|
||||
|
||||
###########################
|
||||
### SQL DB Settings ###
|
||||
###########################
|
||||
|
||||
# SQLite
|
||||
# SQL_Database (Fullpath to SQLite DB)
|
||||
# Windows: C:\Users\Public\SMAdata\SBFspot.db
|
||||
# Linux : /home/pi/smadata/SBFspot.db
|
||||
#SQL_Database=/home/pi/smadata/SBFspot.db
|
||||
|
||||
# MySQL
|
||||
SQL_Database=$CONFIG_SQL_DATABASE
|
||||
SQL_Hostname=$CONFIG_SQL_HOSTNAME
|
||||
SQL_Port=$CONFIG_SQL_PORT
|
||||
SQL_Username=$CONFIG_SQL_USERNAME
|
||||
SQL_Password=$CONFIG_SQL_PASSWORD
|
||||
|
||||
#########################
|
||||
### MQTT Settings ###
|
||||
#########################
|
||||
|
||||
|
||||
MQTT_Publisher=$CONFIG_MQTT_PUBLISHER
|
||||
MQTT_Host=$CONFIG_MQTT_HOST
|
||||
MQTT_Port=$CONFIG_MQTT_PORT
|
||||
MQTT_Topic=$CONFIG_MQTT_TOPIC
|
||||
MQTT_ItemFormat=$CONFIG_MQTT_ITEMFORMAT
|
||||
MQTT_ItemDelimiter=$CONFIG_MQTT_ITEMDELIMITER
|
||||
MQTT_PublisherArgs=$CONFIG_MQTT_PUBLISHERARGS
|
||||
MQTT_Data=$CONFIG_MQTT_DATA
|
||||
EOL
|
||||
|
||||
#cat $1
|
||||
|
||||
cat > "$CFG_PATH_UPLOAD" <<EOL
|
||||
################################################################################
|
||||
# SBFspotUpload.cfg - Configuration file for SBFspotUploadService/Daemon
|
||||
# (c)2012-2014, SBF (https://sbfspot.codeplex.com)
|
||||
#
|
||||
# DISCLAIMER:
|
||||
# A user of SBFspotUploadService/Daemon 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.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
|
||||
################################
|
||||
### Log Settings ###
|
||||
################################
|
||||
# Windows: C:\Users\Public\SMAdata\Logs
|
||||
# Linux : /home/pi/smadata/logs
|
||||
#LogDir=C:\Users\Public\SMAdata\Logs
|
||||
LogDir=$CONFIG_LOGDIR
|
||||
|
||||
#LogLevel=debug|info|warning|error (default info)
|
||||
LogLevel=$CONFIG_LOGLEVEL
|
||||
|
||||
################################
|
||||
### PVoutput Upload Settings ###
|
||||
################################
|
||||
#PVoutput_SID
|
||||
#Map inverters to PVoutput System ID's
|
||||
#PVoutput_SID=SerialNmbrInverter_1:PVoutput_System_ID_1,SerialNmbrInverter_2:PVoutput_System_ID_2
|
||||
#e.g. PVoutput_SID=200212345:4321
|
||||
PVoutput_SID=$CONFIG_PVOUTPUT_SID
|
||||
|
||||
#PVoutput_Key
|
||||
#Sets PVoutput API Key
|
||||
PVoutput_Key=$CONFIG_PVOUTPUT_KEY
|
||||
|
||||
################################
|
||||
### SQL DB Settings ###
|
||||
################################
|
||||
# SQL_Database (Fullpath to SQLite DB)
|
||||
# Windows: C:\Users\Public\SMAdata\SBFspot.db
|
||||
# Linux : /home/pi/smadata/SBFspot.db
|
||||
#SQL_Database=C:\Users\Public\SMAdata\SBFspot.db
|
||||
#SQL_Database=/home/pi/smadata/SBFspot.db
|
||||
|
||||
# Reserved for MySQL
|
||||
SQL_Database=$CONFIG_SQL_DATABASE
|
||||
SQL_Hostname=$CONFIG_SQL_HOSTNAME
|
||||
SQL_Username=$CONFIG_SQL_USERNAME
|
||||
SQL_Password=$CONFIG_SQL_PASSWORD
|
||||
EOL
|
||||
|
||||
#cat $CFG_PATH_UPLOAD
|
||||
|
||||
# create folders
|
||||
mkdir -p "$CONFIG_OUTPUTPATH"
|
||||
mkdir -p "$CONFIG_LOGDIR"
|
|
@ -2,10 +2,12 @@ CFG_PATH=$1
|
|||
CFG_PATH_UPLOAD=$2
|
||||
CONFIG_PATH=/data/options.json
|
||||
|
||||
echo "Generating $CFG_PATH & $CFG_PATH_UPLOAD"
|
||||
|
||||
#CONFIG_CONNECTION_TYPE="$(jq --raw-output '.Connection_Type' $CONFIG_PATH)"
|
||||
#CONFIG_BLUETOOTH="$(jq --raw-output '.Bluetooth' $CONFIG_PATH)"
|
||||
#CONFIG_ETHERNET="$(jq --raw-output '.Ethernet' $CONFIG_PATH)"
|
||||
CONFIG_BTADDRESS="$(jq --raw-output '.BTAddress' $CONFIG_PATH)"
|
||||
CONFIG_LOCALBTADDRESS="$(jq --raw-output '.LocalBTAddress' $CONFIG_PATH)"
|
||||
CONFIG_IP_ADDRESS="$(jq --raw-output '.IP_Address' $CONFIG_PATH)"
|
||||
CONFIG_PASSWORD="$(jq --raw-output '.Password' $CONFIG_PATH)"
|
||||
CONFIG_MSI_ENABLED="$(jq --raw-output '.MIS_Enabled' $CONFIG_PATH)"
|
||||
CONFIG_PLANTNAME="$(jq --raw-output '.Plantname' $CONFIG_PATH)"
|
||||
|
@ -50,7 +52,7 @@ CONFIG_LOGLEVEL="$(jq --raw-output '.LogLevel' $CONFIG_PATH)"
|
|||
CONFIG_PVOUTPUT_SID="$(jq --raw-output '.PVoutput_SID' $CONFIG_PATH)"
|
||||
CONFIG_PVOUTPUT_KEY="$(jq --raw-output '.PVoutput_Key' $CONFIG_PATH)"
|
||||
|
||||
cat > $CFG_PATH <<EOL
|
||||
cat > "$CFG_PATH" <<EOL
|
||||
################################################################################
|
||||
# ____ ____ _____ _
|
||||
# / ___|| __ )| ___|__ _ __ ___ | |_
|
||||
|
@ -78,19 +80,19 @@ cat > $CFG_PATH <<EOL
|
|||
# Windows: smaspot -scan
|
||||
# Linux : hcitool scan
|
||||
# IMPORTANT FOR SPEEDWIRE USERS: COMMENT OUT BTADDRESS (PUT # IN FRONT)
|
||||
BTAddress=$CONFIG_BTADDRESS
|
||||
BTAddress=$CONFIG_BTADDRESS
|
||||
|
||||
# If multiple local BT adapters are available, select the one to use
|
||||
LocalBTAddress=$CONFIG_LOCALBTADDRESS
|
||||
LocalBTAddress=$CONFIG_LOCALBTADDRESS
|
||||
|
||||
# SMA Inverter's Speedwire IP address
|
||||
# If IP_Address is not set or is 0.0.0.0 SBFspot will try to detect the speedwire inverter by broadcast
|
||||
# If IP_Address is set to a valid IP, SBFspot will try to connect directly to that IP without broadcast detection
|
||||
# Multiple IP addresses can be provided (comma separated)
|
||||
#IP_Address=0.0.0.0
|
||||
IP_Address=$CONFIG_IP_ADDRESS
|
||||
|
||||
# User password (default 0000)
|
||||
Password=$CONFIG_PASSWORD
|
||||
Password=$CONFIG_PASSWORD
|
||||
|
||||
# MIS_Enabled (Multi Inverter Support: Default=0 Disabled)
|
||||
# +------------+-------+-------------+
|
||||
|
@ -102,76 +104,76 @@ Password=$CONFIG_PASSWORD
|
|||
# +------------+-------+-------------+
|
||||
# | >1 | >1 | 1 |
|
||||
# +------------+-------+-------------+
|
||||
MIS_Enabled=$CONFIG_MSI_ENABLED
|
||||
MIS_Enabled=$CONFIG_MSI_ENABLED
|
||||
|
||||
# Plantname
|
||||
Plantname=$CONFIG_PLANTNAME
|
||||
Plantname=$CONFIG_PLANTNAME
|
||||
|
||||
# OutputPath (Place to store CSV files)
|
||||
#
|
||||
# Windows: C:\Users\Public\SMAdata\%Y
|
||||
# Linux : /home/pi/smadata/%Y
|
||||
# %Y %m and %d will be expanded to Year Month and Day
|
||||
OutputPath=$CONFIG_OUTPUTPATH
|
||||
OutputPath=$CONFIG_OUTPUTPATH
|
||||
|
||||
# OutputPathEvents (Place to store CSV files for events)
|
||||
# If omitted, OutputPath is used
|
||||
OutputPathEvents=$CONFIG_OUTPUTPATHEVENTS
|
||||
OutputPathEvents=$CONFIG_OUTPUTPATHEVENTS
|
||||
|
||||
# Position of pv-plant http://itouchmap.com/latlong.html
|
||||
# Example for Ukkel, Belgium
|
||||
Latitude=$CONFIG_LATITUDE
|
||||
Longitude=$CONFIG_LONGITUDE
|
||||
Latitude=$CONFIG_LATITUDE
|
||||
Longitude=$CONFIG_LONGITUDE
|
||||
|
||||
# Calculate Missing SpotValues
|
||||
# If set to 1, values not provided by inverter will be calculated
|
||||
# eg: Pdc1 = Idc1 * Udc1
|
||||
CalculateMissingSpotValues=$CONFIG_CALCULATEMISSINGSPOTVALUES
|
||||
CalculateMissingSpotValues=$CONFIG_CALCULATEMISSINGSPOTVALUES
|
||||
|
||||
# DateTimeFormat (default %d/%m/%Y %H:%M:%S)
|
||||
# For details see strftime() function
|
||||
# http://www.cplusplus.com/reference/clibrary/ctime/strftime/
|
||||
DateTimeFormat=$CONFIG_DATETIMEFORMAT
|
||||
DateTimeFormat=$CONFIG_DATETIMEFORMAT
|
||||
|
||||
# DateFormat (default %d/%m/%Y)
|
||||
DateFormat=$CONFIG_DATEFORMAT
|
||||
DateFormat=$CONFIG_DATEFORMAT
|
||||
|
||||
# DecimalPoint (comma/point default comma)
|
||||
DecimalPoint=$CONFIG_DECIMALPOINT
|
||||
DecimalPoint=$CONFIG_DECIMALPOINT
|
||||
|
||||
# TimeFormat (default %H:%M:%S)
|
||||
TimeFormat=$CONFIG_TIMEFORMAT
|
||||
TimeFormat=$CONFIG_TIMEFORMAT
|
||||
|
||||
# SynchTime (0-30 - 0=disabled, 1=once a day (default), 7=once a week, 30=once a month)
|
||||
# If set to non-zero value, the plant time is synchronised with local host time
|
||||
# Some inverters don't have a real-time clock
|
||||
SynchTime=$CONFIG_SYNCHTIME
|
||||
SynchTime=$CONFIG_SYNCHTIME
|
||||
|
||||
# SynchTimeLow (1-120 - default 1)
|
||||
# SynchTimeHigh (1200-3600 - default 3600)
|
||||
# Plant time is adjusted to local host time when SynchTime=1 and
|
||||
# time difference is between SynchTimeLow and SynchTimeHigh limits
|
||||
SynchTimeLow=$CONFIG_SYNCHTIMELOW
|
||||
SynchTimeHigh=$CONFIG_SYNCHTIMEHIGH
|
||||
SynchTimeLow=$CONFIG_SYNCHTIMELOW
|
||||
SynchTimeHigh=$CONFIG_SYNCHTIMEHIGH
|
||||
|
||||
# SunRSOffset
|
||||
# Offset to start before sunrise and end after sunset (0-3600 - default 900 seconds)
|
||||
SunRSOffset=$CONFIG_SUNRSOFFSET
|
||||
SunRSOffset=$CONFIG_SUNRSOFFSET
|
||||
|
||||
# Locale
|
||||
# Translate Entries in CSV files
|
||||
# Supported locales: de-DE;en-US;fr-FR;nl-NL;es-ES;it-IT
|
||||
# Default en-US
|
||||
Locale=$CONFIG_LOCALE
|
||||
Locale=$CONFIG_LOCALE
|
||||
|
||||
# Timezone
|
||||
# Select the right timezone in date_time_zonespec.csv
|
||||
# e.g. Timezone=Europe/Brussels
|
||||
Timezone=$CONFIG_TIMEZONE
|
||||
Timezone=$CONFIG_TIMEZONE
|
||||
|
||||
# BTConnectRetries
|
||||
# Number of Bluetooth Connection attempts (1-15; Default=10)
|
||||
BTConnectRetries=$CONFIG_BTCONNECTRETRIES
|
||||
BTConnectRetries=$CONFIG_BTCONNECTRETRIES
|
||||
|
||||
###########################
|
||||
### CSV Export Settings ###
|
||||
|
@ -180,7 +182,7 @@ BTConnectRetries=$CONFIG_BTCONNECTRETRIES
|
|||
|
||||
# CSV_Export (default 1 = Enabled)
|
||||
# Enables or disables the CSV Export functionality
|
||||
CSV_Export=$CONFIG_CSV_EXPORT
|
||||
CSV_Export=$CONFIG_CSV_EXPORT
|
||||
|
||||
# CSV_ExtendedHeader (default 1 = On)
|
||||
# Enables or disables the SMA extended header info (8 lines)
|
||||
|
@ -188,29 +190,29 @@ CSV_Export=$CONFIG_CSV_EXPORT
|
|||
# Version CSV1|Tool SBFspot|Linebreaks CR/LF|Delimiter semicolon|Decimalpoint comma|Precision 3
|
||||
# etc...
|
||||
# This is usefull for manual data upload to pvoutput.org
|
||||
CSV_ExtendedHeader=$CONFIG_CSV_EXTENDEDHEADER
|
||||
CSV_ExtendedHeader=$CONFIG_CSV_EXTENDEDHEADER
|
||||
|
||||
# CSV_Header (default 1 = On)
|
||||
# Enables or disables the CSV data header info (1 line)
|
||||
# dd/MM/yyyy HH:mm:ss;kWh;kW
|
||||
# This is usefull for manual data upload to pvoutput.org
|
||||
# If CSV_ExtendedHeader is enabled, CSV_Header is also enabled
|
||||
CSV_Header=$CONFIG_CSV_HEADER
|
||||
CSV_Header=$CONFIG_CSV_HEADER
|
||||
|
||||
# CSV_SaveZeroPower (default 1 = On)
|
||||
# When enabled, daily csv files contain all data from 00:00 to 23:55
|
||||
# This is usefull for manual data upload to pvoutput.org
|
||||
CSV_SaveZeroPower=$CONFIG_CSV_SAVEZEROPOWER
|
||||
CSV_SaveZeroPower=$CONFIG_CSV_SAVEZEROPOWER
|
||||
|
||||
# CSV_Delimiter (comma/semicolon default semicolon)
|
||||
CSV_Delimiter=$CONFIG_CSV_DELIMITER
|
||||
CSV_Delimiter=$CONFIG_CSV_DELIMITER
|
||||
|
||||
# CSV_Spot_TimeSource (Inverter|Computer default Inverter)
|
||||
CSV_Spot_TimeSource=$CONFIG_CSV_SPOT_TIMESOURCE
|
||||
CSV_Spot_TimeSource=$CONFIG_CSV_SPOT_TIMESOURCE
|
||||
|
||||
# CSV_Spot_WebboxHeader (Default 0 = Off)
|
||||
# When enabled, use Webbox style header (DcMs.Watt[A];DcMs.Watt[B]...)
|
||||
CSV_Spot_WebboxHeader=$CONFIG_CSV_SPOT_WEBBOXHEADER
|
||||
CSV_Spot_WebboxHeader=$CONFIG_CSV_SPOT_WEBBOXHEADER
|
||||
|
||||
###########################
|
||||
### SQL DB Settings ###
|
||||
|
@ -223,30 +225,30 @@ CSV_Spot_WebboxHeader=$CONFIG_CSV_SPOT_WEBBOXHEADER
|
|||
#SQL_Database=/home/pi/smadata/SBFspot.db
|
||||
|
||||
# MySQL
|
||||
SQL_Database=$CONFIG_SQL_DATABASE
|
||||
SQL_Hostname=$CONFIG_SQL_HOSTNAME
|
||||
SQL_Port=$CONFIG_SQL_PORT
|
||||
SQL_Username=$CONFIG_SQL_USERNAME
|
||||
SQL_Password=$CONFIG_SQL_PASSWORD
|
||||
SQL_Database=$CONFIG_SQL_DATABASE
|
||||
SQL_Hostname=$CONFIG_SQL_HOSTNAME
|
||||
SQL_Port=$CONFIG_SQL_PORT
|
||||
SQL_Username=$CONFIG_SQL_USERNAME
|
||||
SQL_Password=$CONFIG_SQL_PASSWORD
|
||||
|
||||
#########################
|
||||
### MQTT Settings ###
|
||||
#########################
|
||||
|
||||
|
||||
MQTT_Publisher=$CONFIG_MQTT_PUBLISHER
|
||||
MQTT_Host=$CONFIG_MQTT_HOST
|
||||
MQTT_Port=$CONFIG_MQTT_PORT
|
||||
MQTT_Topic=$CONFIG_MQTT_TOPIC
|
||||
MQTT_ItemFormat=$CONFIG_MQTT_ITEMFORMAT
|
||||
MQTT_ItemDelimiter=$CONFIG_MQTT_ITEMDELIMITER
|
||||
MQTT_PublisherArgs=$CONFIG_MQTT_PUBLISHERARGS
|
||||
MQTT_Data=$CONFIG_MQTT_DATA
|
||||
MQTT_Publisher=$CONFIG_MQTT_PUBLISHER
|
||||
MQTT_Host=$CONFIG_MQTT_HOST
|
||||
MQTT_Port=$CONFIG_MQTT_PORT
|
||||
MQTT_Topic=$CONFIG_MQTT_TOPIC
|
||||
MQTT_ItemFormat=$CONFIG_MQTT_ITEMFORMAT
|
||||
MQTT_ItemDelimiter=$CONFIG_MQTT_ITEMDELIMITER
|
||||
MQTT_PublisherArgs=$CONFIG_MQTT_PUBLISHERARGS
|
||||
MQTT_Data=$CONFIG_MQTT_DATA
|
||||
EOL
|
||||
|
||||
#cat $1
|
||||
|
||||
cat > $CFG_PATH_UPLOAD <<EOL
|
||||
cat > "$CFG_PATH_UPLOAD" <<EOL
|
||||
################################################################################
|
||||
# SBFspotUpload.cfg - Configuration file for SBFspotUploadService/Daemon
|
||||
# (c)2012-2014, SBF (https://sbfspot.codeplex.com)
|
||||
|
@ -267,11 +269,11 @@ cat > $CFG_PATH_UPLOAD <<EOL
|
|||
################################
|
||||
# Windows: C:\Users\Public\SMAdata\Logs
|
||||
# Linux : /home/pi/smadata/logs
|
||||
#LogDir=C:\Users\Public\SMAdata\Logs
|
||||
LogDir=$CONFIG_LOGDIR
|
||||
# LogDir=C:\Users\Public\SMAdata\Logs
|
||||
LogDir=$CONFIG_LOGDIR
|
||||
|
||||
#LogLevel=debug|info|warning|error (default info)
|
||||
LogLevel=$CONFIG_LOGLEVEL
|
||||
# LogLevel=debug|info|warning|error (default info)
|
||||
LogLevel=$CONFIG_LOGLEVEL
|
||||
|
||||
################################
|
||||
### PVoutput Upload Settings ###
|
||||
|
@ -280,11 +282,11 @@ LogLevel=$CONFIG_LOGLEVEL
|
|||
#Map inverters to PVoutput System ID's
|
||||
#PVoutput_SID=SerialNmbrInverter_1:PVoutput_System_ID_1,SerialNmbrInverter_2:PVoutput_System_ID_2
|
||||
#e.g. PVoutput_SID=200212345:4321
|
||||
PVoutput_SID=$CONFIG_PVOUTPUT_SID
|
||||
PVoutput_SID=$CONFIG_PVOUTPUT_SID
|
||||
|
||||
#PVoutput_Key
|
||||
#Sets PVoutput API Key
|
||||
PVoutput_Key=$CONFIG_PVOUTPUT_KEY
|
||||
PVoutput_Key=$CONFIG_PVOUTPUT_KEY
|
||||
|
||||
################################
|
||||
### SQL DB Settings ###
|
||||
|
@ -296,14 +298,14 @@ PVoutput_Key=$CONFIG_PVOUTPUT_KEY
|
|||
#SQL_Database=/home/pi/smadata/SBFspot.db
|
||||
|
||||
# Reserved for MySQL
|
||||
SQL_Database=$CONFIG_SQL_DATABASE
|
||||
SQL_Hostname=$CONFIG_SQL_HOSTNAME
|
||||
SQL_Username=$CONFIG_SQL_USERNAME
|
||||
SQL_Password=$CONFIG_SQL_PASSWORD
|
||||
SQL_Database=$CONFIG_SQL_DATABASE
|
||||
SQL_Hostname=$CONFIG_SQL_HOSTNAME
|
||||
SQL_Username=$CONFIG_SQL_USERNAME
|
||||
SQL_Password=$CONFIG_SQL_PASSWORD
|
||||
EOL
|
||||
|
||||
#cat $CFG_PATH_UPLOAD
|
||||
|
||||
# create folders
|
||||
mkdir -p $CONFIG_OUTPUTPATH
|
||||
mkdir -p $CONFIG_LOGDIR
|
||||
mkdir -p "$CONFIG_OUTPUTPATH"
|
||||
mkdir -p "$CONFIG_LOGDIR"
|
|
@ -12,10 +12,11 @@ sleep 45
|
|||
#---- Use lognow variable to select latest file
|
||||
#---- Print tail of latest log
|
||||
|
||||
message=$(echo "[SBFspot Upload Log Latest] $(tail -n1 /data/sbfspot/log/SBFspotUpload$lognow.log)")
|
||||
|
||||
#message=$(echo "[SBFspot Upload Log Latest] $(tail -n1 /data/sbfspot/log/SBFspotUpload$lognow.log)")
|
||||
#bashio::log.info "${message:="Hello World..."}"
|
||||
## Print the message the user supplied, defaults to "Hello World..."
|
||||
bashio::log.info "${message:="Hello World..."}"
|
||||
|
||||
bashio::log.info "[SBFspot Upload Log Latest] $(tail -n1 "/data/sbfspot/log/SBFspotUpload$lognow.log")"
|
||||
|
||||
|
||||
#---- Delete old log files
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue