I am trying to create a new block that reads analog input from a port on the mblock ranger. The code should work in live mode. This is my code but this always returns Null.
async (args, app, device, block) => {
const portMap = {
"Port6": 6, "Port7": 7, "Port8": 8, "Port9": 9, "Port10": 10
};
const slotMap = { "W1": 1, "W2": 2 };
const port = portMap[args.port];
const slot = slotMap[args.slot];
if (port === undefined || slot === undefined) return 0;
return await device.asyncReadSensor("analog", port, slot);
}