Delete test-sbfspot directory

This commit is contained in:
habuild 2022-08-08 13:57:14 +10:00 committed by GitHub
parent 9f0384de31
commit 16facd6ee3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 0 additions and 1889 deletions

View file

@ -1,51 +0,0 @@
---
<!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog -->
## ![Version](https://img.shields.io/badge/dynamic/json?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Fhabuild%2Fhassio-addons%2Fmain%2Ftest-sbfspot%2Fconfig.json)
- This is a test version and will change without warning.
- as above, you have been warned
- apparmor is working
- added hassio:api
- added services:need for mariadb, mqtt:want
## ![Release][release-shield-2022-7-3]
[release-shield-2022-7-3]: https://img.shields.io/badge/version-2022.7.3-blue.svg
- This is a test version and will change without warning.
- as above, you have been warned
- added services:need for mariadb
## ![Release][release-shield-2022-3-5]
[release-shield-2022-3-5]: https://img.shields.io/badge/version-2022.3.5-blue.svg
- Add cronjob to update sensors if restart occurs.
- SBFspot version 3.9.5 was released.
## ![Release][release-shield-2022-3-4]
[release-shield-2022-3-4]: https://img.shields.io/badge/version-2022.3.4-blue.svg
- Better log handling for latest file.
- Set removal of old logs at 3 days.
## ![Release][release-shield-2022-3-3]
[release-shield-2022-3-3]: https://img.shields.io/badge/version-2022.3.3-blue.svg
- Upload logging moved to HA logging window.
- needs default /data/sbfspot/log directory.
- SBFspot version 3.9.3
## ![Release][release-shield-2022-3-2]
[release-shield-2022-3-2]: https://img.shields.io/badge/version-2022.3.2-blue.svg
- bug chasing
- SBFspot version 3.9.3
## ![Release][release-shield]
[release-shield]: https://img.shields.io/badge/version-2022.3.1-blue.svg
- SBFspot version 3.9.3
- Initial release
- Rebuilt to multi stage docker containter.
- This saves ~450MB on the final image.
- Is using base HA alpine container and s6 Overlay, so should be fully compatible with HAOS.
- Doesn't require complicated USER setups.
- I'm no programmer, so apologies if I break something along the way

View file

