Home Electrical in JSON

I’ve been doing all the electrical improvements at home; at least over 100 installations so far. In fact, there are fewer than 10 outlets I haven’t replaced, moved, or re-wired (yet). While I have managed to balance electrical load across our breakers — the fridge, toaster oven and microwave are on separate lines — I’m no electrician. I probably wouldn’t venture into adding a breaker to our nearly full box.

Sometime in 2016 I created a file “electrical.js”: a set of JSON objects to help me take record, and plan for the electrical system in our house. For example, below is a record for a planned outlet on breaker 18, in the kitchen on the east wall, left of the sink, with GFCI.

JSON
{
    status: PLANNED,
    type: OUTLET,
    breaker: 18,
    room: KITCHEN,
    surface: EAST_WALL,
    description: "GFCI outlet left of sink"
}

This became especially useful during our kitchen project in 2018. In addition to the records, I wrote a few functions to help me query the data. For example, when I need to assess how much load is already on a breaker, or when I want to create a CSV and view it as a spreadsheet.

JavaScript
function csvAllRooms () {

    const rooms = listAllRooms();
    const header = Object.keys(rooms[0][0]).join() + '\n';

    const values = rooms.map(
        (room) => room.map(
            (node) => Object.values(node)
                .map(string => string === null ? '' : `\"${string}\"`)
                .join(',')
        ).join('\n')
    ).join('\n');

    return header + values;
    
}
A difficult 3-gang wiring in-progress. Completed and visible on the left-hand side of the counter in the next image.
The kitchen we built, see more at renovate108