17.11.2024, 16:58
Hi Daniel,
many thanks for your reply. I watching the memory usage and over the time it rises day by day slightly starting from 40% to 63% today within 7 days.
That's why I used the system load app to analyze the running processes regarding their memory use. And on top of it is the following resident script which is running every 60s and should use: 26880.00MB at least this is shown in the app. I have no idea why this is so memory consuming. Can you please give me your thoughts about it and ideas to improve?
Many thanks for your help!
Best Regards
Steffen
many thanks for your reply. I watching the memory usage and over the time it rises day by day slightly starting from 40% to 63% today within 7 days.
That's why I used the system load app to analyze the running processes regarding their memory use. And on top of it is the following resident script which is running every 60s and should use: 26880.00MB at least this is shown in the app. I have no idea why this is so memory consuming. Can you please give me your thoughts about it and ideas to improve?
Many thanks for your help!
Best Regards
Steffen
Code:
-- API Doku: https://github.com/evcc-io/evcc/blob/master/api/api.go
--https://jsonformatter.org/json-parser
require('user.round')
http = require('socket.http')
ltn12 = require('ltn12')
require('json')
--- Abfrage Health Check EVCC OK = alles in Ordnung
res, code = http.request({
url = 'http://192.168.178.96:7070/api/health',
method = 'GET',
})
if code == 200
then
evcc_health_status = 1 -- i.O.
-- Abfrage Stati
res, code = http.request({
url = 'http://192.168.178.96:7070/api/state',
method = 'GET',
})
--log(res)
data = json.pdecode(res)
--Carport
mode2 = data.result.loadpoints[1].mode --Lademodus "off"/"now"/"minpv"/"pv"
charging_state2 = data.result.loadpoints[1].charging -- Ladevorgang aktiv
plug_connected2 = data.result.loadpoints[1].connected -- Ladekabel verbunden
charging_plan_activ2 = data.result.loadpoints[1].planActive -- Ladetimer gesetzt
charging_power2 = data.result.loadpoints[1].chargePower -- aktuelle Ladeleistung
charged_energy2 = data.result.loadpoints[1].chargedEnergy -- geladende Energiemenge
car_soc2 = data.result.loadpoints[1].vehicleSoc -- Fahrzeug SOC
if car_soc2 == nil then car_soc2 = 0 end
vehicleRange2 = data.result.loadpoints[1].vehicleRange -- Fahrzeug Reichweite
chargePower2 = data.result.loadpoints[1].chargePower -- Ladeleistung
chargedEnergy2 = data.result.loadpoints[1].chargedEnergy -- Energie letzte Ladung
zaehler = grp.getvalue('12/2/4')
grp.checkupdate('12/2/2', chargePower2)
grp.checkupdate('12/2/3', chargedEnergy2)
zaehler = zaehler + chargePower2/60
grp.checkupdate('12/2/4', zaehler)
--minPV einschalten um frühzeitig anfangen zu laden
pvleistung = grp.getvalue ('43/3/1')
pvprognose = grp.getvalue ('43/4/26')
-- log(pvleistung, pvprognose, mode2, plug_connected2)
if mode2 ~= "now" and
plug_connected2 == true and
pvleistung > 5000 and
pvprognose > 20 then
grp.checkwrite('12/0/4', true)
res, code = http.request({
url = 'http://192.168.178.96:7070/api/loadpoints/1/mode/minpv',
method = 'POST',
})
elseif
mode2 ~= "now" and
pvprognose < 12 then
res, code = http.request({
url = 'http://192.168.178.96:7070/api/loadpoints/1/mode/pv',
method = 'POST',
})
end
-- Wallboxen Testeinschalten um Kabel gesteckt zu erkennen und ggf. Mindestreichweite herzustellen
now = os.date('*t')
hour = now.hour
-- Carport
if
(hour == 6 and minute == 1) or
charging_plan_activ2 == true
then
--grp.checkwrite('12/0/4', true)
-- res, code = http.request({
-- url = 'http://192.168.178.96:7070/api/loadpoints/1/mode/pv',
-- method = 'POST',
-- })
end
-- Wallboxen einschalten um 14:00 Uhr wegen Nachhausekommen
now = os.date('*t')
hour = now.hour
-- Carport
if
(hour == 14 and minute == 1)
then
-- grp.checkwrite('12/0/4', true)
-- res, code = http.request({
-- url = 'http://192.168.178.96:7070/api/loadpoints/1/mode/pv',
-- method = 'POST',
-- })
end
-- Wallboxen einschalten wenn wir nach Hause kommen
p_handy_steffen = grp.getvalue ('44/1/8')
p_handy_andrea = grp.getvalue ('44/1/9')
-- Carport
if
p_handy_steffen == true or
p_handy_andrea == true
then
-- grp.checkwrite('12/0/4', true)
-- res, code = http.request({
-- url = 'http://192.168.178.96:7070/api/loadpoints/1/mode/pv',
-- method = 'POST',
-- })
end
-- Herstellen Mindestreichweite von 80 km
notladen_wb2 = grp.getvalue ('12/3/1')
-- Carport
if
plug_connected2 == true and
car_soc2 > 1 and
vehicleRange2 < 90
then
-- res, code = http.request({
-- url = 'http://192.168.178.96:7070/api/loadpoints/1/mode/now',
-- method = 'POST',
-- })
grp.checkwrite('12/3/1', true) -- Notladen aktivieren
elseif
plug_connected2 == true and
car_soc2 > 1 and
vehicleRange2 > 80 and
notladen_wb2 == true
then
-- res, code = http.request({
-- url = 'http://192.168.178.96:7070/api/loadpoints/1/mode/pv',
-- method = 'POST',
-- })
grp.checkwrite('12/3/1', false) -- Notladem deaktivieren
end
-- Wallboxen ausschalten
now = os.date('*t')
hour = now.hour
minute = now.min
solar_forecast_today = grp.getvalue ('43/4/26')
st_wb_carport = grp.getvalue('12/0/5')
-- Carport
if
(charging_plan_activ2 == false and -- Ausschalten wenn nicht gesteckt und keine Ladetimer gesetzt
plug_connected2 == false and
(hour >= 19 or hour == 7 ))
or
(charging_state2 == true and
car_soc2 == 100) -- Ausschalten wenn Auto voll geladen ist
or
(charging_state2 == false and
solar_forecast_today < 4) and
st_wb_carport == true
then
-- res, code = http.request({
-- url = 'http://192.168.178.96:7070/api/loadpoints/1/mode/off',
-- method = 'POST',
-- })
-- os.sleep(55)
-- grp.checkwrite('12/0/4', false)
end
else
evcc_health_status = 0 -- n.i.O.
--grp.checkwrite('12/0/4', false) --Wallbox ausschalten
-- grp.checkwrite('12/0/0', false) --Wallbox ausschalten
grp.checkwrite('12/2/1', 'evcc Fehler')
grp.checkwrite('12/2/0', 'evcc Fehler')
end
-- Status für die Schalter Küche aufbereiten und senden
--Carport:
if plug_connected2 == true then plug_connected2 = "y" else plug_connected2 = "n" end
st_schalter_wallbox = mode2.."/"..plug_connected2.."/"..round(car_soc2,0).."/"..round(charging_power2/1000,1)
grp.checkwrite('12/2/1', st_schalter_wallbox)
--log(res, code, evcc_health_status, mode2, charging_state2, plug_connected2,charging_plan_activ2, charging_power2, charged_energy2, car_soc2, vehicleRange2)