SphtKr / homebridge-zway

Homebridge plugin for (better) HomeKit support of RaZBerry and Z-Way Server
ISC License
85 stars 37 forks source link

Homebridge fails when new Somfy ZWave2RTS interface included #72

Open Fingerz opened 7 years ago

Fingerz commented 7 years ago

I've just received the new Somfy ZWave2RTS gateway (EU version) for motorized blinds and when I include it into ZWay, Homebridge shows up as Not Responding in the Home app. There are no error messages in Homebridge (even when running in debug mode). Deactivating the Somfy devices (it's a multi-channel Z-Wave device as it can control multiple motors) resolves the issue.

devices.txt

SphtKr commented 7 years ago

Sounds like something's hanging/failing during initialization. On the console when you start Homebridge, do you ever see the PIN code display appear? If not, it's not finishing startup.

FWIW, multi-channel should not be the problem, as I've run into that before. Must be something though.

Fingerz commented 7 years ago

Yes, Homebridge starts up fully and displays the PIN code. When started in debug mode there are no error messages and Homebridge acts like nothing is wrong. I know that in iOS 10.2 they made some changes to prevent bridges publishing non-conforming devices. Maybe because this z-wave actuator only supports up/down/stop and not position (which I think is mandatory in HomeKit), HomeKit may be marking the bridge as unreachable. Just a guess.

SphtKr commented 7 years ago

Can you send me a dump of your devices JSON and run DEBUG=ZWayServer homebridge and attache the output?

Fingerz commented 7 years ago

Requested output attached...let me know if this helps. I'm going to update to RC1 now and see if that makes a difference.

devices.txt homebridge-debug-output.txt

SphtKr commented 7 years ago

I may be on to something, or at least I found a bug that causes an anomaly in the published accessories. In your installation of 0.5.0-rc1, in your index.js, go to line 1233, which reads:

maxValue: vdev.metrics && (vdev.metrics.max !== undefined || vdev.metrics.max != 99) ? vdev.metrics.max : 100

And change the logical OR || operator to an AND &&, like this:

maxValue: vdev.metrics && (vdev.metrics.max !== undefined && vdev.metrics.max != 99) ? vdev.metrics.max : 100
                                                          ^^

I can't easily test if that stops blowing up HomeKit, but the existing code results in no maxValue being published, where there is a minValue published...and I can see HomeKit getting upset about that.

Fingerz commented 7 years ago

That worked, at least I'm able to pair Homebridge with HomeKit when the motorized blinds are active in ZWay! The only issue left is that 2 of the four motorized blinds show up as Not Responding in the Home app despite the fact that they are all created by the same multi-channel Z-Wave device. Great work!

SphtKr commented 7 years ago

Hmm! Which two?

Fingerz commented 7 years ago

It's not consistent...after a few hours all four were showing up as Not Responding in Apple's Home app. When I took a look in the original Home.app it shows that the Current Position value for the shades was "Error". The shades can be controlled via Siri and third party HomeKit apps, but due to the issue with the Current Position value I think Apple's Home app is now allowing control via the UI. See the attached screen shots.

fullsizeoutput_9c28 fullsizeoutput_9c29

SphtKr commented 7 years ago

It may be detecting that the target position you set (100%) never gets returned as the current position--that is, they don't match soon after ordering a change. Perhaps importantly, if you shut them via Homebridge/iOS/Siri, do they show as closed in Z-Way?

Fingerz commented 7 years ago

The status in ZWay is updating the way you would expect it to: if I give a command via Siri to close an open shade the status in ZWay immediately changes from open (green) to closed (red) and vice versa. This makes sense since this is a one-way actuator and does not know the status of the shades nor can do positioning. Ideally HomeKit should get returned a Current Position that matches whatever ZWay is showing. That way you don't break full featured shade controllers that can control and report accurate position.

SphtKr commented 7 years ago

Yes, just checking. It's puzzling, so I've tested sending an update to the position and it seems to do what it's supposed to....so I'm not sure why it's not updating on the HomeKit side. The "Hold Position" is a one-way, write-only characteristic--I'm pretty sure per the HomeKit spec--so I'm not sure why it would complain that that is "No Answer", that doesn't really make sense to me. I'll keep messing with it.

SphtKr commented 7 years ago

Pushing this to 0.6...not sure what's causing the status problem yet.

Debug1Bug commented 7 years ago

Can I just ask where you bought your Somfy ZWave2RTS gateway (EU version). I have been unable to find a place to buy one for EU z-wave freq. Thanks in advance.

Fingerz commented 7 years ago

Can I just ask where you bought your Somfy ZWave2RTS gateway (EU version). I have been unable to find a place to buy one for EU z-wave freq.

I ended up buying it from a Somfy distributor in Singapore...that's the only place I could find it for sale and luckily my company has an office there. It works as advertised...but it's surprising that it took Somfy 10 years to make an EU version of this product. It is a better engineered product than the US version for sure.

Debug1Bug commented 7 years ago

@Fingerz, can you provide the name of the shop? Or do you know of some place it can be bought in the EU? I have been unable to find a place to buy it at all and I have searched high and low. It's like the product dosen't exist...

Fingerz commented 7 years ago

@Debug1Bug This is who I bought it from in Singapore:

philip tang & sons pte ltd 21 Bukit Batok Crescent

05-79 WCEGA Tower

Singapore 658065 t | +65 6569 9025 ext.344 m | +65 85221010 w | www.tangs.net