<% --[[ 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 = luci.dispatcher.context.requestpath local serialnumber = mUtl.get_serialnumber() local pseudo_maestre = mUtl.identify_pseudo_maestre(path[3]) local method if pseudo_maestre == true then method = serialnumber m = "master" else method = serialnumber m = "esclavo" end local cl = path[1] local all_options = utl.ubus(method, "get_configuration") local sn_options = {} if 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" and k == path[3] then local opt = {} for option, val in pairs (v) do if val == true then --val = "on" elseif val == false then --val = "off" end sn_options[option] = val opt[option] = val end end end end else all_options = {} end 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, sn_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%>

<%if next(sn_options) == nil then %>
loading <%=translate("Loading data")%>
<%else%> <%end%> <%if sn_options then for k, v in pairs(gmod.booleanValues) do if sn_options[k] ~= nil then %>
<%if sn_options[k] == true then%> <%else%> <%end%>
<%end end for k, v in pairs(gmod.textValues) do if sn_options[k] and k ~= "backend_url" then %>
<%end end end%>
" onclick = "saveAndApply()"/> "/> " onclick = "reset_page()" />
<%+footer%>