This might not be specific to WPI-section but figured since this is where I need it I try here.
It’s been decades since I did HTML (in my time static) and nowadays the kids are doing all kinds of magics with PHP, Java, and some I don’t even know the name of…
I need to import the pool temperature value to a .html-file and have it displayed fullscreen on a spare tablet I have no other use for. The html-file will be set to repeatable refresh so the temperature value is read for say once every fifth minute (or thenth for that matter, not important).
Is it possible to do that? And how should a string like that look for HTML? Or is it only possible in Java/other?
Perhaps I will also have the pool pump switch control a box’s color, so when it’s 1 it is green, and when it is 0 it is red.
With Reactor, I’m exporting the heating effect in kW (function of inlet-outlet temperature difference and flow speed) so it could also be cool to see that value on the display.
Hope someone can give me a push in the right direction…
I gotta ask, do you have a pool controller? If you have a Pentair Automation controller like EasyTouch, IntelliTouch, or IntelliCenter this is very trivial with a pi and about 10 lines of javascript. This is my pool dashboard panel.
What’s your purpose? It’s not difficult to reach what you want, but if you need the page to auto update, this could be tricky.
The starting point is to write an handler like this:
luup.register_handler("lh_TempPage","TempPage")
function lh_TempPage (lul_request, lul_parameters, lul_outputformat)
local value = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", 167)
local html = "<head>" ..
"<title>Temp</title>" ..
"<style>body{font-size:200px;text-align:center;}</style>" ..
"</head>" ..
"<body>" ..
"<b>Pool Temp: " ..
tostring(value) .. 'C</b>' ..
"</body></html>"
return html, "text/html"
end
I was aiming at using a local HTML-page calling for values on a local tablet, but this works fine too.
Should I make the code as startup?
Also, I’d need to input round(x,1) on the C and round(x,2) on kW.
Round can be added in custom variables in Reactor but not on physical devices added to Vera (so it needs to rounded off in this code). Does round() fit anywhere?
There is no need to display more than two decimals anywhere in Vera Secure’s sensors