Skip to content

Commit

Permalink
Webui small fixes (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
anatoly-savchenkov authored Aug 14, 2022
1 parent f28c61a commit 5dbaa4a
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions v2/esp-entity-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ export class EntityTable extends LitElement {
type="${entity.mode == 1 ? "number" : "range"}"
name="${entity.unique_id}"
id="${entity.unique_id}"
value="${value}"
step="${step}"
min="${min}"
max="${max}"
value="${value}"
@change="${(e: Event) => {
let val = e.target?.value;
this.restAction(entity, `${action}?${opt}=${val}`);
Expand Down Expand Up @@ -189,7 +189,7 @@ export class EntityTable extends LitElement {
if (entity.domain === "climate") {
let target_temp_slider, target_temp_label;
if (entity.target_temperature_low !== undefined) {
target_temp_label= html`${entity.target_temperature_low} .. ${entity.target_temperature_high}`;
target_temp_label= html`${entity.target_temperature_low} .. ${entity.target_temperature_high}`;
target_temp_slider = html`
${this.range(
entity,
Expand All @@ -198,8 +198,7 @@ export class EntityTable extends LitElement {
entity.target_temperature_low,
entity.min_temp,
entity.max_temp,
entity.step,
0
entity.step
)}
${this.range(
entity,
Expand All @@ -208,8 +207,7 @@ export class EntityTable extends LitElement {
entity.target_temperature_high,
entity.min_temp,
entity.max_temp,
entity.step,
0
entity.step
)}
`;
} else {
Expand All @@ -222,25 +220,23 @@ export class EntityTable extends LitElement {
entity.target_temperature,
entity.min_temp,
entity.max_temp,
entity.step,
0
entity.step
)}
`;
}
return html`
<label>Current: ${entity.current_temperature}, &nbsp;Target: ${target_temp_label}</label>
<label>Current:&nbsp;${entity.current_temperature}, Target:&nbsp;${target_temp_label}</label>
${target_temp_slider}
<br /><label
>Mode:
${entity.modes.map(
(mode) => html`
<input type="radio" name="${entity.unique_id}_mode" @change="${(e: Event) => {
let val = e.target?.value;
this.restAction(entity, `set?mode=${val}`);
}}"
value="${mode}" ?checked=${entity.mode === mode}>${mode}</input> `
)}
</label>
<br />Mode:
${entity.modes.map(
(mode) => html`
<label><input type="radio" name="${entity.unique_id}_mode" @change="${(e: Event) => {
let val = e.target?.value;
this.restAction(entity, `set?mode=${val}`);
}}"
value="${mode}" ?checked=${entity.mode === mode}>${mode}</label>`
)
}
`;
}
return html``;
Expand Down

0 comments on commit 5dbaa4a

Please sign in to comment.