I have posted the code here.
Button is for Leaving network.
binaryPin is for Sensor state.
I work with the premise that the examples are just a means to get one using the tools and not meant to be “perfect” examples.
This is the external converter I used for the code.
const m = require('zigbee-herdsman-converters/lib/modernExtend');
const definition = {
zigbeeModel: ['ZigbeeOnOffSensor'],
model: 'ZigbeeOnOffSensor',
vendor: 'KaSaJa',
description: 'Automatically generated definition',
extend: [m.deviceEndpoints({"endpoints":{"1":1}}), m.binary({"name":"Binary Sensor","cluster":"genBinaryInput","attribute":"presentValue","reporting":{"attribute":"presentValue","min":"MIN","max":"MAX","change":1},"valueOn":["ON",1],"valueOff":["OFF",0],"description":"binary_input_1","access":"STATE_GET","endpointName":"1"})],
meta: {},
};
module.exports = definition;