Well, yes, another Luup / Vera API inconsistency.
Neither luup.create_device() nor luup.chdev.append() have parameters to set attributes… they don’t even have the same parameter list. In openLuup, I have a separate table-driven create_device() function which can set anything.
To do this properly requires a built-in database of device types / categories / sub-categories, which is the sort of thing I’ve strenuously tried to avoid. However, openLuup does, in fact, have a small and little-used database which allows a device to be created simply from its device type (something which works in Vera, but AltUI has no interface to do this.)
I could extend said database to do what you need. How extensive does it actually need to be? At the moment it looks like this…
local mcv = "urn:schemas-micasaverde-com:device:"
local upnp = "urn:schemas-upnp-org:device:"
local categories_lookup = -- info about device types and categories
{
{id = 1, name = "Interface", type = mcv .. "HomeAutomationGateway:1"},
{id = 2, name = "Dimmable Switch", type = upnp .. "DimmableLight:1"},
{id = 3, name = "On/Off Switch", type = upnp .. "BinaryLight:1"},
{id = 4, name = "Sensor", type = mcv .. "DoorSensor:1"},
{id = 5, name = "HVAC", type = upnp .. "HVAC_ZoneThermostat:1"},
{id = 6, name = "Camera", type = upnp .. "DigitalSecurityCamera:1"},
{id = 6, name = "Camera", type = upnp .. "DigitalSecurityCamera:2"},
{id = 7, name = "Door Lock", type = mcv .. "DoorLock:1"},
{id = 8, name = "Window Covering", type = mcv .. "WindowCovering:1"},
{id = 9, name = "Remote Control", type = mcv .. "RemoteControl:1"},
{id = 10, name = "IR Transmitter", type = mcv .. "IrTransmitter:1"},
{id = 11, name = "Generic I/O", type = mcv .. "GenericIO:1"},
{id = 12, name = "Generic Sensor", type = mcv .. "GenericSensor:1"},
{id = 13, name = "Serial Port", type = "urn:micasaverde-org:device:SerialPort:1"}, -- yes, it really IS different
{id = 14, name = "Scene Controller", type = mcv .. "SceneController:1"},
{id = 15, name = "A/V", type = mcv .. "avmisc:1"},
{id = 16, name = "Humidity Sensor", type = mcv .. "HumiditySensor:1"},
{id = 17, name = "Temperature Sensor", type = mcv .. "TemperatureSensor:1"},
{id = 18, name = "Light Sensor", type = mcv .. "LightSensor:1"},
{id = 19, name = "Z-Wave Interface", type = mcv .. "ZWaveNetwork:1"},
{id = 20, name = "Insteon Interface", type = mcv .. "InsteonNetwork:1"},
{id = 21, name = "Power Meter", type = mcv .. "PowerMeter:1"},
{id = 22, name = "Alarm Panel", type = mcv .. "AlarmPanel:1"},
{id = 23, name = "Alarm Partition", type = mcv .. "AlarmPartition:1"},
{id = 23, name = "Alarm Partition", type = mcv .. "AlarmPartition:2"},
{id = 24, name = "Siren", type = mcv .. "Siren:1"},
--[[
also: --TODO: find out device types for new categories
25 Weather
26 Philips Controller
27 Appliance
28 UV Sensor
29 Mouse Trap
30 Doorbell
31 Keypad
]]
}
Amusing to see yet another mistake in the device schema name for serial port device!