@zwave-js/cc
Advanced tools
Comparing version 11.9.0 to 11.9.1
@@ -116,3 +116,2 @@ /// <reference types="node" /> | ||
}>; | ||
export declare function getLifelineGroupIds(applHost: ZWaveApplicationHost, endpoint: IZWaveEndpoint): number[]; | ||
export declare class AssociationCCAPI extends PhysicalCCAPI { | ||
@@ -119,0 +118,0 @@ supportsCommand(cmd: AssociationCommand): MaybeNotKnown<boolean>; |
@@ -33,3 +33,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AssociationCCSupportedGroupingsGet = exports.AssociationCCSupportedGroupingsReport = exports.AssociationCCGet = exports.AssociationCCReport = exports.AssociationCCRemove = exports.AssociationCCSet = exports.AssociationCC = exports.AssociationCCAPI = exports.getLifelineGroupIds = exports.AssociationCCValues = void 0; | ||
exports.AssociationCCSupportedGroupingsGet = exports.AssociationCCSupportedGroupingsReport = exports.AssociationCCGet = exports.AssociationCCReport = exports.AssociationCCRemove = exports.AssociationCCSet = exports.AssociationCC = exports.AssociationCCAPI = exports.AssociationCCValues = void 0; | ||
function __assertType(argName, typeName, boundHasError) { | ||
@@ -116,35 +116,2 @@ const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core"); | ||
}); | ||
function getLifelineGroupIds(applHost, endpoint) { | ||
// For now only support this for the root endpoint - i.e. node | ||
if (endpoint.index > 0) | ||
return []; | ||
const node = endpoint; | ||
// Some nodes define multiple lifeline groups, so we need to assign us to | ||
// all of them | ||
const lifelineGroups = []; | ||
// If the target node supports Z-Wave+ info that means the lifeline MUST be group #1 | ||
if (endpoint.supportsCC(safe_1.CommandClasses["Z-Wave Plus Info"])) { | ||
lifelineGroups.push(1); | ||
} | ||
// We have a device config file that tells us which (additional) association to assign | ||
let associations; | ||
const deviceConfig = applHost.getDeviceConfig?.(node.id); | ||
if (endpoint.index === 0) { | ||
// The root endpoint's associations may be configured separately or as part of "endpoints" | ||
associations = | ||
deviceConfig?.associations ?? | ||
deviceConfig?.endpoints?.get(0)?.associations; | ||
} | ||
else { | ||
// The other endpoints can only have a configuration as part of "endpoints" | ||
associations = deviceConfig?.endpoints?.get(endpoint.index)?.associations; | ||
} | ||
if (associations?.size) { | ||
lifelineGroups.push(...[...associations.values()] | ||
.filter((a) => a.isLifeline) | ||
.map((a) => a.groupId)); | ||
} | ||
return (0, arrays_1.distinct)(lifelineGroups).sort(); | ||
} | ||
exports.getLifelineGroupIds = getLifelineGroupIds; | ||
// @noSetValueAPI | ||
@@ -151,0 +118,0 @@ let AssociationCCAPI = exports.AssociationCCAPI = class AssociationCCAPI extends API_1.PhysicalCCAPI { |
@@ -69,2 +69,3 @@ /// <reference types="node" /> | ||
private ciphertext?; | ||
private plaintext?; | ||
readonly verifyDelivery: boolean; | ||
@@ -71,0 +72,0 @@ private _sequenceNumber; |
@@ -1,2 +0,2 @@ | ||
import { CommandClasses, type IZWaveEndpoint, type IZWaveNode } from "@zwave-js/core/safe"; | ||
import { CommandClasses, type IZWaveEndpoint, type IZWaveNode, type MaybeNotKnown } from "@zwave-js/core/safe"; | ||
import type { ZWaveApplicationHost } from "@zwave-js/host/safe"; | ||
@@ -12,4 +12,6 @@ import { type ReadonlyObjectKeyMap } from "@zwave-js/shared/safe"; | ||
export declare function removeAssociations(applHost: ZWaveApplicationHost, endpoint: IZWaveEndpoint, group: number, destinations: AssociationAddress[]): Promise<void>; | ||
export declare function getLifelineGroupIds(applHost: ZWaveApplicationHost, endpoint: IZWaveEndpoint): number[]; | ||
export declare function configureLifelineAssociations(applHost: ZWaveApplicationHost, endpoint: IZWaveEndpoint): Promise<void>; | ||
export declare function assignLifelineIssueingCommand(applHost: ZWaveApplicationHost, endpoint: IZWaveEndpoint, ccId: CommandClasses, ccCommand: number): Promise<void>; | ||
export declare function doesAnyLifelineSendActuatorOrSensorReports(applHost: ZWaveApplicationHost, node: IZWaveNode): MaybeNotKnown<boolean>; | ||
//# sourceMappingURL=utils.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.assignLifelineIssueingCommand = exports.configureLifelineAssociations = exports.removeAssociations = exports.addAssociations = exports.getAllAssociationGroups = exports.getAssociationGroups = exports.isAssociationAllowed = exports.getAllAssociations = exports.getAssociations = void 0; | ||
exports.doesAnyLifelineSendActuatorOrSensorReports = exports.assignLifelineIssueingCommand = exports.configureLifelineAssociations = exports.getLifelineGroupIds = exports.removeAssociations = exports.addAssociations = exports.getAllAssociationGroups = exports.getAssociationGroups = exports.isAssociationAllowed = exports.getAllAssociations = exports.getAssociations = void 0; | ||
const safe_1 = require("@zwave-js/core/safe"); | ||
@@ -343,2 +343,35 @@ const safe_2 = require("@zwave-js/shared/safe"); | ||
exports.removeAssociations = removeAssociations; | ||
function getLifelineGroupIds(applHost, endpoint) { | ||
// For now only support this for the root endpoint - i.e. node | ||
if (endpoint.index > 0) | ||
return []; | ||
const node = endpoint; | ||
// Some nodes define multiple lifeline groups, so we need to assign us to | ||
// all of them | ||
const lifelineGroups = []; | ||
// If the target node supports Z-Wave+ info that means the lifeline MUST be group #1 | ||
if (endpoint.supportsCC(safe_1.CommandClasses["Z-Wave Plus Info"])) { | ||
lifelineGroups.push(1); | ||
} | ||
// We have a device config file that tells us which (additional) association to assign | ||
let associations; | ||
const deviceConfig = applHost.getDeviceConfig?.(node.id); | ||
if (endpoint.index === 0) { | ||
// The root endpoint's associations may be configured separately or as part of "endpoints" | ||
associations = | ||
deviceConfig?.associations ?? | ||
deviceConfig?.endpoints?.get(0)?.associations; | ||
} | ||
else { | ||
// The other endpoints can only have a configuration as part of "endpoints" | ||
associations = deviceConfig?.endpoints?.get(endpoint.index)?.associations; | ||
} | ||
if (associations?.size) { | ||
lifelineGroups.push(...[...associations.values()] | ||
.filter((a) => a.isLifeline) | ||
.map((a) => a.groupId)); | ||
} | ||
return (0, arrays_1.distinct)(lifelineGroups).sort(); | ||
} | ||
exports.getLifelineGroupIds = getLifelineGroupIds; | ||
async function configureLifelineAssociations(applHost, endpoint) { | ||
@@ -364,3 +397,3 @@ // Assign the controller to all lifeline groups | ||
} | ||
const lifelineGroups = (0, AssociationCC_1.getLifelineGroupIds)(applHost, node); | ||
const lifelineGroups = getLifelineGroupIds(applHost, node); | ||
if (lifelineGroups.length === 0) { | ||
@@ -753,2 +786,31 @@ // We can look for the General Lifeline AGI profile as a last resort | ||
exports.assignLifelineIssueingCommand = assignLifelineIssueingCommand; | ||
function doesAnyLifelineSendActuatorOrSensorReports(applHost, node) { | ||
// No association support means no unsolicited reports | ||
if (!node.supportsCC(safe_1.CommandClasses.Association) && | ||
!node.supportsCC(safe_1.CommandClasses["Multi Channel Association"])) { | ||
return false; | ||
} | ||
// No AGI support means we cannot know | ||
if (!node.supportsCC(safe_1.CommandClasses["Association Group Information"])) { | ||
return safe_1.NOT_KNOWN; | ||
} | ||
// Lifeline group IDs include the ones we added via a config file, so they may not be considered true lifelines | ||
const lifelineGroupIds = getLifelineGroupIds(applHost, node); | ||
// If any potential lifeline group has the "General: Lifeline" profile, the node MUST send unsolicited reports that way | ||
if (lifelineGroupIds.some((id) => AssociationGroupInfoCC_1.AssociationGroupInfoCC.getGroupProfileCached(applHost, node, id) === _Types_1.AssociationGroupInfoProfile["General: Lifeline"])) { | ||
return true; | ||
} | ||
// Otherwise check if any of the groups sends any actuator or sensor commands. We'll assume that those are reports | ||
for (const groupId of lifelineGroupIds) { | ||
const issuedCommands = AssociationGroupInfoCC_1.AssociationGroupInfoCC.getIssuedCommandsCached(applHost, node, groupId); | ||
if (!issuedCommands) | ||
continue; | ||
const commands = [...issuedCommands.keys()]; | ||
if (commands.some((c) => (0, safe_1.isActuatorCC)(c) || (0, safe_1.isSensorCC)(c))) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
exports.doesAnyLifelineSendActuatorOrSensorReports = doesAnyLifelineSendActuatorOrSensorReports; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@zwave-js/cc", | ||
"version": "11.9.0", | ||
"version": "11.9.1", | ||
"description": "zwave-js: Command Classes", | ||
@@ -66,5 +66,5 @@ "keywords": [], | ||
"dependencies": { | ||
"@zwave-js/core": "11.9.0", | ||
"@zwave-js/host": "11.9.0", | ||
"@zwave-js/serial": "11.9.0", | ||
"@zwave-js/core": "11.9.1", | ||
"@zwave-js/host": "11.9.1", | ||
"@zwave-js/serial": "11.9.1", | ||
"@zwave-js/shared": "11.8.0", | ||
@@ -79,4 +79,4 @@ "alcalzone-shared": "^4.0.8", | ||
"@types/node": "^14.18.52", | ||
"@zwave-js/maintenance": "11.9.0", | ||
"@zwave-js/testing": "11.9.0", | ||
"@zwave-js/maintenance": "11.9.1", | ||
"@zwave-js/testing": "11.9.1", | ||
"@zwave-js/transformers": "11.3.0", | ||
@@ -83,0 +83,0 @@ "ava": "^4.3.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4153384
57804
+ Added@zwave-js/config@11.9.1(transitive)
+ Added@zwave-js/core@11.9.1(transitive)
+ Added@zwave-js/host@11.9.1(transitive)
+ Added@zwave-js/serial@11.9.1(transitive)
- Removed@zwave-js/config@11.9.0(transitive)
- Removed@zwave-js/core@11.9.0(transitive)
- Removed@zwave-js/host@11.9.0(transitive)
- Removed@zwave-js/serial@11.9.0(transitive)
Updated@zwave-js/core@11.9.1
Updated@zwave-js/host@11.9.1
Updated@zwave-js/serial@11.9.1