Skip to content
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

fix!: Remove permit_join_timeout #25082

Merged
merged 7 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/extension/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,8 @@ export default class Bridge extends Extension {
channel: networkParams.channel,
},
log_level: logger.getLevel(),
permit_join_timeout: this.zigbee.getPermitJoinTimeout(),
permit_join: this.zigbee.getPermitJoin(),
permit_join_end: this.zigbee.getPermitJoinEnd(),
restart_required: this.restartRequired,
config,
config_schema: settings.schemaJson,
Expand Down
14 changes: 0 additions & 14 deletions lib/extension/homeassistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2014,20 +2014,6 @@ export default class HomeAssistant extends Extension {
json_attributes_template: '{{ value_json.data.value | tojson }}',
},
},
{
type: 'sensor',
object_id: 'permit_join_timeout',
mockProperties: [],
discovery_payload: {
name: 'Permit join timeout',
device_class: 'duration',
unit_of_measurement: 's',
entity_category: 'diagnostic',
state_topic: true,
state_topic_postfix: 'info',
value_template: '{{ iif(value_json.permit_join_timeout is defined, value_json.permit_join_timeout, None) }}',
},
},

// Switches.
{
Expand Down
3 changes: 2 additions & 1 deletion lib/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ export interface Zigbee2MQTTAPI {
channel: number;
};
log_level: 'debug' | 'info' | 'warning' | 'error';
permit_join_timeout: number;
permit_join: boolean;
permit_join_end: number | undefined;
restart_required: boolean;
config: Settings;
config_schema: typeof schemaJson;
Expand Down
8 changes: 6 additions & 2 deletions lib/zigbee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,12 @@ export default class Zigbee {
logger.info('Stopped zigbee-herdsman');
}

getPermitJoinTimeout(): number {
return this.herdsman.getPermitJoinTimeout();
getPermitJoin(): boolean {
return this.herdsman.getPermitJoin();
}

getPermitJoinEnd(): number | undefined {
return this.herdsman.getPermitJoinEnd();
}

async permitJoin(time: number, device?: Device): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"winston-syslog": "^2.7.1",
"winston-transport": "^4.9.0",
"ws": "^8.18.0",
"zigbee-herdsman": "3.0.1",
"zigbee-herdsman": "3.0.2",
"zigbee-herdsman-converters": "21.2.1",
"zigbee2mqtt-frontend": "0.9.0"
},
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion test/extensions/bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ describe('Extension: Bridge', () => {
coordinator: {ieee_address: '0x00124b00120144ae', meta: {revision: 20190425, version: 1}, type: 'z-Stack'},
log_level: 'info',
network: {channel: 15, extended_pan_id: 0x001122, pan_id: 5674},
permit_join_timeout: 0,
permit_join: false,
permit_join_end: undefined,
restart_required: false,
version: version.version,
zigbee_herdsman: zhVersion,
Expand Down
20 changes: 0 additions & 20 deletions test/extensions/homeassistant.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2389,26 +2389,6 @@ describe('Extension: HomeAssistant', () => {
{retain: true, qos: 1},
);

payload = {
name: 'Permit join timeout',
object_id: 'zigbee2mqtt_bridge_permit_join_timeout',
entity_category: 'diagnostic',
device_class: 'duration',
unit_of_measurement: 's',
unique_id: 'bridge_0x00124b00120144ae_permit_join_timeout_zigbee2mqtt',
state_topic: 'zigbee2mqtt/bridge/info',
value_template: '{{ iif(value_json.permit_join_timeout is defined, value_json.permit_join_timeout, None) }}',
origin: origin,
device: devicePayload,
availability: [{topic: 'zigbee2mqtt/bridge/state', value_template: '{{ value_json.state }}'}],
availability_mode: 'all',
};
expect(mockMQTT.publishAsync).toHaveBeenCalledWith(
'homeassistant/sensor/1221051039810110150109113116116_0x00124b00120144ae/permit_join_timeout/config',
stringify(payload),
{retain: true, qos: 1},
);

// Switches.
payload = {
name: 'Permit join',
Expand Down
3 changes: 2 additions & 1 deletion test/mocks/zigbeeHerdsman.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,8 @@ export const mockController = {
touchlinkFactoryResetFirst: jest.fn(),
addInstallCode: jest.fn(),
permitJoin: jest.fn(),
getPermitJoinTimeout: jest.fn((): number => 0),
getPermitJoin: jest.fn((): boolean => false),
getPermitJoinEnd: jest.fn((): number | undefined => undefined),
isStopping: jest.fn((): boolean => false),
backup: jest.fn(),
coordinatorCheck: jest.fn(),
Expand Down
Loading