Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Crash with Door Lock device #23

Closed
smulikHakipod opened this issue Mar 27, 2015 · 13 comments
Closed

Crash with Door Lock device #23

smulikHakipod opened this issue Mar 27, 2015 · 13 comments
Labels

Comments

@smulikHakipod
Copy link
Contributor

> .22:44:21 857  ERROR  Error constructing response packet {}
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.bubblecloud.zigbee.network.packet.zdo.ZDO_MSG_CB_INCOMING.translate(ZDO_MSG_CB_INCOMING.java:145)
    at org.bubblecloud.zigbee.network.packet.ZToolPacketStream.parsePayload(ZToolPacketStream.java:309)
    at org.bubblecloud.zigbee.network.packet.ZToolPacketStream.parsePacket(ZToolPacketStream.java:171)
    at org.bubblecloud.zigbee.network.packet.ZToolPacketParser.run(ZToolPacketParser.java:107)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 6
    at org.bubblecloud.zigbee.network.packet.zdo.ZDO_SIMPLE_DESC_RSP.<init>(ZDO_SIMPLE_DESC_RSP.java:96)```

The frame is too small for the parser. Any ideas what can cause it so I can start fixing it?
Thanks
@presslab-us
Copy link
Contributor

I have seen something like this while developing a ZigBee device. I believe the problem is that zigbee4java does not check if the descriptor length is zero and tries to parse it. I think I can come up with a patch, give me a few hours.

@presslab-us
Copy link
Contributor

Yes, I see the problem in the code. By the way, what lock are you working with?

@smulikHakipod
Copy link
Contributor Author

Actually I am using the sample lock from TI HA examples. And you are probably right about the length, when I debug the crash I saw that the packet length is zero.

@presslab-us
Copy link
Contributor

Well, there you go. If you look at sampleDoorLock_TestEp in the sample code, you can see there is no simple descriptor. This is what triggers the bug in zigbee4java. You can just remove the afRegister for this endpoint, you don't need it.

What sort of lock are you working on? I plan to make some kind of DIY ZigBee servo actuator for my deadbolt.

@presslab-us
Copy link
Contributor

This should fix it, please test and report back. a9654de

@smulikHakipod
Copy link
Contributor Author

Thanks for your help!!
I will report back ASAP.
About the door lock, the manufacture of doors here uses some unique mechanism that isn't compatible with any smart lock I found. I draw using OpenSCAD a plastic that wraps the around the key and I want the CC2530 to control it.

http://imgur.com/a/dlIDZ

@presslab-us
Copy link
Contributor

That is a strong looking gear motor, and your part looks very nice. Here are some of my DIY ZigBee efforts: https://groups.google.com/forum/#!topic/zigbee4java/nREaHiQW42s

@tlaukkan tlaukkan added the bug label Mar 28, 2015
@smulikHakipod
Copy link
Contributor Author

Your solution fixed the bug, many thanks!
As for the door lock, it looks like the zigbee4java does not implement the door lock device, so ZigbeeApi matches my door lock as Dimmable Light (working on fixing it now by adding DoorLockDevice?).

@presslab-us
Copy link
Contributor

Yes I have seen this too. If the device ID is not supported it seemingly picks a different one at random. Your device ID is 0x000A, yes?

You will need to add a door lock device 0x000A, the door lock cluster 0x0101, the cluster attributes 0-6, and the two lock/unlock cluster commands.

@smulikHakipod
Copy link
Contributor Author

I added the changes to my fork:
master...smulikHakipod:master
For now, really basic lock command and lock state.
Are the names and structure OK? Did I miss anything? Should I make a pull request?
thanks

@tlaukkan
Copy link
Owner

tlaukkan commented Apr 2, 2015

Hi

When you are happy with your code please make a pull request and we will review and merge it to master.

Best regards,
Tommi

@tlaukkan
Copy link
Owner

tlaukkan commented Apr 2, 2015

Nice work by the way and very useful.

@tlaukkan
Copy link
Owner

Thank you for the fix @presslab-us. 👍

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

No branches or pull requests

3 participants