Skip to content

Commit

Permalink
region_id, presence_event, monitoring_mode, approach_distance, reset_…
Browse files Browse the repository at this point in the history
…nopresence_status hinzugefügt
  • Loading branch information
Schnittcher committed Nov 7, 2023
1 parent 4a56077 commit 90e997d
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 3 deletions.
20 changes: 18 additions & 2 deletions Device/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,13 @@
"Energy": "Energie",
"Enrolled": "Enrolled",
"Error": "Fehler",
"Enter": "Enter",
"Leave": "Verlassen",
"Left Enter": "Links Enter",
"Right Leave": "Rechts Verlassen",
"Right Enter": "Rechts Enter",
"Left Leave": "Links Verlassen",
"Approach": "Näherung",
"Excellent": "Exzellent",
"Exit Delay": "Ausschaltverzögerung",
"External Measured Room Sensor": "Extern gemessener Raumfühler",
Expand Down Expand Up @@ -446,6 +453,8 @@
"OU": "OU",
"Out of range": "Außer Reichweite",
"Overload Protection": "Überspannungschutz",
"Undirected": "Ungerichtet",
"Left/Right": "Links/Rechts",
"Painted Sky": "Gemalter Himmel",
"Palm Beach": "Palmenstrand",
"Parlour": "Salon",
Expand All @@ -469,6 +478,7 @@
"Preheat Status": "Vorheizstatus",
"Presence": "Anwesendheit",
"Presence State": "Präsenz Status",
"Presence Event": "Präsenz Ereignis",
"Presence Sensitivity": "Erkennungsempfindlichkeit",
"Present": "Anwesend",
"Preset": "Default",
Expand All @@ -490,6 +500,7 @@
"Radar Scene": "Radar Szene",
"Radar Sensitivity": "Radar Empfindlichkeit",
"Radiator Covered": "Heizkörper verkleidet",
"Region id": "Region id",
"Regulation Setpoint Offset": "Regelsollwert-Offset",
"Release 1 and 3": "Freigabe 1 und 3",
"Release 1": "Freigabe 1",
Expand Down Expand Up @@ -656,7 +667,12 @@
"Winter Mountain": "Winterberg",
"Learned IR Code": "Gelernter IR-Code",
"IR Code to send": "IR-Code zum Senden",
"Quadruple": "Vierfaches"
"Quadruple": "Vierfaches",
"Approach Distance": "Annäherungsabstand",
"Reset Nopresence Status": "Nopräsenz-Status zurücksetzen",
"Reset": "Reset",
"Far": "Weit",
"Near": "Reset"
}
}
}
}
109 changes: 108 additions & 1 deletion libs/Zigbee2MQTTHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ public function RequestAction($Ident, $Value)
case 'Z2M_DeviceMode':
$Payload['device_mode'] = $Value;
break;
case 'Z2M_MonitoringMode':
$Payload['monitoring_mode'] = $Value;
break;
case 'Z2M_ApproachDistance':
$Payload['approach_distance'] = $Value;
break;
case 'Z2M_ResetNopresenceStatus':
$Payload['reset_nopresence_status'] = $Value;
break;
case 'Z2M_ScaleProtection':
$Payload['scale_protection'] = strval($this->OnOff($Value));
break;
Expand Down Expand Up @@ -511,6 +520,9 @@ public function RequestAction($Ident, $Value)
case 'Z2M_MotorSpeed':
$Payload['motor_speed'] = strval($Value);
break;
case 'Z2M_RegionID':
$Payload['region_id'] = strval($Value);
break;
case 'Z2M_MotionSensitivity':
$Payload['motion_sensitivity'] = strval($Value);
break;
Expand Down Expand Up @@ -661,12 +673,24 @@ public function ReceiveData($JSONString)
if (array_key_exists('presence_state', $Payload)) {
$this->SetValue('Z2M_PresenceState', $Payload['presence_state']);
}
if (array_key_exists('presence_event', $Payload)) {
$this->SetValue('Z2M_PresenceEvent', $Payload['presence_event']);
}
if (array_key_exists('action_zone', $Payload)) {
$this->SetValue('Z2M_ActionZone', $Payload['action_zone']);
}
if (array_key_exists('device_mode', $Payload)) {
$this->SetValue('Z2M_DeviceMode', $Payload['device_mode']);
}
if (array_key_exists('monitoring_mode', $Payload)) {
$this->SetValue('Z2M_MonitoringMode', $Payload['monitoring_mode']);
}
if (array_key_exists('approach_distance', $Payload)) {
$this->SetValue('Z2M_ApproachDistance', $Payload['approach_distance']);
}
if (array_key_exists('reset_nopresence_status', $Payload)) {
$this->SetValue('Z2M_ResetNopresenceStatus', $Payload['reset_nopresence_status']);
}
if (array_key_exists('scale_protection', $Payload)) {
switch ($Payload['scale_protection']) {
case 'ON':
Expand Down Expand Up @@ -1209,6 +1233,10 @@ public function ReceiveData($JSONString)
$this->SetValue('Z2M_MotorSpeed', $Payload['motor_speed']);
}

if (array_key_exists('region_id', $Payload)) {
$this->SetValue('Z2M_RegionID', $Payload['region_id']);
}

if (array_key_exists('occupancy', $Payload)) {
$this->SetValue('Z2M_Occupancy', $Payload['occupancy']);
}
Expand Down Expand Up @@ -2346,7 +2374,45 @@ private function registerVariableProfile($expose)
]);
}
break;
case 'Z2M.device_mode.':
case 'Z2M.presence_event.ef1acb4c':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [
['enter', $this->Translate('Enter'), '', 0xFF0000],
['leave', $this->Translate('Leave'), '', 0x00FF00],
['left_enter', $this->Translate('Left Enter'), '', 0x00FF00],
['right_leave', $this->Translate('Right Leave'), '', 0x00FF00],
['right_enter', $this->Translate('Right Enter'), '', 0x00FF00],
['left_leave', $this->Translate('Left Leave'), '', 0x00FF00],
['approach', $this->Translate('Approach'), '', 0x00FF00],
['Sway', $this->Translate('Left Enter'), '', 0x00FF00],
]);
}
break;
case 'Z2M.monitoring_mode.45923aef':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [
['undirected', $this->Translate('Undirected'), '', 0xFF0000],
['left_right', $this->Translate('Left/Right'), '', 0x00FF00],
]);
}
break;
case 'Z2M.approach_distance.a1fc888b':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [
['far', $this->Translate('Far'), '', 0xFF0000],
['medium', $this->Translate('Medium'), '', 0x00FF00],
['near', $this->Translate('Near'), '', 0x00FF00],
]);
}
break;
case 'Z2M.reset_nopresence_status':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [
['', $this->Translate('Reset'), '', 0xFF0000]
]);
}
break;
case 'Z2M.device_mode.e8eb408':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [
['single_rocker', $this->Translate('Single Rocker'), '', 0xFF0000],
Expand Down Expand Up @@ -3910,6 +3976,13 @@ private function registerVariableProfile($expose)
$this->RegisterProfileInteger($ProfileName, 'Clock', '', ' ', $expose['value_min'], $expose['value_max'], 0);
}
break;
case 'region_id':
$ProfileName .= $expose['value_min'] . '_' . $expose['value_max'];
$ProfileName = str_replace(',', '.', $ProfileName);
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileInteger($ProfileName, 'IPS', '', ' ', $expose['value_min'], $expose['value_max'], 0);
}
break;
case 'action_duration':
case 'action_transition_time':
$ProfileName .= '_' . $expose['unit'];
Expand Down Expand Up @@ -4753,6 +4826,33 @@ private function mapExposesToVariables(array $exposes)
$this->RegisterVariableString('Z2M_PresenceState', $this->Translate('Presence State'), $ProfileName);
}
break;
case 'presence_event':
$ProfileName = $this->registerVariableProfile($expose);
if ($ProfileName != false) {
$this->RegisterVariableString('Z2M_PresenceEvent', $this->Translate('Presence Event'), $ProfileName);
}
break;
case 'monitoring_mode':
$ProfileName = $this->registerVariableProfile($expose);
if ($ProfileName != false) {
$this->RegisterVariableString('Z2M_MonitoringMode', $this->Translate('Monitoring Mode'), $ProfileName);
$this->EnableAction('Z2M_MonitoringMode');
}
break;
case 'approach_distance':
$ProfileName = $this->registerVariableProfile($expose);
if ($ProfileName != false) {
$this->RegisterVariableString('Z2M_ApproachDistance', $this->Translate('Approach Distance'), $ProfileName);
$this->EnableAction('Z2M_ApproachDistance');
}
break;
case 'reset_nopresence_status':
$ProfileName = $this->registerVariableProfile($expose);
if ($ProfileName != false) {
$this->RegisterVariableString('Z2M_ResetNopresenceStatus', $this->Translate('Reset Nopresence Status'), $ProfileName);
$this->EnableAction('Z2M_ResetNopresenceStatus');
}
break;
case 'device_mode':
$ProfileName = $this->registerVariableProfile($expose);
if ($ProfileName != false) {
Expand Down Expand Up @@ -5766,6 +5866,13 @@ private function mapExposesToVariables(array $exposes)
$this->RegisterVariableInteger('Z2M_MotorSpeed', $this->Translate('Motor Speed'), '~Intensity.255');
$this->EnableAction('Z2M_MotorSpeed');
break;
case 'region_id':
$ProfileName = $this->registerVariableProfile($feature);
if ($ProfileName != false) {
$this->RegisterVariableInteger('Z2M_RegionID', $this->Translate('Region id'), $ProfileName);
}
$this->EnableAction('Z2M_RegionID');
break;
default:
// Default composite binary
$missedVariables['composite'][] = $feature;
Expand Down

0 comments on commit 90e997d

Please sign in to comment.