Skip to content

Commit

Permalink
Merge pull request #195 from Burki24/patch-3
Browse files Browse the repository at this point in the history
ADD: Exposes, FIX: $Profilename -> $ProfilName
  • Loading branch information
Schnittcher authored Aug 3, 2024
2 parents 7e309b9 + 114bd26 commit 4832d3f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 10 deletions.
7 changes: 7 additions & 0 deletions Device/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"Action angle": "Aktionswinkel",
"Action Code": "Aktions Code",
"Action Color Temperature": "Aktion Farbtemperatur",
"Action Direction": "Aktionsrichtung",
"Action Duration": "Aktionsdauer",
"Action from side": "Aktion von der Seite",
"Action Group": "Aktionsgruppe",
Expand All @@ -27,6 +28,8 @@
"Action to side": "Aktion zur Seite",
"Action Transaction": "Aktion Transaktion",
"Action Transition Time": "Aktion Übergangszeit",
"Action Type": "Aktionsart",
"Action Time": "Aktionszeit",
"Action Zone": "Aktionsbereich",
"Action": "Aktion",
"Adaptation Run Control": "Anpassungslaufsteuerung",
Expand Down Expand Up @@ -426,6 +429,7 @@
"Led Indication": "LED-Anzeige",
"LED Indicator": "LED-Anzeige",
"Leave": "Verlassen",
"Left": "Links",
"Left Leave": "Links Verlassen",
"Left Enter": "Links Enter",
"Left Hold": "Links Halten",
Expand Down Expand Up @@ -652,6 +656,7 @@
"Resplendent": "Strahlend",
"Restore Reports": "Restore Reports",
"restore": "Wiederherstellen",
"Right": "Rechts",
"Right Enter": "Rechts Enter",
"Right Hold": "Rechts Halten",
"Right Hold Release": "Rechts Halten Beendet",
Expand All @@ -660,6 +665,7 @@
"Right Press Release": "Rechts Gedrückt Beendet",
"Rio": "Rio",
"Rosy Sparkle": "Rosiger Glanz",
"Rotate": "Drehen",
"Rotate Left": "Links drehen",
"Rotate Right": "Rechts drehen",
"Rotate Stop": "Drehen anhalten",
Expand Down Expand Up @@ -739,6 +745,7 @@
"State Right": "Status rechts",
"State White": "Status Weiß",
"State": "Status",
"Step": "Schritt",
"Stop": "Stop",
"Stop Effect": "Effekt beenden",
"Stop Colorloop": "Farbverlauf stoppen",
Expand Down
46 changes: 36 additions & 10 deletions libs/Zigbee2MQTTHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,15 @@ public function ReceiveData($JSONString)
$this->RegisterVariableInteger('Z2M_LastSeen', $this->Translate('Last Seen'), '~UnixTimestamp');
$this->SetValue('Z2M_LastSeen', ($Payload['last_seen'] / 1000));
}
if (array_key_exists('action_type', $Payload)) {
$this->SetValue('Z2M_ActionType', $Payload['action_type']);
}
if (array_key_exists('action_time', $Payload)) {
$this->SetValue('Z2M_ActionTime', $Payload['action_time']);
}
if (array_key_exists('action_direction', $Payload)) {
$this->SetValue('Z2M_ActionDirection', $Payload['action_direction']);
}
if (array_key_exists('device_fault', $Payload)) {
$this->handleStateChange('device_fault', 'Z2M_DeviceFault', 'Device Fault', $Payload);
}
Expand Down Expand Up @@ -2580,6 +2589,22 @@ private function registerVariableProfile($expose)
$ProfileName .= '.';
$ProfileName .= dechex(crc32($tmpProfileName));
switch ($ProfileName) {
case 'Z2M.action_type':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [
['step', $this->Translate('Step'), '', 0x00FF00],
['rotate', $this->Translate('Rotate'), '', 0x00FF00],
]);
}
break;
case 'Z2M.action_direction':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [
['left', $this->Translate('Left'), '', 0x00FF00],
['right', $this->Translate('Right'), '', 0x00FF00],
]);
}
break;
case 'Z2M.identify.12619917':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileStringEx($ProfileName, 'Identify', '', '', [
Expand Down Expand Up @@ -4697,6 +4722,7 @@ private function registerVariableProfile($expose)
}
break;
case 'occupancy_timeout':
case 'action_time':
$ProfileName .= $expose['value_min'] . '_' . $expose['value_max'];
$ProfileName = str_replace(',', '.', $ProfileName);
if (!IPS_VariableProfileExists($ProfileName)) {
Expand Down Expand Up @@ -6932,32 +6958,32 @@ private function mapExposesToVariables(array $exposes)
}
break;
case 'action_rate':
$Profilename = $this->registerVariableProfile($expose);
if ($Profilename != false) {
$ProfileName = $this->registerVariableProfile($expose);
if ($ProfileName != false) {
$this->RegisterVariableInteger('Z2M_ActionRate', $this->Translate('Action Rate'), $ProfileName);
}
break;
case 'action_step_size':
$Profilename = $this->registerVariableProfile($expose);
if ($Profilename != false) {
$ProfileName = $this->registerVariableProfile($expose);
if ($ProfileName != false) {
$this->RegisterVariableInteger('Z2M_ActionStepSize', $this->Translate('Action Step Size'), $ProfileName);
}
break;
case 'action_transition_time':
$Profilename = $this->registerVariableProfile($expose);
if ($Profilename != false) {
$ProfileName = $this->registerVariableProfile($expose);
if ($ProfileName != false) {
$this->RegisterVariableInteger('Z2M_ActionTransTime', $this->Translate('Action Transition Time'), $ProfileName);
}
break;
case 'action_group':
$Profilename = $this->registerVariableProfile($expose);
if ($Profilename != false) {
$ProfileName = $this->registerVariableProfile($expose);
if ($ProfileName != false) {
$this->RegisterVariableInteger('Z2M_ActionGroup', $this->Translate('Action Group'), $ProfileName);
}
break;
case 'action_color_temperature':
$Profilename = $this->registerVariableProfile($expose);
if ($Profilename != false) {
$ProfileName = $this->registerVariableProfile($expose);
if ($ProfileName != false) {
$this->RegisterVariableInteger('Z2M_ActionColorTemp', $this->Translate('Action Color Temperature'), $ProfileName);
}
break;
Expand Down

0 comments on commit 4832d3f

Please sign in to comment.