@ -1,60 +0,0 @@
---
# Community Hass.io Add-ons: SBFspot
![project-stage-shield] ![Project Maintenance][maintenance-shield]
[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg
[maintenance-shield]: https://img.shields.io/maintenance/yes/2022.svg
![Version](https://img.shields.io/badge/dynamic/json?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Fhabuild%2Fhassio-addons%2Fmaster%2Fsbfspot%2Fconfig.json)
![Arch](https://img.shields.io/badge/dynamic/json?color=success&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Fhabuild%2Fhassio-addons%2Fmaster%2Fsbfspot%2Fconfig.json)
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 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.
# 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.
![screenshot](https://raw.githubusercontent.com/habuild/hassio-addons/main/.images/MariaDB%20setup.PNG)
### 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.
**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.
**-r** is to retain messages. retain is not advised.
### 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
![Example Options](https://raw.githubusercontent.com/habuild/hassio-addons/main/.images/Example_config_png.PNG)
### Data paths
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.
### **Special thanks to:**
* LauR3y/hassio-addons which this version is cleaned up from.
* The SBFspot team for SPFspot.
![Supports aarch64 Architecture][aarch64-shield]
![Supports armhf Architecture][armhf-shield]
![Supports armv7 Architecture][armv7-shield]
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg

View file

@ -1,99 +0,0 @@
## https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile
ARG BUILD_FROM
FROM $BUILD_FROM AS builder
# Execute during the build of the image
ARG TEMPIO_VERSION BUILD_ARCH
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 nginx
# download and build SBFspot
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
# runtinme container
FROM $BUILD_FROM
ARG TEMPIO_VERSION BUILD_ARCH
RUN \
curl -sSLf -o /usr/bin/tempio \
"https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apk update && apk upgrade && apk add --no-cache boost-date_time bluez nano bluez-libs libstdc++ tzdata mariadb-common mariadb-connector-c ncurses-libs libcurl mosquitto-clients nginx
COPY rootfs /
# Copy data for add-on
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/
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/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
RUN echo 'SHELL=/bin/bash' > /etc/crontabs/root
# update sensors after restart
RUN echo '@reboot sleep 30 && /usr/bin/sbfspot/SBFspot -v -ad0 -am0 -mqtt -finq > /dev/stdout' >> /etc/crontabs/root
# daily data SBFspot
RUN echo '*/5 6-22 * * * /usr/bin/sbfspot/SBFspot -v -ad1 -am0 -ae0 -mqtt > /dev/stdout' >> /etc/crontabs/root
# 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
# 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="test-SBFspot" \
io.hass.description="Home Assitant addon for Bluetooth SBFspot" \
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" \
org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.name="test-SBFspot" \
org.label-schema.schema-version="1.0" \
org.label-schema.url="https://github.com/habuild/hassio-addons/tree/main/test-sbfspot" \
org.label-schema.usage="https://github.com/habuild/hassio-addons/tree/main/test-sbfspot/README.md" \
org.label-schema.vcs-ref=${BUILD_REF} \
org.label-schema.vcs-url="https://github.com/habuild/hassio-addons" \
org.label-schema.vendor="Hasqt"
#Launch nginx with debug options.
CMD [ "nginx","-g","daemon off;error_log /dev/stdout debug;" ]

View file

@ -1,62 +0,0 @@
# Community Hass.io Add-ons: haos-sbfspot
![Version](https://img.shields.io/badge/dynamic/json?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Fhabuild%2Fhassio-addons%2Fmain%2Ftest-sbfspot%2Fconfig.json)
![Project Stage](https://img.shields.io/badge/dynamic/json?color=blueviolet&label=Project%20Stage&query=%24.stage&url=https%3A%2F%2Fraw.githubusercontent.com%2Fhabuild%2Fhassio-addons%2Fmain%2Ftest-sbfspot%2Fconfig.json)
![Arch](https://img.shields.io/badge/dynamic/json?color=success&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Fhabuild%2Fhassio-addons%2Fmain%2Ftest-sbfspot%2Fconfig.json)
![Project Maintenance][maintenance-shield]
[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg
[maintenance-shield]: https://img.shields.io/maintenance/yes/2022.svg
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/releases/latest). This version is for the OS installation method of Home assistant.
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.
# 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.
![screenshot](https://raw.githubusercontent.com/habuild/hassio-addons/main/.images/MariaDB%20setup.PNG)
### 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.
**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. Which is helpful for confirming the MQTT messages are actually being sent.
**-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/haos-sbfspot/.images/Example_Config.yaml) or entered via UI
![Example Options](https://raw.githubusercontent.com/habuild/hassio-addons/main/.images/Example_config_png.PNG)
### Data paths
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.
### **Special thanks to:**
* LauR3y/hassio-addons which this version is cleaned up from.
* The sbfspot team for SPFspot.
![Supports aarch64 Architecture][aarch64-shield]
![Supports armhf Architecture][armhf-shield]
![Supports armv7 Architecture][armv7-shield]
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg

View file

@ -1,37 +0,0 @@
#include <tunables/global>
profile test-sbfspot flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
# Capabilities
capability,
file,
signal (send) set=(kill,term,int,hup,cont),
# S6-Overlay
/init ix,
/bin/** ix,
/usr/bin/** ix,
/run/{s6,s6-rc*,service}/** ix,
/package/** ix,
/command/** ix,
/etc/services.d/** rwix,
/etc/cont-init.d/** rwix,
/etc/cont-finish.d/** rwix,
/run/{,**} rwk,
/dev/tty rw,
# Bashio
# /usr/lib/bashio/** ix,
# /tmp/** rwk,
# Access to options.json and other files within your addon
/data/** rw,
# suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
ptrace (trace,read) peer=docker-default,
# docker daemon confinement requires explict allow rule for signal
signal (receive) set=(kill,term) peer=/usr/bin/docker,
}

View file

@ -1,15 +0,0 @@
--- # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile
build_from:
aarch64: "ghcr.io/home-assistant/aarch64-base:3.16"
armhf: "ghcr.io/home-assistant/armhf-base:3.16"
armv7: "ghcr.io/home-assistant/armv7-base:3.16"
amd64: "ghcr.io/home-assistant/amd64-base:3.16"
i386: "ghcr.io/home-assistant/i386-base:3.16"
labels:
org.opencontainers.image.title: "SBFspot for Home Assistant BT and IP"
org.opencontainers.image.description: "SBFspot Bluetooth add-ons."
org.opencontainers.image.source: "https://github.com/habuild"
org.opencontainers.image.licenses: "Apache License 2.0"
args:
TEMPIO_VERSION: "2021.09.0"

View file

@ -1,112 +0,0 @@
---
name: TEST-BFspot
version: dev01
slug: test-sbfspot
description: Manage SBFspot with a simple interface
url: 'https://github.com/habuild/hassio/tree/main/test-sbfspot'
stage: experimental
arch: [ amd64, i386 ]
init: false
hassio_api: true
panel_icon: mdi:solar-power-variant
ingress: true
ingress_port: 0
ingress_entry: /logs
services:
- 'mysql:need'
- 'mqtt:want'
options:
Connection_Type:
Connections: [ BTAddress: '00:00:00:00:00:00', Password: '0000', LocalBTAddress: '00:00:00:00:00:00', IP_Adrress: '00:00:00:00:00:00', Plantname: MyPlant]
Multi_Inverter_Systems:
- MIS_Enabled: '0'
Path: [ OutputPath: '/data/sbfspot/%Y', OutputPathEvents: '/data/sbfspot/%Y/events']
Location_and_Time: [Latitude: 'null', Longitude: 'null', Timezone: 'Europe/Brussels', 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', CalculateMissingSpotValues: '1', BTConnectRetries: '10']
CSV_Exporting:
- CSV_Export: '0'
- CSV_ExtendedHeader: '1'
- CSV_Header: '1'
- CSV_SaveZeroPower: '1'
- CSV_Delimiter: 'semicolon'
- CSV_Spot_TimeSource: 'Inverter'
- CSV_Spot_WebboxHeader: '0'
MariaDB_SQL:
- 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: '1883'
MQTT_Topic: 'homeassistant/sbfspot_{plantname}/sbfspot_{serial}'
MQTT_ItemFormat: ''
MQTT_ItemDelimiter: 'comma'
MQTT_PublisherArgs: "-h {host} -u {MQTT_Username} -P
MQTT_Password
MQTT_Data:
MQTT_ENABLE: '1'
PVoutput_SID: 'yourSID0123456789:12345"
PVoutput_Key: 'fake9364fake4545fake834fake'
LogDir: '/data/sbfspot/log/'
LogLevel: 'info'
schema:
Connection_Type: list(Bluetooth|Ethernet)?
Connections:
- BTAddress: 'str?'
- Password: 'str?'
- LocalBTAddress: 'str?'
- IP_Address: 'str?'
- Plantname: 'str'
Multi_Inverter_Systems:
- MIS_Enabled: 'int?'
Path:
- OutputPath: 'str?'
- OutputPathEvents: 'str?'
Location_and_Time:
- 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_Exporting:
- CSV_Export: 'int?'
- CSV_ExtendedHeader: 'int?'
- CSV_Header: 'int?'
- CSV_SaveZeroPower: 'int?'
- CSV_Delimiter: 'str?'
- CSV_Spot_TimeSource: 'str?'
- CSV_Spot_WebboxHeader: 'int?'
MariaDB_SQL:
- 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'
MQTT_ENABLE: 'int'
PVOutput:
- PVoutput_SID: 'str'
- PVoutput_Key: 'str'
- LogDir: 'str'
- LogLevel: 'str'
host_network: 'true'
host_dbus: 'true'
image: 'ghcr.io/habuild/{arch}-addon-test-sbfspot'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -1,5 +0,0 @@
server {
listen 8099;
allow 172.30.32.2;
deny all;
}

View file

@ -1,12 +0,0 @@
#!/usr/bin/env bashio
# ==============================================================================
# Take down the S6 supervision tree when example fails
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================
if [[ "$1" -ne 0 ]] && [[ "$1" -ne 256 ]]; then
bashio::log.warning "Halt add-on"
exec /run/s6/basedir/bin/halt
fi
bashio::log.info "Service restart after closing"

View file

@ -1,145 +0,0 @@
#!/usr/bin/with-contenv bashio
#shellcheck shell=bash
# ==============================================================================
# Start the SBFspot service
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================
#CFG_PATH=/usr/bin/sbfspot/SBFspot.cfg
#CFG_UPLOAD_PATH=/usr/bin/sbfspot/SBFspotUpload.cfg
# --- GENERATE CONFIG --
message=$(echo "PWD is current directory $(pwd)")
bashio::log.debug "${message:=""}"
cd /
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
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
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
/usr/bin/sbfspot/genEthernetConfig.sh /usr/bin/sbfspot/SBFspot.cfg /usr/bin/sbfspot/SBFspotUpload.cfg
else
bashio::log.info "Setup failed"
fi
set +x
# ---- RUN ----
message=$(echo "[Starting SBFspotUpload]")
bashio::log.info ${__BASHIO_COLORS_MAGENTA} "${message:=""}"
# cron
message=$(echo "[Starting cron in foreground]")
bashio::log.info "${message:=""}"
exec /usr/sbin/crond -f
# ==============================================================================
# Start the SBFspot service
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================
#CFG_PATH=/usr/bin/sbfspot/SBFspot.cfg
#CFG_UPLOAD_PATH=/usr/bin/sbfspot/SBFspotUpload.cfg
# --- GENERATE CONFIG --
message=$(echo "PWD is current directory $(pwd)")
bashio::log.debug "${message:=""}"
cd /
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
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
# ---- RUN ----
message=$(echo "[Starting SBFspotUpload]")
bashio::log.info ${__BASHIO_COLORS_MAGENTA} "${message:=""}"
# ---- Symbolic Links ----
ln -s /usr/bin/sbfspot/SBFspot /SBFspot
ln -s /usr/bin/sbfspot/SBFspot.cfg /SBFspot.cfg
ln -s /usr/bin/sbfspot/SBFspotUpload.cfg /SBFspotUpload.cfg
# cron
message=$(echo "[Starting cron in foreground]")
bashio::log.info "${message:=""}"
exec /usr/sbin/crond -f

View file

@ -1 +0,0 @@
hold the dir

View file

@ -1,268 +0,0 @@
################################################################################
# ____ ____ _____ _
# / ___|| __ )| ___|__ _ __ ___ | |_
# \___ \| _ \| |_ / __| '_ \ / _ \| __|
# ___) | |_) | _|\__ \ |_) | (_) | |_
# |____/|____/|_| |___/ .__/ \___/ \__|
# |_|
#
# SBFspot.cfg - Configuration file for SBFspot.exe
# SBFspot - Yet another tool to read power production of SMA solar inverters
# (c)2012-2021, 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: sbfspot -scan
# Linux : hcitool scan
# IMPORTANT FOR SPEEDWIRE USERS: COMMENT OUT BTADDRESS (PUT # IN FRONT)
BTAddress=00:00:00:00:00:00
# If multiple local BT adapters are available, select the one to use
#LocalBTAddress=00:00:00:00:00:00
# 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=0000
# 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=0
# Plantname
Plantname=MyPlant
# 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=/home/pi/smadata/%Y
# OutputPathEvents (Place to store CSV files for events)
# If omitted, OutputPath is used
OutputPathEvents=/home/pi/smadata/%Y/Events
# Position of pv-plant http://itouchmap.com/latlong.html
# Example for Ukkel, Belgium
Latitude=50.80
Longitude=4.33
# Calculate Missing SpotValues
# If set to 1, values not provided by inverter will be calculated
# eg: Pdc1 = Idc1 * Udc1
CalculateMissingSpotValues=1
# DateTimeFormat (default %d/%m/%Y %H:%M:%S)
# For details see strftime() function
# http://www.cplusplus.com/reference/clibrary/ctime/strftime/
DateTimeFormat=%d/%m/%Y %H:%M:%S
# DateFormat (default %d/%m/%Y)
DateFormat=%d/%m/%Y
# DecimalPoint (comma/point default comma)
DecimalPoint=comma
# TimeFormat (default %H:%M:%S)
TimeFormat=%H:%M:%S
# 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=1
# 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=1
SynchTimeHigh=3600
# SunRSOffset
# Offset to start before sunrise and end after sunset (0-3600 - default 900 seconds)
SunRSOffset=900
# Locale
# Translate Entries in CSV files
# Supported locales: de-DE;en-US;fr-FR;nl-NL;es-ES;it-IT
# Default en-US
Locale=en-US
# Timezone
# Select the right timezone in date_time_zonespec.csv
# e.g. Timezone=Europe/Brussels
Timezone=Europe/Brussels
# BTConnectRetries
# Number of Bluetooth Connection attempts (1-15; Default=10)
BTConnectRetries=10
###########################
### 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=1
# 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=1
# 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=1
# 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=1
# CSV_Delimiter (comma/semicolon default semicolon)
CSV_Delimiter=semicolon
# CSV_Spot_TimeSource (Inverter|Computer default Inverter)
CSV_Spot_TimeSource=Inverter
# CSV_Spot_WebboxHeader (Default 0 = Off)
# When enabled, use Webbox style header (DcMs.Watt[A];DcMs.Watt[B]...)
CSV_Spot_WebboxHeader=0
###########################
### 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=SBFspot
#SQL_Hostname=<Network Name> or <IP-address>
#SQL_Port=3306
#SQL_Username=SBFspotUser
#SQL_Password=SBFspotPassword
#########################
### MQTT Settings ###
#########################
# Full path to mosquitto_pub executable
# Linux: sudo apt-get install mosquitto-clients
MQTT_Publisher=/usr/bin/mosquitto_pub
# Windows: Download and install mosquitto clients from https://mosquitto.org/download/
# Mosquitto 64-bit on Windows 64-bit
# MQTT_Publisher=%ProgramW6432%\\mosquitto\\mosquitto_pub.exe
# Mosquitto 32-bit on Windows 32-bit
# MQTT_Publisher=%ProgramFiles%\\mosquitto\\mosquitto_pub.exe
# IP address or DNS name of MQTT Broker
# Don't use test broker for production environments
MQTT_Host=test.mosquitto.org
# MQTT_Host=broker.hivemq.com
# Port (Optional)
#MQTT_Port=
# Topic Name
# When using public broker like test.mosquitto.org make sure to define a unique topic name
# by appending the serial number of the inverter to avoid you receive data of another SBFspot user.
MQTT_Topic=sbfspot_{serial}
#MQTT_Topic=sbfspot_{plantname}/sma_{serial}
# Format of message items to be sent
# JSON: MQTT_ItemFormat="{key}": {value}
# TEXT: MQTT_ItemFormat={key}:{value}
# XML: MQTT_ItemFormat=<item name="{key}" value="{value}" />
MQTT_ItemFormat="{key}": {value}
# MQTT_ItemDelimiter (none|blank|comma|semicolon default comma)
# JSON: MQTT_ItemDelimiter=comma
# TEXT: MQTT_ItemDelimiter=semicolon
# XML : MQTT_ItemDelimiter=none
MQTT_ItemDelimiter=comma
# Mandatory arguments for mosquitto_pub executable
# JSON: MQTT_PublisherArgs=-h {host} -t {topic} -m "{{message}}"
# TEXT: MQTT_PublisherArgs=-h {host} -t {topic} -m "{message}"
# XML : MQTT_PublisherArgs=-h {host} -t {topic} -m "<mqtt_message>{message}</mqtt_message>"
MQTT_PublisherArgs=-h {host} -t {topic} -r -m "{{message}}"
# Data to be published (comma delimited)
MQTT_Data=Timestamp,SunRise,SunSet,InvSerial,InvName,InvTime,InvStatus,InvTemperature,InvGridRelay,EToday,ETotal,PACTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2
# Possible keywords are (if supported by your inverter):
# SBFspot Alias Code Description
# ====================================================================================
# Timestamp Current date/time
# InvTime Inverter date/time
# SunRise Sunrise time
# SunSet Sunset time
# InvSerial Serial Number
# InvName NameplateLocation Device name
# InvClass NameplateMainModel Device class
# InvType NameplateModel Device type
# InvSwVer NameplatePkgRev Software package
# InvStatus OperationHealth Condition
# InvTemperature CoolsysTmpNom Operating condition temperatures
# InvGridRelay OperationGriSwStt Grid relay/contactor
# ETotal MeteringTotWhOut Total yield
# EToday MeteringDyWhOut Day yield
# PACTot GridMsTotW Power
# PDC1/PDC2 DcMsWatt DC power input string 1/2
# UDC1/UDC2 DcMsVol DC voltage input string 1/2
# IDC1/IDC2 DcMsAmp DC current input string 1/2
# PDCTot DcMsWatt DC power all strings
# OperTm MeteringTotOpTms Operating time
# FeedTm MeteringTotFeedTms Feed-in time
# PAC1 GridMsWphsA Power L1
# PAC2 GridMsWphsB Power L2
# PAC3 GridMsWphsC Power L3
# UAC1 GridMsPhVphsA Grid voltage phase L1
# UAC2 GridMsPhVphsB Grid voltage phase L2
# UAC3 GridMsPhVphsC Grid voltage phase L3
# IAC1 GridMsAphsA_1 Grid current phase L1
# IAC2 GridMsAphsB_1 Grid current phase L2
# IAC3 GridMsAphsC_1 Grid current phase L3
# GridFreq GridMsHz Grid frequency
# BTSignal BTSignal Bluetooth signal strength
# BatTmpVal BatTmpVal Battery temperature
# BatVol BatVol Battery voltage
# BatAmp BatAmp Battery current
# BatChaStt BatChaStt Current battery charge status

View file

@ -1,54 +0,0 @@
################################################################################
# SBFspotUpload.cfg - Configuration file for SBFspotUploadService/Daemon
# (c)2012-2021, SBF (https://github.com/SBFspot/SBFspot)
#
# 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 : /var/log/sbfspot.3
#LogDir=C:\Users\Public\SMAdata\Logs
LogDir=/var/log/sbfspot.3
#LogLevel=debug|info|warning|error (default info)
LogLevel=info
################################
### PVoutput Upload Settings ###
################################
#PVoutput_SID (PVoutput_System_ID)
#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=
#PVoutput_Key
#Sets PVoutput API Key
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=SBFspot
#SQL_Hostname=<Network Name> or <IP-address>
#SQL_Port=3306
#SQL_Username=SBFspotUser
#SQL_Password=SBFspotPassword

View file

@ -1,310 +0,0 @@
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_DATETMEFORMAT
# 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

View file

@ -1,312 +0,0 @@
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_DATETMEFORMAT
# 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

View file

@ -1,315 +0,0 @@
echo "Generating $CFG_PATH & $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_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)"
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_DATETMEFORMAT
# 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

View file

@ -1,26 +0,0 @@
#!/usr/bin/with-contenv bashio
cd /
#---- Create lognow variable
lognow=$(date +%Y%m%d)
# Sleep until log updated from last SBFspot run
sleep 45
#---- set tail to log out to HA log
#---- 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)")
## Print the message the user supplied, defaults to "Hello World..."
bashio::log.info "${message:="Hello World..."}"
#---- Delete old log files
#busybox command for minus 1 day
#date +%Y%m%d -d @$(($(date +%s)-86400))
# remove log files older than 3 days
find /data/sbfspot/log -mtime +3 -exec rm {} \;

View file

@ -1,5 +0,0 @@
# ---
configuration:
message:
name: Message
description: Monitoring SMA Bluetooth inverters with SBFspot.