Alignment

master
Kuba Orlik 3 months ago
parent bd181ba7ed
commit 03fca52345

@ -31,7 +31,9 @@ type State = {
async function with_unit(s: HA_RESPONSE | Promise<HA_RESPONSE>) { async function with_unit(s: HA_RESPONSE | Promise<HA_RESPONSE>) {
s = await s; s = await s;
return `${s.state}${s.attributes.unit_of_measurement as string}`; return `${parseFloat(s.state).toFixed(1)}${
s.attributes.unit_of_measurement as string
}`;
} }
async function arrow(entity: string) { async function arrow(entity: string) {
@ -69,8 +71,8 @@ export default new (class DashboardPage extends StatefulPage<State, typeof actio
<td style="text-align: right">Temperatura na balkonie:</td> <td style="text-align: right">Temperatura na balkonie:</td>
<td> <td>
<strong> <strong>
{with_unit(get_state("input_number.balkon_average"))}
{arrow("sensor.balkon_temperature_derivative")} {arrow("sensor.balkon_temperature_derivative")}
{with_unit(get_state("input_number.balkon_average"))}
</strong> </strong>
</td> </td>
</tr> </tr>
@ -78,10 +80,10 @@ export default new (class DashboardPage extends StatefulPage<State, typeof actio
<td style="text-align: right">Temperatura w salonie:</td> <td style="text-align: right">Temperatura w salonie:</td>
<td> <td>
<strong> <strong>
{arrow("sensor.temperatura_w_salonie_derivative")}
{with_unit( {with_unit(
get_state("sensor.ewelink_th01_temperature") get_state("sensor.ewelink_th01_temperature")
)} )}
{arrow("sensor.temperatura_w_salonie_derivative")}
</strong> </strong>
</td> </td>
</tr> </tr>
@ -97,8 +99,8 @@ export default new (class DashboardPage extends StatefulPage<State, typeof actio
<td style="text-align: right">Temperatura na strychu</td> <td style="text-align: right">Temperatura na strychu</td>
<td> <td>
<strong> <strong>
{with_unit(get_state("sensor.strych_temperature_3"))}
{arrow("sensor.strych_temperature_derivative")} {arrow("sensor.strych_temperature_derivative")}
{with_unit(get_state("sensor.strych_temperature_3"))}
</strong> </strong>
</td> </td>
</tr> </tr>

Loading…
Cancel
Save