full devices reset
-
-
OK, so this script SHOULD make the changes.
Ensure you have a backup user_data.json, change the filename as before, run the script, restart openLuup just to make sure everything is synched.
Let me know how it goes!
-- script to rename ZWay devices in openLuup filename = "Des/DES_ZWay.json" -- change this to the right place 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) local function read_ZWay_data(filename) local f = io.open (filename) if not f then error "file not found" end local j = f: read "*a" f: close() local D = json.decode (j) return D.data.devices end -- 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)%-%d+$" devs[i] = {id = id, shortId = shortId, roomName = d.locationName, name = d.metrics.title} end return devs end -- Start here local D = read_ZWay_data (filename) 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))) dev: rename(newName and name, newRoom and roomName) end end end
-
The only last thing that's not working properly in openLuup since a while, it's the plugin RulesEngine that can't save changes in rules.
Not sure if it's related to ALTUI or openLuup and I've got no error in the openLuup logs
-
Yes to running the script again.
I looked a RulesEngine a while ago and never found out what was wrong, except that I think it’s a JavaScript issue, IIRC. Do you get any error in the browser log?
-
Nah I just check again, nothing in the browser console...
-
and also, /openLuup is not working
-
/openLuup ??
-
yeah the console
-
-
Try /openluup ?
-
file not found
-
/console ?
-
can't find WSAPI application entry point
-
You’re saying that
OpenLuupIP:3480/openLuup?page=devices
Doesn’t work.
Is this new?
-
it's not working.. and have no idea when it start not working, i'm not using it often
-
The latest dev v24.2.26, has better diagnostics for the console startup...
...may help to diagnose your console issue, if you have time to give it a go.
The console starts on the first attempt to access one of its pages.
-
Just updated...
Got
2024-02-26 12:25:03.339 openLuup.wsapi:: using openLuup/console.lua for openLuup
2024-02-26 12:25:03.339 openLuup.wsapi:: using REQUIRE to load CGI openLuup/console.lua
2024-02-26 12:25:03.339 openLuup.wsapi:: can't find WSAPI application entry point -
2024-02-26 12:27:36.315 openLuup.wsapi:: using openLuup/console.lua for openLuup
2024-02-26 12:27:36.316 openLuup.wsapi:: using REQUIRE to load CGI openLuup/console.lua
2024-02-26 12:27:36.328 scheduler.context_switch:: ERROR: [dev #0] ./openLuup/panels.lua:69: attempt to call field 'SID' (a nil value)
2024-02-26 12:27:36.328 openLuup.server:: ./openLuup/panels.lua:69: attempt to call field 'SID' (a nil value) -
Excellent – a good error message to work on...
...I just need to work out why it's not happening to me.
50/77