-- HTML output
local pagestring = "mp2.lua not started yet"
if not heatsink_temperature then heatsink_temperature = 0.0 end
if V_out ~= nil then
-- Start building the page header
pagestring = "
OSPIT
Status Page of "..nodeid.."
Date "..string.format("%04d-%02d-%02d", localTime["year"], localTime["mon"], localTime["day"]).."
Time "..string.format("%02d:%02d:%02d", localTime["hour"], localTime["min"], localTime["sec"]).."
Uptime in seconds "..node_uptime.."Battery status
Health status "..charge_status.."
Charge state "..charge_state_int.."%
Battery voltage "..V_out.." Volt
Battery temperature "..battery_temperature.."°CEnvironment status
Air temperature "..airtemp.."°C
"
-- Helper function to append sensor data only if valid
local function append_sensor(label, val, unit)
if val ~= -127 then
pagestring = pagestring .. "" .. label .. " " .. val .. unit .. "
"
end
end
-- Process sensors 1 through 4
append_sensor("Soil humidity | Sector 1", shumidity1, "%")
append_sensor("Soil temperature | Sector 1", stemp1, "°C")
append_sensor("Soil humidity | Sector 2", shumidity2, "%")
append_sensor("Soil temperature | Sector 2", stemp2, "°C")
append_sensor("Soil humidity | Sector 3", shumidity3, "%")
append_sensor("Soil temperature | Sector 3", stemp3, "°C")
append_sensor("Soil humidity | Sector 4", shumidity4, "%")
append_sensor("Soil temperature | Sector 4", stemp4, "°C")
-- Append the footer/system stats
pagestring = pagestring .. "Manual irrigation control
Water supply status
Tank fill gauge "..tankgauge.."%Solar power status
Solar panel open circuit voltage "..V_oc.." Volt
MPP-Tracking voltage "..V_in.." Volt"
end
return function(conn)
printv(3,"Pagestring",pagestring)
send_response(pagestring)
end