Skip to content

Commit

Permalink
MQTT Publish Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
snaptec committed Nov 12, 2019
1 parent c702a1b commit 70fffb2
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ladelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ else
fi

else
sed -i '1i'$start,$jetzt,$gelrlp1,$bishergeladen,$ladegeschw,$ladedauer' Min,1 ',$lademodus,$rfidlp1 web/ladelog
sed -i '1i'$start,$jetzt,$gelrlp1,$bishergeladen,$ladegeschw,$ladedauer' Min,1',$lademodus,$rfidlp1 web/ladelog
if ((pushbenachrichtigung == "1")) ; then
if ((pushbstopl == "1")) ; then
./runs/pushover.sh "$lp1name Ladung gestoppt. $bishergeladen kWh in $ladedauer Min mit durchschnittlich $ladegeschw kW geladen$soctext"
Expand Down
19 changes: 19 additions & 0 deletions loadvars.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
#!/bin/bash
loadvars(){
while read lines; do
var=$(echo $lines | awk '{print $1}')
value=$(echo $lines | awk '{print $2}')
if [[ $var == "openWB/set/lp1/DirectChargeAmps" ]]; then
if [[ $sofortll != $value ]]; then
sed -i 's/sofortll=.*/sofortll='$value'/' /var/www/html/openWB/openwb.conf
echo "SofortLLLp1 geändert" >> /var/www/html/openWB/ramdisk/openWB.log

fi
fi
var=$(echo $lines | awk '{print $1}')
value=$(echo $lines | awk '{print $2}')
if [[ $var == "openWB/set/lp2/DirectChargeAmps" ]]; then
if [[ $sofortll != $value ]]; then
sed -i 's/sofortlls1=.*/sofortlls1='$value'/' /var/www/html/openWB/openwb.conf
echo "SofortLLLp2 geändert" >> /var/www/html/openWB/ramdisk/openWB.log
fi
fi
done < <(timeout 1s mosquitto_sub -v -t "openWB/set/#")

#get oldvars for mqtt
opvwatt=$(<ramdisk/pvwatt)
Expand Down
10 changes: 10 additions & 0 deletions modules/bezug_ethmpm3pm/readmpm3pm.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,14 @@
f = open('/var/www/html/openWB/ramdisk/einspeisungkwh', 'w')
f.write(str(ekwh))
f.close()
#evuhz
resp = client.read_input_registers(0x2c,4, unit=sdmid)
value1 = resp.registers[0]
value2 = resp.registers[1]
all = format(value1, '04x') + format(value2, '04x')
hz = int(struct.unpack('>i', all.decode('hex'))[0])
hz = round((float(hz) / 100), 2)
f = open('/var/www/html/openWB/ramdisk/evuhz', 'w')
f.write(str(hz))
f.close()

1 change: 1 addition & 0 deletions runs/atreboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2293,4 +2293,5 @@ curl -s https://raw.githubusercontent.com/snaptec/openWB/beta/web/version > /var
curl -s https://raw.githubusercontent.com/snaptec/openWB/stable/web/version > /var/www/html/openWB/ramdisk/vstable
mosquitto_pub -t openWB/strLastmanagementActive -r -m " "
echo " " > /var/www/html/openWB/ramdisk/lastregelungaktiv
chmod 777 /var/www/html/openWB/ramdisk/lastregelungaktiv

1 change: 1 addition & 0 deletions web/live.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ var publish = function (payload, topic) {
var message = new Messaging.Message(payload);
message.destinationName = topic;
message.qos = 2;
message.retained = true;
client.send(message);
}

Expand Down
2 changes: 1 addition & 1 deletion web/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.651Nightly
1.652Nightly

0 comments on commit 70fffb2

Please sign in to comment.