Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error on adding new accessories #109

Open
alexchornyi opened this issue Jun 20, 2021 · 12 comments
Open

error on adding new accessories #109

alexchornyi opened this issue Jun 20, 2021 · 12 comments

Comments

@alexchornyi
Copy link

I will try to add new accessories

homebridge/to/add
{
"name": "Smart AC",
"service_name": "smart_ac",
"service": "HeaterCooler",
"CoolingThresholdTemperature": {"maxValue":30, "minValue": 17, "minStep": 1},
"HeatingThresholdTemperature": {"maxValue":30, "minValue": 17, "minStep": 1}
}

on home bridge I get list of errors and Homebridge totally rebooted

TypeError: Cannot read property 'on' of undefined
at Accessory.allocate (/usr/local/lib/node_modules/homebridge-mqtt/lib/accessory.js:199:6)
at Accessory.configureCharacteristics (/usr/local/lib/node_modules/homebridge-mqtt/lib/accessory.js:154:12)
at Accessory.configureAccessory (/usr/local/lib/node_modules/homebridge-mqtt/lib/accessory.js:95:10)
at Controller.addAccessory (/usr/local/lib/node_modules/homebridge-mqtt/lib/controller.js:107:17)
at Model. (/usr/local/lib/node_modules/homebridge-mqtt/lib/model.js:153:22)
at MqttClient.emit (events.js:375:28)
at MqttClient._handlePublish (/usr/local/lib/node_modules/homebridge-mqtt/node_modules/mqtt/lib/client.js:1277:12)
at MqttClient._handlePacket (/usr/local/lib/node_modules/homebridge-mqtt/node_modules/mqtt/lib/client.js:410:12)
at work (/usr/local/lib/node_modules/homebridge-mqtt/node_modules/mqtt/lib/client.js:321:12)
at Writable.writable._write (/usr/local/lib/node_modules/homebridge-mqtt/node_modules/mqtt/lib/client.js:335:5)
at doWrite (/usr/local/lib/node_modules/homebridge-mqtt/node_modules/readable-stream/lib/_stream_writable.js:409:139)
at writeOrBuffer (/usr/local/lib/node_modules/homebridge-mqtt/node_modules/readable-stream/lib/_stream_writable.js:398:5)
at Writable.write (/usr/local/lib/node_modules/homebridge-mqtt/node_modules/readable-stream/lib/_stream_writable.js:307:11)
at Socket.ondata (internal/streams/readable.js:726:22)
at Socket.emit (events.js:375:28)
at addChunk (internal/streams/readable.js:290:12)
[20/06/2021, 11:20:15] Got SIGTERM, shutting down Homebridge...

@cflurin cflurin closed this as completed Jun 22, 2021
@alexchornyi
Copy link
Author

Why you closed without any solution?

@cflurin
Copy link
Owner

cflurin commented Jun 22, 2021

Hi,

I've uploaded a fix in accessory.js.
Please download accessory.js from GitHub and try again.

@cflurin cflurin reopened this Jun 22, 2021
@alexchornyi
Copy link
Author

thnx

@jjknudsen
Copy link

I updated accessory.js with the latest version you committed a few days ago and am getting the same issues. Right after adding the accessory I see this:

6/24/2021, 9:02:41 AMMqtt BridgemqttWARNINGon.offline <to analyze>
6/24/2021, 9:02:41 AMMqtt BridgemqttWARNINGon.close <to analyze>
6/24/2021, 9:02:42 AMMqtt BridgemqttWARNINGon.reconnect <to analyze>
6/24/2021, 9:02:42 AMMqtt Bridgemqttconnected (url = mqtt://127.0.0.1)
6/24/2021, 9:02:47 AMMqtt BridgemqttaddAccessory true, accessory 'office_occupancy', service_name 'Office Occupancy' is added. [0]

@cflurin
Copy link
Owner

cflurin commented Jun 25, 2021

I updated accessory.js with the latest version you committed a few days ago and am getting the same issues.

This isn't the same issue! Please read the doc and correctly configure your mqtt-broker.

@cflurin
Copy link
Owner

cflurin commented Jun 25, 2021

@alexchornyi

Does the new accessory.js work for you?

@jjknudsen
Copy link

jjknudsen commented Jun 25, 2021

I am using node-red-contrib-aedes for my broker. It's a fairly straightforward configuration. Everything seems to work just fine on another Raspberry Pi with the only difference between the two being that one is running Homebride 1.3.3 and the other is running 1.3.4.

@cflurin
Copy link
Owner

cflurin commented Jun 28, 2021

I'm using mosquitto for years without any issues.

@cflurin cflurin closed this as completed Jun 28, 2021
@jjknudsen
Copy link

I updated the plugin to 1.0.1 which includes your updates to accessory.js. I've switched to Mosquitto for my broker. Not sure what else i should look into but still getting the exact same message as the original poster.

7/1/2021, 10:17:01 AMMqtt BridgeWARNINGunhandled rejection: TypeError: Cannot read property 'on' of undefined

@cflurin
Copy link
Owner

cflurin commented Jul 2, 2021

Please post more infos:

topic: homebridge/to/add

payload: ?

Post the full error log: from start to the error.

@cflurin cflurin reopened this Jul 2, 2021
@jjknudsen
Copy link

jjknudsen commented Jul 2, 2021

OK. I'm sorry for all the fuss. I'm not sure if the original poster is using Hoobs as well, but I'm running the Hoobs 4 beta where I'm having these issues.

I installed a new instance of homebridge on another machine, and using this plugin with the same MQTT broker and had no issues whatsoever. So I'm going to have to put the Hoobs 4 beta at fault I think. I'll open an issue there and see what happens. I'll also continue to debug and will post here if I find anything useful for you.

Thanks for your help and responsiveness on this.

@jjknudsen
Copy link

Any tips on how I might go about debugging this? I'm not sure if it's a Hoobs4 issue or something else but I'm really wanting to make it work. Trying to get a stack trace or something so that I can begin debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants