tomoyuki-nakabayashi / echonet-lite-rs

Apache License 2.0
21 stars 6 forks source link

SingleFunctionLighting Support #39

Open marcelocf opened 1 year ago

marcelocf commented 1 year ago

https://github.com/marcelocf/echonet-lite-rs/issues/1 was created to this in my fork where I am doing this work.

Story

As a developer, I want to be able to identify and configure SingleFunctionLighting devices.

Details

These lights usually support features such as brightness and operation status. The implementation is over when I am able to tell if a sobj is one of such lights or not. Actual control and property handling is out of the scope of this story.

tomoyuki-nakabayashi commented 1 year ago

You can use Self-node instance list property (EPC is 0xD6) to discover lighting devices in the local area network and Identification number property (EPC is 0x83) to identify the device. Both of properties are defined in Node Profile Class.

So, discovery sequence should:

  1. send broadcast get to Node Profile Class (recommended EPCs are 0x80 and 0xD6)
  2. if Self-node instance list (0xD6) has lighting class, then send a unicast get to the lighting device's Node Profile Class to know the Identification number
  3. store the Identification number and IP address that you want to control

With DHCP, sometimes the IP address that the device has might be changed, so we should refresh the IP address by doting step 1 & 2.

marcelocf commented 1 year ago

Thank you @tomoyuki-nakabayashi . Do you think it would make sense to add discovery code to this library?

tomoyuki-nakabayashi commented 1 year ago

Yes, it makes sense. Now, I plan to restructure this repository to consists of some crates like;

  1. serde-echonet-lite
  2. echonet-lite-middleware
  3. a crate for creating application
  4. tools

The discovery code will be categorized to 3 or 4. But currently, I welcome to add the discovery code into echonet-lite crate.