Skip to content

Commit

Permalink
Merge pull request #200 from Burki24/patch-5
Browse files Browse the repository at this point in the history
ADD: permit_join_time
  • Loading branch information
Schnittcher authored Aug 12, 2024
2 parents 8197959 + 1802a31 commit c079eee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
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

0 comments on commit c079eee

Please sign in to comment.