[12/12/2020, 16:44:30] TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (2) at Object.writeFileSync (fs.js:1460:5) at new Gpio (/usr/local/lib/node_modules/homebridge-gpio-services/node_modules/onoff/onoff.js:96:10) at GpioOutput.initGpio (/usr/local/lib/node_modules/homebridge-gpio-services/lib/gpio/gpio_actuators.js:72:21) at new GpioOutput (/usr/local/lib/node_modules/homebridge-gpio-services/lib/gpio/gpio_actuators.js:55:14) at PushButton.initService (/usr/local/lib/node_modules/homebridge-gpio-services/lib/accessories/pushbutton.js:28:9) at new AbstractAccessory (/usr/local/lib/node_modules/homebridge-gpio-services/lib/accessories/abstract_accessory.js:31:18) at new PushButton (/usr/local/lib/node_modules/homebridge-gpio-services/lib/accessories/pushbutton.js:14:9) at /usr/local/lib/node_modules/homebridge/src/server.ts:357:50 at Array.forEach (<anonymous>) at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:330:29)
Replacing the pin definition from number to string solves the problem:
Hello,
On the last release of home bridge onoff throws an issue when using a service defined as:
{ "accessory": "GPIO-PushButton-Service", "name": "Apri Serramenti", "pin": 2, "invokeTimeout": 400 },
the error is:
[12/12/2020, 16:44:30] TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (2) at Object.writeFileSync (fs.js:1460:5) at new Gpio (/usr/local/lib/node_modules/homebridge-gpio-services/node_modules/onoff/onoff.js:96:10) at GpioOutput.initGpio (/usr/local/lib/node_modules/homebridge-gpio-services/lib/gpio/gpio_actuators.js:72:21) at new GpioOutput (/usr/local/lib/node_modules/homebridge-gpio-services/lib/gpio/gpio_actuators.js:55:14) at PushButton.initService (/usr/local/lib/node_modules/homebridge-gpio-services/lib/accessories/pushbutton.js:28:9) at new AbstractAccessory (/usr/local/lib/node_modules/homebridge-gpio-services/lib/accessories/abstract_accessory.js:31:18) at new PushButton (/usr/local/lib/node_modules/homebridge-gpio-services/lib/accessories/pushbutton.js:14:9) at /usr/local/lib/node_modules/homebridge/src/server.ts:357:50 at Array.forEach (<anonymous>) at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:330:29)
Replacing the pin definition from number to string solves the problem:
from
"pin": 2,
to
"pin": "2",
Hope that helps,
Regards,