Skip to content

Commit

Permalink
Matter add controller's Vendor Name to logs and UI (#18794)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored Jun 4, 2023
1 parent 2423392 commit 31b93f8
Show file tree
Hide file tree
Showing 9 changed files with 1,788 additions and 934 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.

### Added
- Matter ability to add or remove endpoint in bridge mode (code only)
- Matter add controller's Vendor Name to logs and UI

### Breaking Changed

Expand Down
92 changes: 92 additions & 0 deletions lib/libesp32/berry_matter/generate/be_matter_vendors.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*********************************************************************************\
* List of Matter Vendors
* From: https://on.dcl.csa-iot.org/dcl/vendorinfo/vendors
*
* Generated content, do not edit
\*********************************************************************************/
#include <stddef.h>
#include <stdint.h>

typedef struct {
uint16_t id;
const char* name;
} matter_vendor_t;

const matter_vendor_t matter_Vendors[] = {

{ 0x100B, "Signify"},
{ 0x101D, "Assa Abloy"},
{ 0x1021, "Legrand Group"},
{ 0x1037, "NXP Semiconductors"},
{ 0x105E, "Schneider"},
{ 0x109B, "Leviton"},
{ 0x10D0, "Qorvo"},
{ 0x10EE, "UEI"},
{ 0x10F2, "ubisys"},
{ 0x111D, "Comcast Communications"},
{ 0x115A, "Nanoleaf"},
{ 0x115F, "Aqara"},
{ 0x1160, "Sengled"},
{ 0x1168, "Leedarson"},
{ 0x117E, "Feibit"},
{ 0x1188, "TP-Link"},
{ 0x118C, "Midea Group"},
{ 0x120B, "HEIMAN"},
{ 0x1217, "Amazon Alexa"},
{ 0x1219, "ORVIBO"},
{ 0x125D, "Tuya"},
{ 0x127F, "Nordic Semiconductor ASA"},
{ 0x1280, "Siterwell"},
{ 0x1286, "CoolKit"},
{ 0x128F, "EGLO"},
{ 0x130A, "Eve"},
{ 0x130D, "BouffaloLab"},
{ 0x1312, "Yeelight"},
{ 0x131B, "Espressif Systems"},
{ 0x131E, "CAME S.p.A."},
{ 0x131F, "Longan.link"},
{ 0x1321, "SONOFF"},
{ 0x1333, "Becker Antriebe"},
{ 0x1339, "GE Lighting, a Savant company"},
{ 0x133F, "ASR"},
{ 0x1342, "Beken Corporation"},
{ 0x1344, "Eltako"},
{ 0x1345, "Meross"},
{ 0x1346, "Rafael"},
{ 0x1349, "Apple Home"},
{ 0x134E, "tado"},
{ 0x134F, "mediola"},
{ 0x1351, "HooRii Technology"},
{ 0x135D, "Nuki"},
{ 0x1362, "deveritec GmbH"},
{ 0x1365, "Dooya"},
{ 0x136E, "Ambi Labs Limited"},
{ 0x1371, "Tridonic"},
{ 0x1372, "innovation matters"},
{ 0x137F, "NEO"},
{ 0x1381, "Amazon Prime Video"},
{ 0x1384, "Apple Keychain"},
{ 0x1386, "Skylux"},
{ 0x1387, "Qianyan"},
{ 0x138A, "Nature"},
{ 0x1391, "Kasa"},
{ 0x1392, "Tapo"},
{ 0x1397, "SwitchBot"},
{ 0x139C, "Zemismart Technology Limited"},
{ 0x1400, "Uascent"},
{ 0x1403, "Arlec Australia"},
{ 0x1404, "Phaten"},
{ 0x1407, "ThirdReality"},
{ 0x1410, "Quectel"},
{ 0x1413, "1Home"},
{ 0x1415, "Caveman"},
{ 0x1419, "Lorex"},
{ 0x141B, "Rang Dong VN"},
{ 0x141E, "TUO Accessories LLC"},
{ 0x141F, "Ductech"},
{ 0x142D, "QH"},
{ 0x142F, "QIACHIP"},
{ 0x6006, "Google LLC"},

{ 0xFFFF, NULL },
};
12 changes: 12 additions & 0 deletions lib/libesp32/berry_matter/src/be_matter_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ extern const bclass be_class_Matter_QRCode;

#include "../generate/be_matter_clusters.h"
#include "../generate/be_matter_opcodes.h"
#include "../generate/be_matter_vendors.h"

const char* matter_get_vendor_name(uint16_t id) {
for (const matter_vendor_t * vnd = matter_Vendors; vnd->id != 0xFFFF; vnd++) {
if (vnd->id == id) {
return vnd->name;
}
}
return NULL;
}
BE_FUNC_CTYPE_DECLARE(matter_get_vendor_name, "s", "i")

const char* matter_get_cluster_name(uint16_t cluster) {
for (const matter_cluster_t * cl = matterAllClusters; cl->id != 0xFFFF; cl++) {
Expand Down Expand Up @@ -253,6 +264,7 @@ module matter (scope: global, strings: weak) {
member, closure(matter_member_closure)
get_ip_bytes, ctype_func(matter_get_ip_bytes)
get_vendor_name, ctype_func(matter_get_vendor_name)
get_cluster_name, ctype_func(matter_get_cluster_name)
get_attribute_name, ctype_func(matter_get_attribute_name)
is_attribute_writable, ctype_func(matter_is_attribute_writable)
Expand Down
14 changes: 13 additions & 1 deletion lib/libesp32/berry_matter/src/embedded/Matter_Fabric.be
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ class Matter_Fabric : Matter_Expirable
def get_ca() return self.root_ca_certificate end
def get_fabric_index() return self.fabric_index end

def get_admin_vendor_name()
var vnd = self.admin_vendor
if vnd == nil return "" end
var name = matter.get_vendor_name(vnd)
if name != nil
return name
else
import string
return string.format("0x%04X", vnd)
end
end

def set_fabric_index(v) self.fabric_index = v end
def set_ca(ca)
self.root_ca_certificate = ca
Expand Down Expand Up @@ -205,7 +217,7 @@ class Matter_Fabric : Matter_Expirable
# Called before removal
def log_new_fabric()
import string
tasmota.log(string.format("MTR: +Fabric fab='%s' vendorid=0x%04X", self.get_fabric_id().copy().reverse().tohex(), self.admin_vendor), 2)
tasmota.log(string.format("MTR: +Fabric fab='%s' vendorid=%s", self.get_fabric_id().copy().reverse().tohex(), self.get_admin_vendor_name()), 2)
end

#############################################################
Expand Down
2 changes: 1 addition & 1 deletion lib/libesp32/berry_matter/src/embedded/Matter_UI.be
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Matter_UI
if !label label = "<No label>" end
label = webserver.html_escape(label) # protect against HTML injection

webserver.content_send(string.format("<fieldset><legend><b>&nbsp;#%i %s</b> (0x%04X)&nbsp;</legend><p></p>", f.get_fabric_index(), label, f.get_admin_vendor()))
webserver.content_send(string.format("<fieldset><legend><b>&nbsp;#%i %s</b> (%s)&nbsp;</legend><p></p>", f.get_fabric_index(), label, f.get_admin_vendor_name()))

var fabric_rev = f.get_fabric_id().copy().reverse()
var deviceid_rev = f.get_device_id().copy().reverse()
Expand Down
Loading

0 comments on commit 31b93f8

Please sign in to comment.