Update generateConfig.sh
This commit is contained in:
parent
551516b6b8
commit
cc6612625d
1 changed files with 60 additions and 58 deletions
|
@ -2,10 +2,12 @@ CFG_PATH=$1
|
||||||
CFG_PATH_UPLOAD=$2
|
CFG_PATH_UPLOAD=$2
|
||||||
CONFIG_PATH=/data/options.json
|
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_BTADDRESS="$(jq --raw-output '.BTAddress' $CONFIG_PATH)"
|
||||||
CONFIG_LOCALBTADDRESS="$(jq --raw-output '.LocalBTAddress' $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_PASSWORD="$(jq --raw-output '.Password' $CONFIG_PATH)"
|
||||||
CONFIG_MSI_ENABLED="$(jq --raw-output '.MIS_Enabled' $CONFIG_PATH)"
|
CONFIG_MSI_ENABLED="$(jq --raw-output '.MIS_Enabled' $CONFIG_PATH)"
|
||||||
CONFIG_PLANTNAME="$(jq --raw-output '.Plantname' $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_SID="$(jq --raw-output '.PVoutput_SID' $CONFIG_PATH)"
|
||||||
CONFIG_PVOUTPUT_KEY="$(jq --raw-output '.PVoutput_Key' $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
|
# Windows: smaspot -scan
|
||||||
# Linux : hcitool scan
|
# Linux : hcitool scan
|
||||||
# IMPORTANT FOR SPEEDWIRE USERS: COMMENT OUT BTADDRESS (PUT # IN FRONT)
|
# 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
|
# If multiple local BT adapters are available, select the one to use
|
||||||
LocalBTAddress=$CONFIG_LOCALBTADDRESS
|
LocalBTAddress=$CONFIG_LOCALBTADDRESS
|
||||||
|
|
||||||
# SMA Inverter's Speedwire IP address
|
# 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 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
|
# 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)
|
# Multiple IP addresses can be provided (comma separated)
|
||||||
#IP_Address=0.0.0.0
|
IP_Address=$CONFIG_IP_ADDRESS
|
||||||
|
|
||||||
# User password (default 0000)
|
# User password (default 0000)
|
||||||
Password=$CONFIG_PASSWORD
|
Password=$CONFIG_PASSWORD
|
||||||
|
|
||||||
# MIS_Enabled (Multi Inverter Support: Default=0 Disabled)
|
# MIS_Enabled (Multi Inverter Support: Default=0 Disabled)
|
||||||
# +------------+-------+-------------+
|
# +------------+-------+-------------+
|
||||||
|
@ -102,76 +104,76 @@ Password=$CONFIG_PASSWORD
|
||||||
# +------------+-------+-------------+
|
# +------------+-------+-------------+
|
||||||
# | >1 | >1 | 1 |
|
# | >1 | >1 | 1 |
|
||||||
# +------------+-------+-------------+
|
# +------------+-------+-------------+
|
||||||
MIS_Enabled=$CONFIG_MSI_ENABLED
|
MIS_Enabled=$CONFIG_MSI_ENABLED
|
||||||
|
|
||||||
# Plantname
|
# Plantname
|
||||||
Plantname=$CONFIG_PLANTNAME
|
Plantname=$CONFIG_PLANTNAME
|
||||||
|
|
||||||
# OutputPath (Place to store CSV files)
|
# OutputPath (Place to store CSV files)
|
||||||
#
|
#
|
||||||
# Windows: C:\Users\Public\SMAdata\%Y
|
# Windows: C:\Users\Public\SMAdata\%Y
|
||||||
# Linux : /home/pi/smadata/%Y
|
# Linux : /home/pi/smadata/%Y
|
||||||
# %Y %m and %d will be expanded to Year Month and Day
|
# %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)
|
# OutputPathEvents (Place to store CSV files for events)
|
||||||
# If omitted, OutputPath is used
|
# If omitted, OutputPath is used
|
||||||
OutputPathEvents=$CONFIG_OUTPUTPATHEVENTS
|
OutputPathEvents=$CONFIG_OUTPUTPATHEVENTS
|
||||||
|
|
||||||
# Position of pv-plant http://itouchmap.com/latlong.html
|
# Position of pv-plant http://itouchmap.com/latlong.html
|
||||||
# Example for Ukkel, Belgium
|
# Example for Ukkel, Belgium
|
||||||
Latitude=$CONFIG_LATITUDE
|
Latitude=$CONFIG_LATITUDE
|
||||||
Longitude=$CONFIG_LONGITUDE
|
Longitude=$CONFIG_LONGITUDE
|
||||||
|
|
||||||
# Calculate Missing SpotValues
|
# Calculate Missing SpotValues
|
||||||
# If set to 1, values not provided by inverter will be calculated
|
# If set to 1, values not provided by inverter will be calculated
|
||||||
# eg: Pdc1 = Idc1 * Udc1
|
# eg: Pdc1 = Idc1 * Udc1
|
||||||
CalculateMissingSpotValues=$CONFIG_CALCULATEMISSINGSPOTVALUES
|
CalculateMissingSpotValues=$CONFIG_CALCULATEMISSINGSPOTVALUES
|
||||||
|
|
||||||
# DateTimeFormat (default %d/%m/%Y %H:%M:%S)
|
# DateTimeFormat (default %d/%m/%Y %H:%M:%S)
|
||||||
# For details see strftime() function
|
# For details see strftime() function
|
||||||
# http://www.cplusplus.com/reference/clibrary/ctime/strftime/
|
# http://www.cplusplus.com/reference/clibrary/ctime/strftime/
|
||||||
DateTimeFormat=$CONFIG_DATETIMEFORMAT
|
DateTimeFormat=$CONFIG_DATETIMEFORMAT
|
||||||
|
|
||||||
# DateFormat (default %d/%m/%Y)
|
# DateFormat (default %d/%m/%Y)
|
||||||
DateFormat=$CONFIG_DATEFORMAT
|
DateFormat=$CONFIG_DATEFORMAT
|
||||||
|
|
||||||
# DecimalPoint (comma/point default comma)
|
# DecimalPoint (comma/point default comma)
|
||||||
DecimalPoint=$CONFIG_DECIMALPOINT
|
DecimalPoint=$CONFIG_DECIMALPOINT
|
||||||
|
|
||||||
# TimeFormat (default %H:%M:%S)
|
# 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)
|
# 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
|
# If set to non-zero value, the plant time is synchronised with local host time
|
||||||
# Some inverters don't have a real-time clock
|
# Some inverters don't have a real-time clock
|
||||||
SynchTime=$CONFIG_SYNCHTIME
|
SynchTime=$CONFIG_SYNCHTIME
|
||||||
|
|
||||||
# SynchTimeLow (1-120 - default 1)
|
# SynchTimeLow (1-120 - default 1)
|
||||||
# SynchTimeHigh (1200-3600 - default 3600)
|
# SynchTimeHigh (1200-3600 - default 3600)
|
||||||
# Plant time is adjusted to local host time when SynchTime=1 and
|
# Plant time is adjusted to local host time when SynchTime=1 and
|
||||||
# time difference is between SynchTimeLow and SynchTimeHigh limits
|
# time difference is between SynchTimeLow and SynchTimeHigh limits
|
||||||
SynchTimeLow=$CONFIG_SYNCHTIMELOW
|
SynchTimeLow=$CONFIG_SYNCHTIMELOW
|
||||||
SynchTimeHigh=$CONFIG_SYNCHTIMEHIGH
|
SynchTimeHigh=$CONFIG_SYNCHTIMEHIGH
|
||||||
|
|
||||||
# SunRSOffset
|
# SunRSOffset
|
||||||
# Offset to start before sunrise and end after sunset (0-3600 - default 900 seconds)
|
# Offset to start before sunrise and end after sunset (0-3600 - default 900 seconds)
|
||||||
SunRSOffset=$CONFIG_SUNRSOFFSET
|
SunRSOffset=$CONFIG_SUNRSOFFSET
|
||||||
|
|
||||||
# Locale
|
# Locale
|
||||||
# Translate Entries in CSV files
|
# Translate Entries in CSV files
|
||||||
# Supported locales: de-DE;en-US;fr-FR;nl-NL;es-ES;it-IT
|
# Supported locales: de-DE;en-US;fr-FR;nl-NL;es-ES;it-IT
|
||||||
# Default en-US
|
# Default en-US
|
||||||
Locale=$CONFIG_LOCALE
|
Locale=$CONFIG_LOCALE
|
||||||
|
|
||||||
# Timezone
|
# Timezone
|
||||||
# Select the right timezone in date_time_zonespec.csv
|
# Select the right timezone in date_time_zonespec.csv
|
||||||
# e.g. Timezone=Europe/Brussels
|
# e.g. Timezone=Europe/Brussels
|
||||||
Timezone=$CONFIG_TIMEZONE
|
Timezone=$CONFIG_TIMEZONE
|
||||||
|
|
||||||
# BTConnectRetries
|
# BTConnectRetries
|
||||||
# Number of Bluetooth Connection attempts (1-15; Default=10)
|
# Number of Bluetooth Connection attempts (1-15; Default=10)
|
||||||
BTConnectRetries=$CONFIG_BTCONNECTRETRIES
|
BTConnectRetries=$CONFIG_BTCONNECTRETRIES
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
### CSV Export Settings ###
|
### CSV Export Settings ###
|
||||||
|
@ -180,7 +182,7 @@ BTConnectRetries=$CONFIG_BTCONNECTRETRIES
|
||||||
|
|
||||||
# CSV_Export (default 1 = Enabled)
|
# CSV_Export (default 1 = Enabled)
|
||||||
# Enables or disables the CSV Export functionality
|
# Enables or disables the CSV Export functionality
|
||||||
CSV_Export=$CONFIG_CSV_EXPORT
|
CSV_Export=$CONFIG_CSV_EXPORT
|
||||||
|
|
||||||
# CSV_ExtendedHeader (default 1 = On)
|
# CSV_ExtendedHeader (default 1 = On)
|
||||||
# Enables or disables the SMA extended header info (8 lines)
|
# 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
|
# Version CSV1|Tool SBFspot|Linebreaks CR/LF|Delimiter semicolon|Decimalpoint comma|Precision 3
|
||||||
# etc...
|
# etc...
|
||||||
# This is usefull for manual data upload to pvoutput.org
|
# 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)
|
# CSV_Header (default 1 = On)
|
||||||
# Enables or disables the CSV data header info (1 line)
|
# Enables or disables the CSV data header info (1 line)
|
||||||
# dd/MM/yyyy HH:mm:ss;kWh;kW
|
# dd/MM/yyyy HH:mm:ss;kWh;kW
|
||||||
# This is usefull for manual data upload to pvoutput.org
|
# This is usefull for manual data upload to pvoutput.org
|
||||||
# If CSV_ExtendedHeader is enabled, CSV_Header is also enabled
|
# 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)
|
# CSV_SaveZeroPower (default 1 = On)
|
||||||
# When enabled, daily csv files contain all data from 00:00 to 23:55
|
# When enabled, daily csv files contain all data from 00:00 to 23:55
|
||||||
# This is usefull for manual data upload to pvoutput.org
|
# 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 (comma/semicolon default semicolon)
|
||||||
CSV_Delimiter=$CONFIG_CSV_DELIMITER
|
CSV_Delimiter=$CONFIG_CSV_DELIMITER
|
||||||
|
|
||||||
# CSV_Spot_TimeSource (Inverter|Computer default Inverter)
|
# 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)
|
# CSV_Spot_WebboxHeader (Default 0 = Off)
|
||||||
# When enabled, use Webbox style header (DcMs.Watt[A];DcMs.Watt[B]...)
|
# 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 ###
|
### SQL DB Settings ###
|
||||||
|
@ -223,30 +225,30 @@ CSV_Spot_WebboxHeader=$CONFIG_CSV_SPOT_WEBBOXHEADER
|
||||||
#SQL_Database=/home/pi/smadata/SBFspot.db
|
#SQL_Database=/home/pi/smadata/SBFspot.db
|
||||||
|
|
||||||
# MySQL
|
# MySQL
|
||||||
SQL_Database=$CONFIG_SQL_DATABASE
|
SQL_Database=$CONFIG_SQL_DATABASE
|
||||||
SQL_Hostname=$CONFIG_SQL_HOSTNAME
|
SQL_Hostname=$CONFIG_SQL_HOSTNAME
|
||||||
SQL_Port=$CONFIG_SQL_PORT
|
SQL_Port=$CONFIG_SQL_PORT
|
||||||
SQL_Username=$CONFIG_SQL_USERNAME
|
SQL_Username=$CONFIG_SQL_USERNAME
|
||||||
SQL_Password=$CONFIG_SQL_PASSWORD
|
SQL_Password=$CONFIG_SQL_PASSWORD
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
### MQTT Settings ###
|
### MQTT Settings ###
|
||||||
#########################
|
#########################
|
||||||
|
|
||||||
|
|
||||||
MQTT_Publisher=$CONFIG_MQTT_PUBLISHER
|
MQTT_Publisher=$CONFIG_MQTT_PUBLISHER
|
||||||
MQTT_Host=$CONFIG_MQTT_HOST
|
MQTT_Host=$CONFIG_MQTT_HOST
|
||||||
MQTT_Port=$CONFIG_MQTT_PORT
|
MQTT_Port=$CONFIG_MQTT_PORT
|
||||||
MQTT_Topic=$CONFIG_MQTT_TOPIC
|
MQTT_Topic=$CONFIG_MQTT_TOPIC
|
||||||
MQTT_ItemFormat=$CONFIG_MQTT_ITEMFORMAT
|
MQTT_ItemFormat=$CONFIG_MQTT_ITEMFORMAT
|
||||||
MQTT_ItemDelimiter=$CONFIG_MQTT_ITEMDELIMITER
|
MQTT_ItemDelimiter=$CONFIG_MQTT_ITEMDELIMITER
|
||||||
MQTT_PublisherArgs=$CONFIG_MQTT_PUBLISHERARGS
|
MQTT_PublisherArgs=$CONFIG_MQTT_PUBLISHERARGS
|
||||||
MQTT_Data=$CONFIG_MQTT_DATA
|
MQTT_Data=$CONFIG_MQTT_DATA
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
#cat $1
|
#cat $1
|
||||||
|
|
||||||
cat > $CFG_PATH_UPLOAD <<EOL
|
cat > "$CFG_PATH_UPLOAD" <<EOL
|
||||||
################################################################################
|
################################################################################
|
||||||
# SBFspotUpload.cfg - Configuration file for SBFspotUploadService/Daemon
|
# SBFspotUpload.cfg - Configuration file for SBFspotUploadService/Daemon
|
||||||
# (c)2012-2014, SBF (https://sbfspot.codeplex.com)
|
# (c)2012-2014, SBF (https://sbfspot.codeplex.com)
|
||||||
|
@ -267,11 +269,11 @@ cat > $CFG_PATH_UPLOAD <<EOL
|
||||||
################################
|
################################
|
||||||
# Windows: C:\Users\Public\SMAdata\Logs
|
# Windows: C:\Users\Public\SMAdata\Logs
|
||||||
# Linux : /home/pi/smadata/logs
|
# Linux : /home/pi/smadata/logs
|
||||||
#LogDir=C:\Users\Public\SMAdata\Logs
|
# LogDir=C:\Users\Public\SMAdata\Logs
|
||||||
LogDir=$CONFIG_LOGDIR
|
LogDir=$CONFIG_LOGDIR
|
||||||
|
|
||||||
#LogLevel=debug|info|warning|error (default info)
|
# LogLevel=debug|info|warning|error (default info)
|
||||||
LogLevel=$CONFIG_LOGLEVEL
|
LogLevel=$CONFIG_LOGLEVEL
|
||||||
|
|
||||||
################################
|
################################
|
||||||
### PVoutput Upload Settings ###
|
### PVoutput Upload Settings ###
|
||||||
|
@ -280,11 +282,11 @@ LogLevel=$CONFIG_LOGLEVEL
|
||||||
#Map inverters to PVoutput System ID's
|
#Map inverters to PVoutput System ID's
|
||||||
#PVoutput_SID=SerialNmbrInverter_1:PVoutput_System_ID_1,SerialNmbrInverter_2:PVoutput_System_ID_2
|
#PVoutput_SID=SerialNmbrInverter_1:PVoutput_System_ID_1,SerialNmbrInverter_2:PVoutput_System_ID_2
|
||||||
#e.g. PVoutput_SID=200212345:4321
|
#e.g. PVoutput_SID=200212345:4321
|
||||||
PVoutput_SID=$CONFIG_PVOUTPUT_SID
|
PVoutput_SID=$CONFIG_PVOUTPUT_SID
|
||||||
|
|
||||||
#PVoutput_Key
|
#PVoutput_Key
|
||||||
#Sets PVoutput API Key
|
#Sets PVoutput API Key
|
||||||
PVoutput_Key=$CONFIG_PVOUTPUT_KEY
|
PVoutput_Key=$CONFIG_PVOUTPUT_KEY
|
||||||
|
|
||||||
################################
|
################################
|
||||||
### SQL DB Settings ###
|
### SQL DB Settings ###
|
||||||
|
@ -296,14 +298,14 @@ PVoutput_Key=$CONFIG_PVOUTPUT_KEY
|
||||||
#SQL_Database=/home/pi/smadata/SBFspot.db
|
#SQL_Database=/home/pi/smadata/SBFspot.db
|
||||||
|
|
||||||
# Reserved for MySQL
|
# Reserved for MySQL
|
||||||
SQL_Database=$CONFIG_SQL_DATABASE
|
SQL_Database=$CONFIG_SQL_DATABASE
|
||||||
SQL_Hostname=$CONFIG_SQL_HOSTNAME
|
SQL_Hostname=$CONFIG_SQL_HOSTNAME
|
||||||
SQL_Username=$CONFIG_SQL_USERNAME
|
SQL_Username=$CONFIG_SQL_USERNAME
|
||||||
SQL_Password=$CONFIG_SQL_PASSWORD
|
SQL_Password=$CONFIG_SQL_PASSWORD
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
#cat $CFG_PATH_UPLOAD
|
#cat $CFG_PATH_UPLOAD
|
||||||
|
|
||||||
# create folders
|
# create folders
|
||||||
mkdir -p $CONFIG_OUTPUTPATH
|
mkdir -p "$CONFIG_OUTPUTPATH"
|
||||||
mkdir -p $CONFIG_LOGDIR
|
mkdir -p "$CONFIG_LOGDIR"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue