mirror of
https://github.com/koush/scrypted.git
synced 2026-02-03 14:13:28 +00:00
zwave: allow manual entry (#239)
This commit is contained in:
@@ -21,6 +21,8 @@ export class SettingsToConfiguration extends ZwaveDeviceBase implements Settings
|
||||
setting.description = metadata.description;
|
||||
if ((metadata as any).states)
|
||||
setting.choices = Object.values((metadata as any).states);
|
||||
if ((metadata as any).allowManualEntry)
|
||||
setting.combobox = true;
|
||||
const value = node.getValue(valueId) as any;
|
||||
setting.value = setting.choices?.[value] || value;
|
||||
settings.push(setting);
|
||||
@@ -38,7 +40,9 @@ export class SettingsToConfiguration extends ZwaveDeviceBase implements Settings
|
||||
const node = this.instance.getNodeUnsafe();
|
||||
const metadata = node.getValueMetadata(valueId);
|
||||
if ((metadata as any).states) {
|
||||
value = Object.entries((metadata as any).states).find(([, v]) => v === value)?.[0];
|
||||
const stateValue = Object.entries((metadata as any).states).find(([, v]) => v === value)?.[0];
|
||||
if (stateValue)
|
||||
value = stateValue
|
||||
}
|
||||
if (metadata.type === 'number')
|
||||
value = parseInt(value);
|
||||
|
||||
Reference in New Issue
Block a user