Node.js JSON searching & updating
A few things to consider;

Is it worth abstracting the collection into the lights and locks arrays? The data format is effectively identical, and I think separating them makes the collection as a whole harder to iterate over.

To follow up from the first point, I try to avoid for loops in JavaScript because there's so many efficient and readable alternatives for working with arrays. If we were to rewrite your data structure to be the following:

{
    "switches": [{
        "name": "light-one",
        "pin": 3, // definitely store integers as ints and not wrapped in quotes!
        "command":"gpioDo",
        "actions": {
            "on": 1,
            "off": 0
        }
    }, {
        // ...
    }]
}


We can then rewrite your first example to be the following:

var state = lib.map(function(switch) {
    return {
        pin: switch.pin,
        val: 0
    };
});


This removes the index variables completely, and in my opinion makes the code more readable. In the case of not rewriting the data structure you could just iterate over the lights and locks arrays with a map function, then concat them together.

In the same way we can iterate over this when you want to set the values.

var updateVal = function(pinID, valID) {
    state.forEach(function(s) {
        s.pin === pinID &amp;&amp; (s.val = valID);
    });
};


The function expression is just a personal preference, but I like it as it forces you to declare a function before using it.

I'm also not sure if the actions key needs to be like it is; perhaps you need it for other entities that have other actions, but I would probably replace it with a boolean active (to represent on and off), for simplicity.

Hope this helps. :)