feat: improve Symcon designer controls and KNX temperature selection
This commit is contained in:
1 parent
03e9eaa355
commit
6050bb7c88
8 files changed
+345
-271
No files matched your search
@@ -32,6 +32,7 @@ function IPS_GetVariable(int $id): array { return ['VariableType' => 2, 'Variabl
|
||||
function GetValue(int $id): float { return 21.5; }
|
||||
function GetValueFormatted(int $id): string { return '21,5 °C'; }
|
||||
function IPS_VariableProfileExists(string $profile): bool { return false; }
|
||||
function IPS_GetVariablePresentation(int $id): array { return []; }
|
||||
|
||||
require __DIR__ . '/../NextFloor/module.php';
|
||||
$module = new NextFloor();
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// Native Symcon 9 presentation metadata, with invented KNX values and no running server.
|
||||
class IPSModuleStrict {}
|
||||
$variables = [
|
||||
1 => ['VariableType' => 2, 'VariableAction' => 0],
|
||||
2 => ['VariableType' => 2, 'VariableAction' => 99],
|
||||
3 => ['VariableType' => 2, 'VariableProfile' => '~Temperature'],
|
||||
4 => ['VariableType' => 2, 'VariableProfile' => '~Temperature'],
|
||||
5 => ['VariableType' => 0, 'VariableAction' => 0]
|
||||
];
|
||||
$presentations = [1 => ['SUFFIX' => ' °C'], 2 => ['SUFFIX' => "\u{00A0}°C"], 3 => ['PROFILE' => '~Temperature'], 4 => ['SUFFIX' => ' W']];
|
||||
function IPS_GetVariable(int $id): array { global $variables; return $variables[$id] + ['VariableProfile' => '', 'VariableCustomProfile' => '', 'VariableAction' => 0, 'VariableCustomAction' => 0]; }
|
||||
function IPS_GetVariablePresentation(int $id): array { global $presentations; return $presentations[$id] ?? []; }
|
||||
function IPS_VariableProfileExists(string $profile): bool { return $profile === '~Temperature'; }
|
||||
function IPS_GetVariableProfile(string $profile): array { return ['Suffix' => ' °C']; }
|
||||
function GetValue(int $id): float|bool { return $id === 5 ? true : 21.75; }
|
||||
function GetValueFormatted(int $id): string { return $id === 5 ? 'An' : '21,75'; }
|
||||
|
||||
require __DIR__ . '/../NextFloor/module.php';
|
||||
$module = new NextFloor();
|
||||
$describe = new ReflectionMethod($module, 'describeVariable');
|
||||
function check(bool $condition, string $message): void { if (!$condition) throw new RuntimeException($message); }
|
||||
$plain = $describe->invoke($module, 1, 'Wert', 'Haus / Energie / KNX / Wert', 10);
|
||||
check($plain['attributes']['device_class'] === 'temperature', 'The presentation unit identifies a generically named KNX temperature');
|
||||
check($plain['attributes']['unit_of_measurement'] === '°C', 'The current presentation exports its unit without a legacy profile');
|
||||
$actuator = $describe->invoke($module, 2, 'Wert', 'Haus / KNX / Heizung / Wert', 10);
|
||||
check($actuator['entity_id'] === 'climate.2', 'Existing inferred entity IDs must stay stable');
|
||||
check($actuator['state'] === 'heat' && $actuator['attributes']['symcon_numeric_value'] === 21.75, 'The original numeric reading survives the actuator state conversion');
|
||||
check($actuator['attributes']['device_class'] === 'temperature', 'A nonbreaking space in the unit still identifies a temperature');
|
||||
$legacy = $describe->invoke($module, 3, 'Wert', 'Haus / KNX / Wert', 10);
|
||||
check($legacy['attributes']['unit_of_measurement'] === '°C', 'Legacy profile suffixes remain supported');
|
||||
$override = $describe->invoke($module, 4, 'Temperatur', 'Haus / Temperatur', 10);
|
||||
check($override['attributes']['unit_of_measurement'] === 'W' && $override['attributes']['device_class'] === 'power', 'The effective presentation overrides a stale legacy profile and ancestor names');
|
||||
$boolean = $describe->invoke($module, 5, 'Kontakt', 'Haus / Kontakt', 10);
|
||||
check(!isset($boolean['attributes']['symcon_numeric_value']), 'Boolean values are not advertised as numeric readings');
|
||||
echo "OK: Symcon 9 presentation units, KNX float readings, stable mappings and legacy profiles\n";
|
||||
Reference in new issue
Block a user