mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 01:06:35 +00:00
Fix Ascii not updating properly and code length limited to current code length (#1577)
This commit is contained in:
parent
00b1fbe091
commit
488e6d09ca
@ -48,7 +48,7 @@ class ZwaveUsercodes extends PolymerElement {
|
|||||||
label="User code"
|
label="User code"
|
||||||
type="text"
|
type="text"
|
||||||
allowed-pattern="[0-9,a-f,x,\\\\]"
|
allowed-pattern="[0-9,a-f,x,\\\\]"
|
||||||
maxlength="{{_userCodeMaxLen}}"
|
maxlength="40"
|
||||||
minlength="16" value="{{_selectedUserCodeValue}}">
|
minlength="16" value="{{_selectedUserCodeValue}}">
|
||||||
</paper-input>
|
</paper-input>
|
||||||
<pre>Ascii: [[_computedCodeOutput]]</pre>
|
<pre>Ascii: [[_computedCodeOutput]]</pre>
|
||||||
@ -88,11 +88,6 @@ class ZwaveUsercodes extends PolymerElement {
|
|||||||
|
|
||||||
userCodes: Object,
|
userCodes: Object,
|
||||||
|
|
||||||
_userCodeMaxLen: {
|
|
||||||
type: Number,
|
|
||||||
value: 4
|
|
||||||
},
|
|
||||||
|
|
||||||
_selectedUserCode: {
|
_selectedUserCode: {
|
||||||
type: Number,
|
type: Number,
|
||||||
value: -1,
|
value: -1,
|
||||||
@ -134,9 +129,8 @@ class ZwaveUsercodes extends PolymerElement {
|
|||||||
if (this._selectedUserCode === -1 || selectedUserCode === -1) return;
|
if (this._selectedUserCode === -1 || selectedUserCode === -1) return;
|
||||||
const value = this.userCodes[selectedUserCode].value.code;
|
const value = this.userCodes[selectedUserCode].value.code;
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
_userCodeMaxLen: (this.userCodes[selectedUserCode].value.length * 4),
|
|
||||||
_selectedUserCodeValue: this._a2hex(value),
|
_selectedUserCodeValue: this._a2hex(value),
|
||||||
_computedCodeOutput: `[${this._hex2a(this._selectedUserCodeValue)}]`
|
_computedCodeOutput: `[${this._hex2a(this._a2hex(value))}]`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,11 +162,11 @@ class ZwaveUsercodes extends PolymerElement {
|
|||||||
const userCodeData = await this.hass.callApi('GET', `zwave/usercodes/${this.nodes[selectedNode].attributes.node_id}`);
|
const userCodeData = await this.hass.callApi('GET', `zwave/usercodes/${this.nodes[selectedNode].attributes.node_id}`);
|
||||||
Object.keys(userCodeData).forEach((key) => {
|
Object.keys(userCodeData).forEach((key) => {
|
||||||
userCodes.push({
|
userCodes.push({
|
||||||
key: key,
|
key,
|
||||||
value: userCodeData[key],
|
value: userCodeData[key],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.setProperties({ userCodes: userCodeData });
|
this.setProperties({ userCodes: userCodes });
|
||||||
this._selectedUserCodeChanged(this._selectedUserCode);
|
this._selectedUserCodeChanged(this._selectedUserCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user