full devices reset
-
I thought that CloneRooms did that. I don’t have a running Vera or ZWay setup that I can test.
Renaming and reroofing devices is really quick in the openLuup console, on the devices page.
How many devices do you have to relocate?
If you have a list of them (old/new) then it’s easy enough to write a script to automate it.
-
CloneRooms, I think it works the first time only...
I'm still using Vera for 2 things, 3 zigbee thermostat that I can't migrate on z-way and also the DSC plugin (for our alarm), I have the source of the plugin, but I can't make it works under openLuup, so I'm still having it on Vera!
-
-
This is slightly tricky, partly because it's at least three years since I looked at this, and also because some of the ZWay devices are subsumed into single Luup devices and others are split into separate children.
My philosophy, currently, is not to change the plugin (since I can't easily test it) but to provide a script to run which will make the changes.
You also have a ZWay "global room" which doesn't get uniquely mapped into any single openLuup room...
-
Oh yes, it just runs in the openLuup LuaTest window.
Before I let you loose on it, there are a couple of tweaks needed. I’ve used the ZWay devices file you sent, obviously, and put it into the cmh-ludl folder so that the script can find it. Is that a reasonable mode of working?
Otherwise, I could get it to pick up the info from the bridge itself, but then I’d need to make some changes to that, and an update to openLuup too. Not a huge deal, I hope, but, again, I’m not able to test it.
Either way, you’d need to ensure that you had a backup of your latest user_data.json, in case of emergencies.
-
OK, so running this in LuaTest should (if I modified the bridge correctly) provide the same listing as I sent previously. It should NOT make any changes to the system.
-- script to rename ZWay devices in openLuup local json = require "openLuup.json" local zway = luup.openLuup.find_device {device_type = "ZWay"} local DEVS = luup.devices[zway].environment.DEVS local Offset = luup.variable_get("urn:akbooer-com:serviceId:ZWay1", "Offset", zway) -- lookup table for existing Luup rooms local function room_index() local idx = {} for i,n in pairs(luup.rooms) do idx[i] = n idx[n] = i end return idx end -- Luup device numbers in running system, indexed by altid local function luup_devNos(block) block = tonumber(block) local devs = {} for i,d in pairs(luup.devices) do if i > block then local id = d.id devs[id] = i end end return devs end -- ZWay devices: ids, names, locations local function zDevs(devices) local devs = {} for i, d in ipairs(devices) do local id = d.id: match "ZWayVDev_zway_(.+)" or '?' local shortId = id: match "^%d+%-%d+" local shortId = id: match "^(%d+%-%d)%-%d+$" -- print(id, shortId) devs[i] = {id = id, shortId = shortId, roomName = d.locationName, name = d.metrics.title} end return devs end -- Start here local D = DEVS local rename = "[%d] %45s -> %-s" local placename = "%s / '%s'" local devNos = luup_devNos(Offset) local zdevs = zDevs(D) local rooms = room_index() for i, d in ipairs(zdevs) do local id = d.id local name = d.name local shortId = d.shortId local roomName = d.roomName local dno = devNos[shortId] or devNos[id] if (dno) then local dev = luup.devices[dno] local oldName = dev.description local oldRoom = rooms[tonumber(dev.attributes.room)] roomName = rooms[roomName] and roomName or oldRoom -- leave in place if new room not found newRoom = roomName ~= oldRoom newName = name ~= oldName if newRoom or newName then print(rename:format(dno or 0, placename:format(oldRoom, oldName) , placename:format(roomName, name))) end end end