bewee / tuya-adapter

GNU General Public License v3.0
8 stars 8 forks source link

how to add new missing properties to a device? #9

Closed jcherrabi closed 3 years ago

jcherrabi commented 4 years ago

Hello there, thank you for creating and sharing this add on. i have the following questions please:

  1. can you please share links to docs or article on how to write a device file?
  2. where can one learn more on how to create compatible devices with the addon?

i have many tuya compatible devices and would like to start adding those to the list.. for example a camera, vacuum robot, plug with power statistics and so on...

cheers,

bewee commented 4 years ago

Hi,

Nice thing to hear :) Unfortunately there are no articles or docs. I guess best way to get started would be to have a look at the js files of devices that already exist (in lib/devices). The js files for properties are placed in the folder lib/properties; There you can find general purpose properties (directly in the root folder) as well as device specific properties (e.g. for the colour light). These scripts can basically use all features of NodeJS. In general, there are 3 places you have to make changes to in order to add a new device type:

On a more hardware level, each tuya device has certain dps channels (identified through numbers; simply set the device type of one of your devices to (empty) in the add-on settings in order to have a look at these). These usually represent a single property, e.g. on/off or brightness. The very basic goal of a device js is to map the properties to the right dps channels.

Best regards

bewee commented 4 years ago

plug with power statistics

has been added by #12

bewee commented 3 years ago

Created CONTRIBUTING.md. Closing this issue.