<%# Status.htm (Charging_points module) -%> <% local chp = require "luci.model.charging_points" local fs = require "nixio.fs" local utl = require "luci.util" local dsp = require "luci.dispatcher" local mUtl = require "luci.moreUtils" local os = require "os" local path = luci.dispatcher.context.requestpath local user, serialnumber, hw_model = chp.whoami(path) local parameters = {} local sections = {} local gmod, amod local modules = {} -- Load modules if user ~= "user" then gmod = require "luci.model.ocpp_variables" amod = require "luci.model.advanced_ocpp_variables" modules = {gmod, amod} else gmod = require "luci.model.user_global_variables" modules = {gmod} end ------------------------------------------------------------------------------------------------------------------------- local path = dsp.context.requestpath serialnumber = mUtl.get_serialnumber() local method if serialnumber then local maestre = mUtl.identify_pseudo_maestre(path[3] or serialnumber ) if maestre == true then method = path[3] or serialnumber else method = path[3] end end cl = path[1] local model = mUtl.model(serialnumber) local all_options = utl.ubus(serialnumber, "get_configuration") if all_options and all_options.ocpp then all_options = all_options["ocpp"] if all_options then for k , v in pairs (all_options) do if type(v) ~= "table" then end end end else all_options = {} end local version if utl.ubus("wizard", "active_service", {service = "ocppdv16"}).enabled == "true" or utl.ubus("wizard", "active_service", {service = "ocppdjv16"}).enabled == "true" then version = 16 elseif utl.ubus("wizard", "active_service", {service = "ocppdv15"}).enabled == "true" then version = 15 else version = 0 end all_options["version"] = version local info = {} for i=1, 2, 1 do for k, v in pairs(modules[i].booleanValues) do info[k] = v end for k, v in pairs(modules[i].textValues) do info[k] = v end for k, v in pairs(modules[i].listValues) do info[k] = v end end local all_pass = {} table.insert(all_pass, all_options) table.insert(all_pass, info ) if luci.http.formvalue("status") == "1" then luci.http.prepare_content("application/json") luci.http.write_json(all_pass) return end -%> <%+header%>

<%:OCPP%>

<%local backend = all_options["backend_url"] or "ws://example/url/" %>
<%if all_options then for k, v in pairs(gmod.booleanValues) do if all_options[k] ~= nil then %>
<%if all_options[k] == true then%> <%else%> <%end%>
<%end end for k, v in pairs(gmod.textValues) do if all_options[k] and k ~= "backend_url" then %>
<%end end end%>
<%if nixio.fs.access("/tmp/loading") and utl.ubus("ocppd", "get_configuration") == nil and version ~= 0 then %>
loading <%=translate("Loading data")%>
<%elseif utl.ubus("ocppd", "get_configuration") then %> <%nixio.fs.remove("/tmp/loading")%> <%end%>
" onclick = "saveAndApply()"/> "/> " onclick = "reset_page()" />
<%+footer%>