Skip to content

Commit

Permalink
rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
farmio committed Aug 14, 2023
1 parent e7005d8 commit 734faa7
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions src/views/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export class KNXSettingsView extends LitElement {
<ha-card class="knx-info" .header=${"Connection"}>
<div class="card-content knx-info-section">
${this.connectionSettingsCardContent()}
<!-- TODO: remove -->
${Object.entries(this.newConnectionData).map(
([key, val]) => html`
<div class="knx-content-row">
Expand All @@ -217,6 +218,15 @@ export class KNXSettingsView extends LitElement {
<ha-card class="knx-info" .header=${"Integration settings"}>
<div class="card-content knx-info-section">
${this.integrationSettingsCardContent()}
<!-- TODO: remove -->
${Object.entries(this.newSettingsData).map(
([key, val]) => html`
<div class="knx-content-row">
<div>${key}</div>
<div>${val}</div>
</div>
`,
)}
</div>
<div class="card-actions">
<ha-progress-button
Expand Down Expand Up @@ -267,13 +277,28 @@ export class KNXSettingsView extends LitElement {
}

private integrationSettingsCardContent(): TemplateResult {
return html` <ha-selector
.hass=${this.hass}
.label=${"Telegram log size"}
.selector=${{ number: { min: 0, max: 5000, step: 1, unit_of_measurement: "telegrams" } }}
.value=${this.newSettingsData.telegram_log_size}
@value-changed=${this._updateIntegrationSetting("telegram_log_size")}
></ha-selector>`;
return html`<ha-selector
.hass=${this.hass}
.label=${"Telegram log size"}
.selector=${{ number: { min: 0, max: 5000, step: 1, unit_of_measurement: "telegrams" } }}
.value=${this.newSettingsData.telegram_log_size}
@value-changed=${this._updateIntegrationSetting("telegram_log_size")}
></ha-selector>
${this._advanecedIntegrationSettings()}`;
}

private _advanecedIntegrationSettings() {
return this.hass.userData?.showAdvanced
? html`<ha-selector
.hass=${this.hass}
.label=${"Rate limit"}
.selector=${{
number: { min: 0, max: 50, step: 1, unit_of_measurement: "telegrams / second" },
}}
.value=${this.newSettingsData.rate_limit}
@value-changed=${this._updateIntegrationSetting("rate_limit")}
></ha-selector>`
: nothing;
}

protected _mainConnectionTypeFromInfoData(): ConnectionMainType {
Expand Down

0 comments on commit 734faa7

Please sign in to comment.