Allow for different definition model, vendor and description based on whitelabel #5689
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Currently there is a lot of definition (code) duplication between different TuYa devices.
e.g. the Lidl HG06492B
zigbee-herdsman-converters/devices/lidl.js
Line 788 in 1413d09
is functionally the same as TuYa TS0502A
zigbee-herdsman-converters/devices/tuya.js
Line 1689 in 1413d09
but with a different
vendor
/description
/model
value. This is done in order to generate a separate supported device page (zigbee2mqtt.io) and to show the correct vendor/description/model and picture (since that is based on the model) in the logging/discovery and frontend.Solution
Override the definition model/vendor/description with the one from the whitelabel. To determine wether a whitelabel matches the device, the
fingerprint
property of the whitelabel is checked against the device. Thefingerprint
property is optional. This is because there are a lot of whitelabels already and we don't have all the information to define the missing fingerprints right now.