feat: add floating room climate cards and fix Symcon humidity selection
This commit is contained in:
1 parent
24188f96f7
commit
ff54f4461a
21 files changed
+764
-398
No files matched your search
@@ -429,7 +429,7 @@ class NextFloor extends IPSModuleStrict
|
||||
'symcon_variable_type' => (int) $variable['VariableType'],
|
||||
'symcon_has_action' => ((int) ($variable['VariableCustomAction'] ?: $variable['VariableAction'])) !== 0,
|
||||
'symcon_formatted' => GetValueFormatted($variableID),
|
||||
'device_class' => $this->deviceClassFor($profile, $name . ' ' . $path, $unit)
|
||||
'device_class' => $this->deviceClassFor($profile, $name, $unit)
|
||||
];
|
||||
if ($unit !== '') {
|
||||
$attributes['unit_of_measurement'] = $unit;
|
||||
@@ -539,7 +539,7 @@ class NextFloor extends IPSModuleStrict
|
||||
|
||||
private function deviceClassFor(string $profile, string $haystack, string $unit = ''): string
|
||||
{
|
||||
$text = mb_strtolower($profile . ' ' . $haystack);
|
||||
$text = str_replace('co₂', 'co2', mb_strtolower($profile . ' ' . $haystack));
|
||||
$unitClass = match (preg_replace('/[\s\x{00A0}]+/u', '', mb_strtolower($unit))) {
|
||||
'°c', '°f', '℃', '℉', 'k' => 'temperature',
|
||||
'ppm' => str_contains($text, 'co2') || str_contains($text, 'co₂') ? 'carbon_dioxide' : '',
|
||||
@@ -551,7 +551,7 @@ class NextFloor extends IPSModuleStrict
|
||||
}
|
||||
return match (true) {
|
||||
str_contains($text, 'temperature') || str_contains($text, 'temperatur') => 'temperature',
|
||||
str_contains($text, 'humidity') || str_contains($text, 'feuchte') => 'humidity',
|
||||
str_contains($text, 'humidity') || str_contains($text, 'feucht') => 'humidity',
|
||||
str_contains($text, 'co2') => 'carbon_dioxide',
|
||||
str_contains($text, 'watt') || str_contains($text, 'power') || str_contains($text, 'leistung') => 'power',
|
||||
preg_match('/kontakt|fenster|tür|tuer|motion|bewegung|presence|anwesen/', $text) === 1 => 'opening',
|
||||
|
||||
Reference in new issue
Block a user