Skip to content

Commit

Permalink
Flexevu config (snaptec#1596)
Browse files Browse the repository at this point in the history
* Konfiguration for Flexible EVU Kits

moduleconfig and updateConfig.sh with the new varaibles.

* New main.sh for evukitflex

calls the changed flex modules

* bugfix moduleconfigevu

* bugfix config

add evuflexversion

* bugfix

* bugfix
  • Loading branch information
DetMoerk committed Oct 1, 2021
1 parent ef4bdf6 commit db913ff
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 3 deletions.
38 changes: 38 additions & 0 deletions modules/bezug_ethmpm3pmflex/main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd)
RAMDISKDIR="${OPENWBBASEDIR}/ramdisk"
MODULEDIR=$(cd `dirname $0` && pwd)
#DMOD="EVU"
DMOD="MAIN"
Debug=$debug

#For development only
#Debug=1

if [ ${DMOD} == "MAIN" ]; then
MYLOGFILE="${RAMDISKDIR}/openWB.log"
else
MYLOGFILE="${RAMDISKDIR}/evu_json.log"
fi

openwbDebugLog ${DMOD} 2 "EVU KIT Version: ${evukitversion}"
openwbDebugLog ${DMOD} 2 "EVU IP: ${evuflexip}"
openwbDebugLog ${DMOD} 2 "EVU Port : ${evuflexport}"
openwbDebugLog ${DMOD} 2 "EVU ID : ${evuflexid}"

sudo python3 ${OPENWBBASEDIR}/modules/bezug_ethmpm3pm/test.py ${evuflexip} ${evuflexport} ${evuflexid} >>${MYLOGFILE} 2>&1
ret=$?
#if (( evukitversion == 1 )); then
#sudo python3 ${OPENWBBASEDIR}/modules/bezug_ethmpm3pm/readlovato.py ${evuflexip} ${evuflexport} ${evuflexid} >>${MYLOGFILE) 2>&1
#ret=$?
#elif (( evukitversion == 2 )); then
#sudo python3 ${OPENWBBASEDIR}/modules/bezug_ethmpm3pm/readsdm.py ${evuflexip} ${evuflexport} ${evuflexid} >>${MYLOGFILE) 2>&1
#ret=$?
#else
#sudo python3 ${OPENWBBASEDIR}/modules/bezug_ethmpm3pm/readmpm3pm.py ${evuflexip} ${evuflexport} ${evuflexid} >>${MYLOGFILE) 2>&1
#ret=$?
#fi
openwbDebugLog ${DMOD} 2 "EVU RET: ${ret}"

