How do I know which device z/ip messages come from?


#1

I got the reference_listener working and with a plug I receive the following bytes:

23 02 00 D0 14 00 00 05 84 02 80 00 25 03 FF/00

Removing the z/ip parts of the message results in:

25 03 FF/00

which is:

COMMAND_CLASS_SWITCH_BINARY SWITCH_BINARY_REPORT ON/OFF

All ok so far, but how do I know which device reported the on/off? Can I somehow tell the zipgateway to include that information?

Thanks in advance
/Olle


#2

Hi,

The source information (who send the frame) is only included in the UDP package encapsulating the Z/IP Cmd. The source information is not included in the Z/IP Cmd directly.

BR
Carsten


#3

Hi,

Since you refer to the reference_listener, you’ll be relying on libzwaveip. As Carsten mentionedthe source is only exposed by virtue of the source address in IP header of the UDP packet. This information isn’t provided directly in the application command callback, but is accessible from the zconnection handle passed in that callback.

  1. Use the the zconnection_get_remote_addr(…) function to get the remote IP address from the zconnection.
  2. Create a ZIPND,ZIP_NODE_SOLICITATION frame populated with the IP address and send it to ZipGw. The response will contain the node Id.

The example listener code doesn’t do this.

Also the ZIP ND commands cannot be encapsulated in ZIP_PACKET frames, and therefore cannot be sent via the libzwaveip code. You need to open your own plain UDP socket (no encryption needed) send the packet and wait for a response. It’s a shame the support isn’t in libzwaveip for this, but its not complicated to write (even doing timeouts and retries). I believe there was an issue opened on libzwaveip regarding this omission.

Regards,
Barry.


#4

Thanks both of you!

That explains it, I thought the gateway was the IP sender, but it is just relaying the upd message.

I just think it is a bit weird that you don’t get the sender in the z/ip protocol but have to go to the underlying protocol for that, makes it harder to move the protocol on another stack (but then it is named z/IP so I guess that kind of hard coded to use IP)

Thanks
Olle
PS I wasn’t actually using the reference_listener (I have a trivial Java listener), but I got the same bytes from that one and the reference_listener.