-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read status on SIN-4-FP-21_EQU #25333
Cannot read status on SIN-4-FP-21_EQU #25333
Comments
The issue seems to come from Koenkk/zigbee-herdsman@7316247#diff-bc89a730c378c181a37d00497b5e8bf42f3bc8da7224200964770ce2edd1d6ecR41-R68 New code will match cluster Previous code: function getClusterDefinition(
key: string | number,
manufacturerCode: number | null,
customClusters: CustomClusters,
): {name: string, cluster: ClusterDefinition} {
let name: string;
const clusters: CustomClusters = {
...customClusters, // Custom clusters have a higher priority than Zcl clusters (custom cluster has a DIFFERENT name than Zcl clusters)
...Clusters,
...customClusters, // Custom clusters should override Zcl clusters (custom cluster has the SAME name than Zcl clusters)
};
if (typeof key === 'number') {
if (manufacturerCode) {
name = Object.entries(clusters)
.find((e) => e[1].ID === key && e[1].manufacturerCode === manufacturerCode)?.[0];
}
if (!name) {
name = Object.entries(clusters).find((e) => e[1].ID === key && !e[1].manufacturerCode)?.[0];
}
if (!name) {
name = Object.entries(clusters).find((e) => e[1].ID === key)?.[0];
}
} else {
name = key;
}
let cluster = clusters[name];
if (!cluster) {
if (typeof key === 'number') {
name = key.toString();
cluster = {attributes: {}, commands: {}, commandsResponse: {}, manufacturerCode: null, ID: key};
} else {
throw new Error(`Cluster with name '${key}' does not exist`);
}
}
return {name, cluster};
} New code: function findClusterNameByID(id: number, manufacturerCode: number | null, clusters: CustomClusters): [name: string, partialMatch: boolean] {
let name: string;
// if manufacturer code is given, consider partial match if didn't match against manufacturer code
let partialMatch: boolean = (manufacturerCode != null);
for (const clusterName in clusters) {
const cluster = clusters[clusterName as ClusterName];
if (cluster.ID === id) {
// priority on first match when matching only ID
/* istanbul ignore else */
if (name == undefined) {
name = clusterName;
}
if (manufacturerCode && (cluster.manufacturerCode === manufacturerCode)) {
name = clusterName;
partialMatch = false;
break;
} else if (!cluster.manufacturerCode) {
name = clusterName;
break;
}
}
}
return [name, partialMatch];
}
function getClusterDefinition(key: string | number, manufacturerCode: number | null, customClusters: CustomClusters)
: {name: string, cluster: ClusterDefinition} {
let name: string;
if (typeof key === 'number') {
let partialMatch: boolean;
// custom clusters have priority over Zcl clusters, except in case of better match (see below)
[name, partialMatch] = findClusterNameByID(key, manufacturerCode, customClusters);
if (!name) {
[name, partialMatch] = findClusterNameByID(key, manufacturerCode, Clusters);
} else if (partialMatch) {
let zclName: string;
[zclName, partialMatch] = findClusterNameByID(key, manufacturerCode, Clusters);
// Zcl clusters contain a better match, use that one
if (zclName != undefined && !partialMatch) {
name = zclName;
}
}
} else {
name = key;
}
let cluster = (name != undefined) && hasCustomClusters(customClusters) ?
{
...Clusters[name as ClusterName],
...customClusters[name],// should override Zcl clusters
}
: Clusters[name as ClusterName];
if (!cluster) {
if (typeof key === 'number') {
name = key.toString();
cluster = {attributes: {}, commands: {}, commandsResponse: {}, manufacturerCode: null, ID: key};
} else {
throw new Error(`Cluster with name '${key}' does not exist`);
}
}
return {name, cluster};
} The old code will match cluster without manufacturerCode only after testing all cluster with manufacturerCode. function findClusterNameByID(id: number, manufacturerCode: number | null, clusters: CustomClusters): [name: string, partialMatch: boolean] {
let name: string;
// if manufacturer code is given, consider partial match if didn't match against manufacturer code
let partialMatch: boolean = (manufacturerCode != null);
for (const clusterName in clusters) {
const cluster = clusters[clusterName as ClusterName];
if (cluster.ID === id) {
// priority on first match when matching only ID
/* istanbul ignore else */
if (name == undefined) {
name = clusterName;
}
if (manufacturerCode && (cluster.manufacturerCode === manufacturerCode)) {
name = clusterName;
partialMatch = false;
break;
} else if (!cluster.manufacturerCode) {
name = clusterName;
- break;
}
}
}
return [name, partialMatch];
} |
Previous logic stopped on the first cluster with no manufacturerCode. Fixes Koenkk/zigbee2mqtt#25333
Moved the cluster and zigbee parsers to dedicated file to avoid confusion with manuSpecificAssaDoorLock in findClusterNameById. Affect: SIN-4-FP-20, SIN-4-FP-21, SIN-4-FP-21_EQU Fixes Koenkk/zigbee2mqtt#25333
What happened?
After upgrade from 1.36.1 to 1.42.0 zigbe2mqtt is unable to read the pilot wire mode of SIN-4-FP-21_EQU.
What did you expect to happen?
No response
How to reproduce it (minimal and precise)
In device settings, disable "optimistic" mode. Change the pilot wire mode.
The physical device will change mode, but the reported mode won't change.
Zigbee2MQTT version
1.42.0
Adapter firmware version
20210708
Adapter
Sonoff Zigbee 3.0 USB Dongle Plus
Setup
add-on on home assistant on a raspbery pi
Debug log
The text was updated successfully, but these errors were encountered: