sclavel / homebridge-modbus

Homebridge plugin to interface with any modbusTCP
8 stars 14 forks source link

Issue when write change a coil #2

Closed eliziox closed 3 years ago

eliziox commented 4 years ago

Hi

Thanks for your usefull plugin

It seems that we have an error when we try to modify a coil

I can read coil and register, also is possible to write in a register but not in a coil.

TypeError: this.modbus[{(intermediate value)(intermediate value)}[this.command.type]] is not a function at ModbusPlatform.onQueue (/homebridge/node_modules/homebridge-modbus/index.js:124:89) at Socket.emit (events.js:315:20) at ModbusPlatform.writeModbus (/homebridge/node_modules/homebridge-modbus/index.js:113:19) at On. (/homebridge/node_modules/homebridge-modbus/index.js:284:27) at On.emit (events.js:315:20) at On.EventEmitter.emit (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/EventEmitter.ts:42:22) at On.Characteristic._this.setValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:625:12) at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1437:24 at Array.forEach () at Bridge.Accessory._this._handleSetCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1279:10)

Each time we have this message then homebridge need to reboot

Any advise please ?

thanks

Pascalx77 commented 3 years ago

Hi, I have exact same problem with exact same error message.

eliziox commented 3 years ago

Hi,

Have you find how solve this issue ?

Thanks

JSP

Le 21 juil. 2020 à 03:20, Pascalx77 notifications@github.com a écrit :



Hi e

Hi

Thanks for your usefull plugin

It seems that we have an error when we try to modify a coil

I can read coil and register, also is possible to write in a register but not in a coil.

TypeError: this.modbus[{(intermediate value)(intermediate value)}[this.command.type]] is not a function at ModbusPlatform.onQueue (/homebridge/node_modules/homebridge-modbus/index.js:124:89) at Socket.emit (events.js:315:20) at ModbusPlatform.writeModbus (/homebridge/node_modules/homebridge-modbus/index.js:113:19) at On. (/homebridge/node_modules/homebridge-modbus/index.js:284:27) at On.emit (events.js:315:20) at On.EventEmitter.emit (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/EventEmitter.ts:42:22) at On.Characteristic._this.setValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:625:12) at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1437:24 at Array.forEach () at Bridge.Accessory._this._handleSetCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1279:10)

Each time we have this message then homebridge need to reboot

Any advise please ?

thanks

Hi, I have exact same problem with exact same error message.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/sclavel/homebridge-modbus/issues/2#issuecomment-661570592, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AP3TLZMWABEJ5RSX6J44253R4T3QRANCNFSM4NWJYW4A.

bpelt commented 3 years ago

writeSingleCoil should be with a lowercase 'w'. At line 124. It is currently WriteSingleCoil. this.modbus[{'c':'writeSingleCoil', 'r':'writeSingleRegister'}[this.command.type]](this.command.add-1, Math.round(this.command.val));

eliziox commented 3 years ago

Thanks

For me the plugin is died, I can’t reinstall it. Too bad

JSP

Le 24 déc. 2020 à 13:33, Boudewijn Pelt notifications@github.com a écrit :



writeSingleCoil should be with a lowercase 'w'. At line 124. It is currently WriteSingleCoil. this.modbus[{'c':'writeSingleCoil', 'r':'writeSingleRegister'}[this.command.type]](this.command.add-1, Math.round(this.command.val));

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/sclavel/homebridge-modbus/issues/2#issuecomment-750870187, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AP3TLZMXSP3S4EPAWBLQ75LSWMYJLANCNFSM4NWJYW4A.

sclavel commented 3 years ago

as bpelt mentioned, it was indeed a bug in the code. fixing now.