<% --[[ Status.htm (Charging_points module) ]]-- local path = luci.dispatcher.context.requestpath local user = path[#path-3] -- Usuario seleccionado para niveles de acceso local gmod -- Load modules if user ~= "user" then gmod = require "luci.model.global_variables" else gmod = require "luci.model.user_global_variables" end --local gmod = require "luci.model.global_variables" local chp = require "luci.model.charging_points" local uci = require "luci.model.uci" local fs = require "nixio.fs" local cur = uci.cursor("/tmp/.config") local mUtl = require "luci.moreUtils" local utl = require "luci.util" local hostname = utl.ubus("system", "board") local path = luci.dispatcher.context.requestpath local user, serialnumber, hw_model = chp.whoami(path) local parameters = {} local sections = {} local obj = {} local text = {} --Establish connection local conn = ubus.connect() if not conn then error("Failed to connect to ubusd") end local namespaces = { } local ubus_list = luci.sys.call("ubus list 6* > /tmp/list.txt") local list = fs.readfile("/tmp/list.txt") namespaces = utl.split(list, "\n") namespaces[#namespaces] = nil fs.remove("/tmp/list.txt") if namespaces then for i, n in ipairs(namespaces) do local starts, ends = n:find(serialnumber) if starts and #n > 12 and not n:find("/") then local signatures = conn:signatures(n) local tbl = {} local idx = 0 for p, s in pairs(gmod.procedures) do if signatures[p] then idx=idx+1 tbl[idx] = { name = p, values = gmod.procedures[p], } end end obj[#obj+1] = { name = n:sub(ends+2), procedures = tbl, } end end end conn:close() %> <%+header%>

<%:Actions%><%: - %><%=serialnumber%>

<%%> <%%> <% if (string.find(hostname.hostname,"04M")) then %> <%else%> <%end%> <% local i = 0 if obj then for i=1, #obj, 1 do %> <%local phys = false %> <% for j=1, #obj[i].procedures, 1 do %> <% local action = obj[i].procedures[j] %> <%if action.name == "get_logical_connector" then phys = true end%> <%if action.name ~= "set_leds" and action.name ~= "get_logical_connector" then %> <%end%> <%%> <%if action.name ~= "set_leds" and action.name ~= "get_logical_connector" then%> <%end%> <% end %> <%if phys == true then %> <%end%> <% end %> <% end %>
<%=serialnumber%> <%:Acciones%>
<%=translate("Reboot")%> " name="reboot" id="reboot_device" onclick="return send_actions(this)" />
<%=hostname.hostname%> <%:Acciones%>
<%=translate("Reboot")%> " name="reboot" id="reboot" onclick="return send_actions(this)" />
<%=serialnumber%> <%:Acciones%>
<%=translate("Reboot")%> " name="reboot" id="reboot" onclick="return send_actions(this)" />
<%=translate(obj[i].name)%> <%:Actions%>
<%=translate(action.name)%> <% if action.name == "set_fsm" then %> " name="<%=obj[i].name%>" id="<%=action.name%>" onclick="return send_actions(this)" /> <% elseif (action.name == "set_credit") or (action.name == "set_uid") then %> /> " name="<%=obj[i].name%>" id="<%=action.name%>" onclick="return send_actions(this)" /> <% elseif action.name == "set_leds" then for k, key in ipairs(action.values) do %> <% else %> <% if action.name ~= "get_logical_connector" then %> <% for k=1, #action.values, 1 do -%> <% end %> <%end%> <% end %>
<%=translate("Start charge")%> " />
<%=translate("Stop charge")%> " />

<%+footer%>