Support for Heaters in Openluup
-
Not familiar with this one - what's broken? What does it look like in Vera and/or AltUI?
openLuup doesn't use JavaScript to render panels, since it's done server-side. There's an openLuup module
openLuup/panels.lua
which can be customised with arbitrary HTML to render any specific device type in any way (icon / panel / status & control page.) -
I've just remembered that I included a facility to customise the display of device classes without the need to hack any openLuup file!
The openLuup console looks for files (in cmh-ludl/) of the sort
U_devicetype.lua
to render that type. They have a specific structure, with three functions for icon / panel / tab). Here's a simple one (incomplete in terms of functionality) for the heater (U_Heater.lua
)-- user-defined Heater device panel -- using openLuup XML module and W3.css framework -- 2020.08.21 @akbooer local xml = require "openLuup.xml" local sid = "urn:upnp-org:serviceId:TemperatureSensor1" local h = xml.createHTMLDocument () -- for factory methods local function control (devNo) return h.div{ h.div {h.h5 "Heater Control and Status Tab", "Anything you like can go here!"} } end local function panel (devNo) local T = luup.variable_get (sid, "CurrentTemperature", devNo) local mode = h.form {class = "w3-container w3-form w3-third", onchange="this.form.submit()", action = "html_request", method="post", -- this is not the correct action! h.select {name="Mode", id="Mode", h.option {value="Heat", "Heat"}, h.option {value="Off", "Off", selected=1}, } } return h.div{ class = "w3-row", h.div {T, 'º'}, mode } end return { control = control, -- device control tab panel = panel, -- device panel on the Devices page icon = nil, -- override this to change the device icon } -----
which then shows the device like this:
The functions in the module can return either plain HTML text, or (for dynamic pages) an openLuup HTML DOM model. I hope there is enough in the example to get you started (if you want to) but feel free to ask, of course.