homebridge: Characteristic setValue or updateValue cannot response to Home App

hardware: Raspberry Pi 3B homebridge version: 2.2 nodejs version: 8.1.2 iOS version: 10.3.2

Hello all, I’m trying to integrate our legacy smart lightbulb devices to Homkit using homebridge and serial port. And I’m developing a homebridge plugin to implement it. I have added accessories to bridge successfully and serial port communication is ok between homebridge and devices and Now I meet a problem. When the plugin receive a serial port command, and I will set Characteristic value like following: accessory.getService(Service.Lightbulb).getCharacteristic(Characteristic.On).updateValue(newValue); Alternatively accessory.getService(Service.Lightbulb).getCharacteristic(Characteristic.On).setValue(newValue);

but accessory button in Home App always haven’t response until I change Home App to backgroud or restart Home App. But I noticed that if I click the button in Home App, and call updateValue/setValue by serial port immediately, the accessory button in Home App have response.

I guess that updateValue/setValue haven’t connect EventedHTTPServer and Home App will connect that, and updateValue/setValue calling will send event before Home App disconnect from EventedHTTPServer. But I don’t confirm it.

Does anybody know what’s the reason and how to solve it?

Thank you very much.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Okay, so in Node.js 8.0, there is a new property introduced on http server which will close inactive connection after a timeout. homebridge 0.4.22 should addressed this problem on Node.js 8.0. Sorry for inconveniences.

OK, I’ve found the/my problem. I don’t have a fix tho. At least, not a good one.

It’s Node. 8.1.2 to be exact. Well, thats the version I used to have.

TL;DR:

  • It works in 6.11, but my homebridge-broadlink-rm doesn’t. That needs 7.10
  • It works in 7.10 !! 😃
  • It FAILS in 8.1.2

I run the homebridge-broadlink-rm plugin which need 7.6.0 or better, so I got the latest stable, which appears to show this issue

I went back to 6.10.3, and everything works (I had to disable the broadlink plugin tho 😦 )

My other machine, which is working, is running 4.6.0. I need to upgrade that to 6.10 😃

I then went for the latest in 7.x (for the broadlink one) which WORKS! yay!

So… 8.1.2 bug? I’m not overly familiar with the Node ecosystem, so I don’t know where to look for breaking changes…

I’m also seeing this in the debug, which I assume is 👍

  EventedHTTPServer [::ffff:192.168.1.6] HTTP Response is finished +0ms
[6/25/2017, 9:06:36 AM] [DashSQS] [object Object] receiveMessage response
[6/25/2017, 9:06:37 AM] [DashSQS] [object Object] receiveMessage response
[6/25/2017, 9:06:37 AM] [DashSQS] Path Button: SQS Button state change. New state is false
[6/25/2017, 9:06:37 AM] [DashSQS] Path Button: Set State to false
  EventedHTTPServer [::ffff:192.168.1.53] Sending HTTP event '10.9' with data: {"characteristics":[{"aid":10,"iid":9,"value":false}]} +4s
  EventedHTTPServer [::ffff:192.168.1.6] Sending HTTP event '10.9' with data: {"characteristics":[{"aid":10,"iid":9,"value":false}]} +0ms
[6/25/2017, 9:06:41 AM] [DashSQS] [object Object] receiveMessage response
[6/25/2017, 9:06:41 AM] [DashSQS] Path Button: SQS Button state change. New state is true
[6/25/2017, 9:06:41 AM] [DashSQS] Path Button: Set State to true
  EventedHTTPServer [::ffff:192.168.1.53] Sending HTTP event '10.9' with data: {"characteristics":[{"aid":10,"iid":9,"value":true}]} +4s
  EventedHTTPServer [::ffff:192.168.1.6] Sending HTTP event '10.9' with data: {"characteristics":[{"aid":10,"iid":9,"value":true}]} +0ms
[6/25/2017, 9:06:51 AM] [DashSQS] [object Object] receiveMessage response
[6/25/2017, 9:06:51 AM] [DashSQS] Path Button: SQS Button state change. New state is false
[6/25/2017, 9:06:51 AM] [DashSQS] Path Button: Set State to false
  EventedHTTPServer [::ffff:192.168.1.53] Sending HTTP event '10.9' with data: {"characteristics":[{"aid":10,"iid":9,"value":false}]} +11s
  EventedHTTPServer [::ffff:192.168.1.6] Sending HTTP event '10.9' with data: {"characteristics":[{"aid":10,"iid":9,"value":false}]} +1ms