⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’
Excalidraw Data
Text Elements
libcontainer
Item class
- Coordinate
- Name
- container id
- wled ip
- date added
new item can be made like
myitem = Item((2,3),“screwdriver”,1,“192.168.2.3”,“2025-01-01 13:01:22”)
Then you can grab myitem.name, or myitem.wledip, or myitem.dateadded
this means myitem can be passed to functions and they can just grab whatever info they want from it. You can also pass dummy info if a function does not really need a attribute ( e.g. wled does not need to know date added, or item name, only really coordinate, so you can use dummy data if necessary )
add function
libcontainer.add(“item”) libcontainer.add(“item”,(2,3))
constructs item objects using parameters given, and checking the database.
if no coordinate provided, searches for any items “like” the name of the current object ( according to sql ), if any exist, coordinate is the coordinate of the container with the smallest number of items in it that matches. Searches across all container systems.
If there are no drawers containing an item “like” the current item then add item to the drawer with the least items in it, or any empty drawer, does not matter. Searches across all container systems.
regardless, once you have coordinate figured out, and which container system that coordinate is within, then sends wled request to add to that position, makes copy of database for easy undo and adds item to current database. returns the item it constructed
remove function
libcontainer.remove(“item”) libcontainer.remove(“item”,(2,3))
if coordinate provided, searches database for things at that coordinate matching the name exactly, and grabs the primary key for that item
if no coordinate provided searches all drawers across all containers, and grabs primary key for first item it finds
it then lights up the coordinate associated with that primary key red via wled, makes copy of the database for easy undo, and removes item from the database.
if it cannot find an exact match, returns -1
grabcoord function
filters database for all items at given coordinate returns array of item objects for all items at that coordinate. Optional parameter of container id to grab that coordinate from if no container id provided, will check all containers and make item objects for all items matching
libcontainer.grabcoord((2,3)) libcontainer.grabcoord((2,3,),1)
grabcontainer
libcontainer.grabcontainer(1) libcontainer.grabcontainer(2)
returns array of item objects for all items in that whole container
search function
libcontainer.search(“screwdriver”)
searches database for items with exact match for name “screwdriver” sends requests to wled to turn the coordinates for those items green. Add those coordinates to a exactitems array.
Searches database for items “like” the search parameter, and if they are not exact matches ( check if coordinate in exactitems) then send request to wled to turn the coords for those items yellow
undo function
grabs latest old copy of database, and replaces current database with that old copy of database then removes that old copy of database, so that a person could undo again many layers deep
libcontainer.undo()
argparse
python3 libcontainer.py add “screwdriver” python3 libcontainer.py search “screw”
allows for easy testing while prototyping before writing main script