(Last Updated: August 22, 2020)

Support for Heaters in Openluup



  • Hey @akbooer,

    heaters support seems to be broken in the device console:

    18f991f4-aa32-4687-a444-95f87f4305bf-image.png

    it's a D_Heater1.xml/D_Heater1.json/urn:schemas-upnp-org:device:Heater:1 device, that in Vera is rendered like an heating only thermostat. Thanks!



  • 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.)



  • It's a thermostat with heating only. Vera and altui are rendering it correctly. I'll try to take a look later at the panel. Thanks.



  • 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:

    Screenshot_2020-08-21 openLuup.png

    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.



  • Thanks for the update. Heaters are indeed part of the the standard Vera device files, so I was just pointing that support for a standard type is missing in the console. My request was to include it in a future release.


Log in to reply