NEEOInc / neeo-sdk

NEEO Brain SDK
https://neeoinc.github.io/neeo-sdk/
MIT License
48 stars 17 forks source link

Typo/unclarity in readme.md #185

Open gvdhoven opened 5 years ago

gvdhoven commented 5 years ago
Updating device drivers
To tell the NEEO Brain about changes to your **device's components** you can simply change the driver version (.setDriverVersion). If you for example add new buttons to a device, you can increase the version and this will let the Brain know to fetch the new components.

And further:

**the name of a component** is used as an identifier for that **component**, changing it will result in it being added as a "new" **component** instead of the old one being updated

This should read "The name of a device", e.g. the .buildDevice('...') part?

pfiaux commented 5 years ago

By name of a component we mean something like BRIGHTNESS_SLIDER or BRIGHTNESS_SENSOR, that's what is used to identify that component if it has an update on a given device.

The name of the device isn't used during the component update process. It is used before that to identify the devices which have an update.

Here's a rough outline of the process:

  1. Device "MY_DEVICE" has version bumped to 2, we detect this and start the update for all "MY_DEVICE" devices added on the Brain
  2. All components are matched (existing device on Brain with current SDK definition) using the component name (for instance "BRIGHTNESS_SLIDER")
  3. The properties are updated as needed using the SDK values as new values.
gvdhoven commented 5 years ago

@pfiaux thanx, but how do i set the 'component' name in my own driver?

pfiaux commented 5 years ago

When you add the component, for example if you add a switch: https://neeoinc.github.io/neeo-sdk/#src-lib-models-devicebuilder.ts-addswitch

example-switch, and an example-switch_SENSOR might be automatically created under the hood as well.

Most components should have a name property.