%# hmi.htm -%> <% if user ~= "user" then mod = require "luci.model.events" end ---------------------- -- Poste seleccionado ---------------------- local chp = require "luci.model.charging_points" local path = luci.dispatcher.context.requestpath local user, serialnumber, hw_model = chp.whoami(path) local fs = require "nixio.fs" local cl = path[1] local utl = require "luci.util" local mUtl = require "luci.moreUtils" if not fs.access("/etc/config/brokers") then fs.writefile("/etc/config/brokers", "\n") end if not fs.access("/etc/config/ingeruled") then fs.writefile("/etc/config/ingeruled","\n") end local events = {} local events_ = mUtl.return_events() local rules = utl.ubus("uci", "get", {config = "ingeruled" }) if rules and rules.values then for k , v in pairs (rules.values) do for z , t in pairs (events_) do for n , m in pairs (t) do if v and v.recipe and string.find(v.recipe, m) then events[z] = true end end end end end local brokers = utl.ubus("uci", "get", {config = "brokers", type = "broker"}) local port local host if brokers and brokers.values then for k , v in pairs (brokers.values) do port = v.port or "" host = v.host or "" end end local active = utl.ubus("wizard", "active_service", {service = "ingeruled"}) local button, val if active and active.enabled and active.enabled == "true" then button = "reset" val = "Disable" elseif active and active.enabled and active.enabled == "false" then button = "enable" val = "Enable" end -%> <%+header%>