wattbezug=$(<${RAMDISKDIR}/wattbezug)
echo $wattbezug
9 changes: 6 additions & 3 deletions runs/updateConfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,6 @@ updateConfig(){
if ! grep -Fq "name_wechselrichter2=" $ConfigFile; then
echo "name_wechselrichter2=WR2" >> $ConfigFile
fi
if ! grep -Fq "name_wechselrichter3=" $ConfigFile; then
echo "name_wechselrichter3=WR3" >> $ConfigFile
fi
if ! grep -Fq "hook1ein_url=" $ConfigFile; then
echo "hook1ein_url='https://webhook.com/ein.php'" >> $ConfigFile
fi
Expand Down Expand Up @@ -2129,5 +2126,11 @@ updateConfig(){
if ! grep -Fq "virtual_ip_wlan0=" $ConfigFile; then
echo "virtual_ip_wlan0='192.168.193.6'" >> $ConfigFile
fi
if ! grep -Fq "evuflexip=" $ConfigFile; then
echo "evuflexversion=2" >>$ConfigFile
echo "evuflexip='192.168.193.5'" >> $ConfigFile
echo "evuflexport=8899" >> $ConfigFile
echo "evuflexid=1" >> $ConfigFile
fi
echo "Config file Update done."
}
43 changes: 43 additions & 0 deletions web/settings/modulconfigevu.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<option <?php if($wattbezugmodulold == "bezug_mpm3pm") echo "selected" ?> value="bezug_mpm3pm">MPM3PM</option>
<option <?php if($wattbezugmodulold == "bezug_mqtt") echo "selected" ?> value="bezug_mqtt">MQTT</option>
<option <?php if($wattbezugmodulold == "sdm630modbusbezug") echo "selected" ?> value="sdm630modbusbezug">SDM 630</option>
<option <?php if($wattbezugmodulold == "bezug_ethmpm3pmflex") echo "selected" ?> value="bezug_ethmpm3pmflex">openWB EVU Kit flexible IP</option>
<option <?php if($wattbezugmodulold == "vzlogger") echo "selected" ?> value="vzlogger">VZLogger</option>
</optgroup>
</select>
Expand Down Expand Up @@ -237,6 +238,44 @@
</div>
</div>
</div>
<div id="wattbezugethmpm3pmflex" class="hide">
<div class="form-row mb-1">
<label for="evuflexversion" class="col-md-4 col-form-label">Version des openWB evu Kits</label>
<div class="col">
<select name="evuflexversion" id="evuflexversion" class="form-control">
<option <?php if($evuflexversionold == 0) echo "selected" ?> value="0">EVU Kit MPM3PM</option>
<option <?php if($evuflexversionold == 1) echo "selected" ?> value="1">EVU Kit var 2 Lovato</option>
<option <?php if($evuflexversionold == 2) echo "selected" ?> value="2">EVU Kit SDM</option>
</select>
</div>
</div>
<div class="form-row mb-1">
<label for="evuflexip" class="col-md-4 col-form-label">EVU Adapter IP</label>
<div class="col">
<input class="form-control" type="text" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" name="evuflexip" id="evuflexip" value="<?php echo $evuflexipold ?>">
<span class="form-text small">
Gültige Werte IP Adresse im Format: 192.168.0.12<br>
IP Adresse des Protoss/Elfin Adapters.
</span>
</div>
</div>
<div class="form-row mb-1">
<label for="evuflexport" class="col-md-4 col-form-label">Port</label>
<div class="col">
<input class="form-control" type="number" min="1" step="1" name="evuflexport" id="evuflexport" value="<?php echo (empty($evuflexportold)?'502':$evuflexportold) ?>">
<span class="form-text small">
TCP Port der im Protoss/Elfin konfiguriert ist.<br>
</span>
</div>
</div>
<div class="form-row mb-1">
<label for="evuflexid" class="col-md-4 col-form-label">Unit ID</label>
<div class="col">
<input class="form-control" type="number" min="1" max="254" step="1" name="evuflexid" id="evuflexid" value="<?php echo $evuflexidold ?>">
<span class="form-text small">Gültige Werte 1-254. Modbus ID des Gerätes.</span>
</div>
</div>
</div>
<div id="wattbezugsolarview" class="hide">
<div class="card-text alert alert-info">
Konfiguration im zugehörigen PV Modul erforderlich.
Expand Down Expand Up @@ -863,6 +902,7 @@ function display_wattbezugmodul() {
hideSection('#wattbezugsbs25');
hideSection('#wattbezuge3dc');
hideSection('#wattbezugethmpm3pm');
hideSection('#wattbezugethmpm3pmflex');
hideSection('#wattbezugplentihaus');
hideSection('#wattbezugkostalpiko');
hideSection('#wattbezugkostalsmartenergymeter');
Expand Down Expand Up @@ -992,6 +1032,9 @@ function display_wattbezugmodul() {
if($('#wattbezugmodul').val() == 'bezug_ethmpm3pm') {
showSection('#wattbezugethmpm3pm');
}
if($('#wattbezugmodul').val() == 'bezug_ethmpm3pmflex') {
showSection('#wattbezugethmpm3pmflex');
}
if($('#wattbezugmodul').val() == 'bezug_sbs25') {
showSection('#wattbezugsbs25');
}
Expand Down

0 comments on commit db913ff

Please sign in to comment.