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

ADD: permit_join_time #200

Merged
merged 7 commits into from
Aug 12, 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
5 changes: 3 additions & 2 deletions Bridge/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"Wrong last_seen setting in Zigbee2MQTT. Please set last_seen to epoch.": "Falsche Einstellung für last_seen in Zigbee2MQTT. Bitte last_seen auf epoch einstellen.",
"Symcon Extension in Zigbee2MQTT is outdated. Please update the extension.": "Symcon Erweiterung in Zigbee2MQTT ist veraltet. Bitte Erweiterung updaten.",
"No Symcon Extension in Zigbee2MQTT installed. Please install the extension.": "Symcon Erweiterung in Zigebee2MQTT nicht installiert. Bitte die Erweiterung installieren.",
"Extension Loaded": "Erweiterung geladen"
"Extension Loaded": "Erweiterung geladen",
"Permit Join Timeout": "Restzeit Netzwerk geöffnet"
}
}
}
}
18 changes: 17 additions & 1 deletion Bridge/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function ApplyChanges()
['info', $this->Translate('Information'), '', 0x00FF00],
['debug', $this->Translate('Debug'), '', 0x00FF00],
]);
$this->RegisterProfileInteger('Z2M.seconds', '', '', ' s', 0, 0, 1, 0);
$this->RegisterVariableBoolean('state', $this->Translate('State'));
$this->RegisterVariableBoolean('extension_loaded', $this->Translate('Extension Loaded'));
$this->RegisterVariableString('extension_version', $this->Translate('Extension Version'));
Expand All @@ -76,10 +77,13 @@ public function ApplyChanges()
$this->EnableAction('log_level');
$this->RegisterVariableBoolean('permit_join', $this->Translate('Allow joining the network'), '~Switch');
$this->EnableAction('permit_join');
$this->RegisterVariableInteger('permit_join_timeout', $this->Translate('Permit Join Timeout'), 'Z2M.seconds');
$this->RegisterVariableBoolean('restart_required', $this->Translate('Restart Required'));
$this->RegisterVariableInteger('restart_request', $this->Translate('Perform a restart'), 'Z2M.bridge.restart');
$this->EnableAction('restart_request');
$this->RegisterVariableString('version', $this->Translate('Version'));
$this->RegisterVariableString('zigbee_herdsman_converters', $this->Translate('Zigbee Herdsman Converters Version'));
$this->RegisterVariableString('zigbee_herdsman', $this->Translate('Zigbee Herdsman Version'));
$this->RegisterVariableInteger('network_channel', $this->Translate('Network Channel'));
}

Expand Down Expand Up @@ -129,13 +133,25 @@ public function ReceiveData($JSONString)
}
if (isset($Payload['permit_join'])) {
$this->SetValue('permit_join', $Payload['permit_join']);
if ($Payload['permit_join'] === false) {
$this->SetValue('permit_join_timeout', 0);
}
}
if (isset($Payload['permit_join_timeout'])) {
$this->SetValue('permit_join_timeout', $Payload['permit_join_timeout']);
}
if (isset($Payload['restart_required'])) {
$this->SetValue('restart_required', $Payload['restart_required']);
}
if (isset($Payload['version'])) {
$this->SetValue('version', $Payload['version']);
}
if (isset($Payload['zigbee_herdsman_converters']['version'])) {
$this->SetValue('zigbee_herdsman_converters', $Payload['zigbee_herdsman_converters']['version']);
}
if (isset($Payload['zigbee_herdsman']['version'])) {
$this->SetValue('zigbee_herdsman', $Payload['zigbee_herdsman']['version']);
}
if (isset($Payload['config']['advanced']['last_seen'])) {
$this->SendDebug('last_seen', $Payload['config']['advanced']['last_seen'], 0);
$this->ConfigLastSeen = $Payload['config']['advanced']['last_seen'];
Expand Down Expand Up @@ -239,7 +255,7 @@ public function SetLastSeen()
public function SetPermitJoin(bool $PermitJoin)
{
$Topic = '/bridge/request/permit_join';
$Payload = ['value'=>$PermitJoin];
$Payload = ['value'=>$PermitJoin, 'time'=> 254];
$Result = $this->SendData($Topic, $Payload);
if ($Result) { //todo check the Response
return true;
Expand Down
Loading