Zigbee device plugin mechanism with commands ZbLoad
, ZbUnload
and ZbLoadDump
#16252
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.
Description
This is a major new feature for Zigbee2Tasmota.
From the start, Z2T design was to stick to a low-level view and provide higher level (named) attributes only for a limited set of mostly seen attributes. This raised difficulties and frustration for users with specific devices that use rare attributes, or devices that use non-standard attributes (like Tuya zigbee devices).
We are now providing a Zigbee Device plugin mechanisms, using simple text files. These files specify mapping on a per-device type basis. The goal is to fill most of the gap with Zigbee2MQTT (provided that you write the device plugin files). The lightweight nature of plugins permits to load only the plugins required by the devices used, and does not require a sowftare update for new devices.
How does it works?
You simply copy device plugin files (externsion
*.zb
) in the file system and they are automatically loaded at start.You can dynamically load new files with
ZbLoad <file>.zb
or unload definitions withZbUnload <file>.zb
. When you reload a file with the same name, it is first unloaded.At Zigbee start, all files with
*.zb
suffix are loaded into memory. Be careful of not saturating memory, especially on ESP8266.Zigbee devide plugin format
Zigbee device plugin have the following format:
#Z2Tv1
on the first line#
is a marker for comments, and everything from#
to end of line is ignoreddevice matchers
modelId
andmanufacturerId
. If a field is empty, it matches all values:<modelId>,<manufacturerId>
:TS0601,_TZE200_sh1btabb
for GiEX water valveattribute matcher specifies a cluster/attribute/type tuple and matches an attribute name
<cluster 4 hex>/<attribute 4 hex>
or<cluster 4 hex>/attribute 4 hex>%<type 2 hex>
EF00/0365,IrrigationStartTime
(Tuya cluster EF00 does not need an explicit type)0006/4001%bool,OnTime
attribute synonyms specifies that a received attribute is a synonym for another attribute
<cluster 4 hex>/<attribute 4 hex>=<new_cluster 4 hex>/<new_attribute 4 hex>,<multiplier>
EF00/026C=0001/0021,2
converts any EFOO/026C attribute received to0001/0021
(BatteryPercentage) and multiplies by2
to convert to ZCL standard.Multiplier is 8 bit int (-128..127). If
0
or1
, the value is unchanged. Otherwize the value is converted tofloat
and is multiplied bymultiplier
if positive, or divided by-multiplier
if negative.I.e.
multiplier=10
means multiply by 10,multiplier=-5
means divide by 5Also included
Refactoring of attributes matching engine to allow plugins and device-specific mappings.
Coming next
Checklist:
NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass