sclavel / homebridge-modbus

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

Write Coil does not work :( #11

Closed MazoSergey closed 2 years ago

MazoSergey commented 2 years ago

Hello! Something wrong with "write coil": `

[6/24/2022, 12:19:34 AM] [Modbus] setting Bedroom light On to true [6/24/2022, 12:19:34 AM] [homebridge-modbus] This plugin threw an error from the characteristic 'On': Unhandled error thrown inside write handler for characteristic: this.modbus[{(intermediate value)(intermediate value)}[this.command.type]] is not a function. See https://homebridge.io/w/JtMGR for more info. [6/24/2022, 12:19:34 AM] [Modbus] warning: polling faster than modbus can reply [6/24/2022, 12:19:35 AM] [Modbus] warning: polling faster than modbus can reply [6/24/2022, 12:19:36 AM] [Modbus] warning: polling faster than modbus can reply [6/24/2022, 12:19:37 AM] [Modbus] warning: polling faster than modbus can reply [6/24/2022, 12:19:38 AM] [Modbus] warning: polling faster than modbus can reply [6/24/2022, 12:19:39 AM] [Modbus] warning: polling faster than modbus can reply [6/24/2022, 12:19:40 AM] [Modbus] warning: polling faster than modbus can reply [6/24/2022, 12:19:41 AM] [Modbus] warning: polling faster than modbus can reply [6/24/2022, 12:19:42 AM] [Modbus] warning: polling faster than modbus can reply [6/24/2022, 12:19:43 AM] [Modbus] warning: polling faster than modbus can reply [6/24/2022, 12:19:44 AM] [Modbus] ERROR: command queue got stuck ! [6/24/2022, 12:19:44 AM] [Modbus] Connection lost [6/24/2022, 12:19:49 AM] [Modbus] Reconnecting to 10.10.10.10 [6/24/2022, 12:19:49 AM] [Modbus] Socket connected

` It there anything I could do with that? Thank you very much!

eliziox commented 2 years ago

Which version used ? Can you post your config

MazoSergey commented 2 years ago

I am running Honebridge 1.5.0 on my QNAP with your plugin. For holding registers it works fine, but for coils as you see something goes wrong :( I tried it with Modbus Poll Slave & with real Modbus device 4-noks electric socket, the same story for both of them.

config.txt

Thank you!

m4rkv5 commented 2 years ago

@MazoSergey As workaround you could use NodeRED as Docker Container with node-red-contrib-modbus and node-red-contrib-homekit-bridged. For me the installation was much faster than fixing homebridge code and it has many options for customization. Node_RED_Modbus

m4rkv5 commented 2 years ago

config.txt { "name": "Bedroom ventilation", "type": "Fan", "On": "r1" }, { "name": "Bedroom light", "type": "Switch", "On": "c1" }, { "name": "Bedroom", "type": "Thermostat", "CurrentTemperature": "i1",

How can bedroom, bedroom light and ventilation have the same adress with different object types? If an adress is accessed via the wrong object type it can result in an error.

I don't know if write coil has an issue, because my system uses only input and holding registers for everything including bools.

Additional Info for testing with debugging tools: Some modbus tools need +1, 0 or -1 added to their addresses depending on the implementation.

MazoSergey commented 2 years ago

@MazoSergey As workaround you could use NodeRED as Docker Container with node-red-contrib-modbus and node-red-contrib-homekit-bridged. For me the installation was much faster than fixing homebridge code and it has many options for customization. Node_RED_Modbus

@m4rkv5 Thank you for that kind of solution, much more user friendly :)