Vanding: flyt smart-knap under sidst vandet; mere plads til liter/tid-kort
This commit is contained in:
@@ -499,72 +499,78 @@ cards:
|
|||||||
|
|
||||||
- type: custom:button-card
|
- type: custom:button-card
|
||||||
entity: sensor.vanding_liter_i_dag_total
|
entity: sensor.vanding_liter_i_dag_total
|
||||||
icon: mdi:water
|
show_icon: false
|
||||||
show_icon: true
|
show_name: false
|
||||||
show_name: true
|
show_state: false
|
||||||
show_state: true
|
|
||||||
name: Liter i dag
|
|
||||||
tap_action:
|
tap_action:
|
||||||
action: none
|
action: none
|
||||||
hold_action:
|
hold_action:
|
||||||
action: none
|
action: none
|
||||||
custom_fields:
|
custom_fields:
|
||||||
breakdown: |
|
info: |
|
||||||
[[[
|
[[[
|
||||||
const n = (id) => { const s = states[id]; return s ? Math.round(parseFloat(s.state) || 0) : 0; };
|
const n = (id) => { const s = states[id]; return s ? Math.round(parseFloat(s.state) || 0) : 0; };
|
||||||
return `Ærter ${n('sensor.vanding_liter_hb1')} · Kart. ${n('sensor.vanding_liter_hb2')} · Rab. ${n('sensor.vanding_liter_hb3')}`
|
const total = n('sensor.vanding_liter_i_dag_total');
|
||||||
+ `<br>Drivhus ${n('sensor.vanding_liter_drivhus')} · Kapillær ${n('sensor.vanding_liter_kapillaer')}`;
|
const rows = [
|
||||||
|
['Ærter', n('sensor.vanding_liter_hb1')],
|
||||||
|
['Kartofler', n('sensor.vanding_liter_hb2')],
|
||||||
|
['Rabarber', n('sensor.vanding_liter_hb3')],
|
||||||
|
['Drivhus', n('sensor.vanding_liter_drivhus')],
|
||||||
|
['Kapillær', n('sensor.vanding_liter_kapillaer')],
|
||||||
|
];
|
||||||
|
const list = rows.map(r => `<div style="display:flex;justify-content:space-between;gap:6px"><span>${r[0]}</span><span style="font-variant-numeric:tabular-nums">${r[1]}</span></div>`).join('');
|
||||||
|
return `<div style="display:flex;flex-direction:column;width:100%;text-align:left">
|
||||||
|
<div style="font-size:11px;color:var(--secondary-text-color)">Liter i dag</div>
|
||||||
|
<div style="font-size:20px;font-weight:bold;line-height:1.1;margin:1px 0 4px">${total} L</div>
|
||||||
|
<div style="font-size:10.5px;color:var(--secondary-text-color);line-height:1.5">${list}</div>
|
||||||
|
</div>`;
|
||||||
]]]
|
]]]
|
||||||
styles:
|
styles:
|
||||||
card:
|
card:
|
||||||
- padding: 8px
|
- padding: 10px
|
||||||
name:
|
grid:
|
||||||
- font-size: 11px
|
- grid-template-areas: '"info"'
|
||||||
- color: var(--secondary-text-color)
|
|
||||||
state:
|
|
||||||
- font-size: 15px
|
|
||||||
- font-weight: bold
|
|
||||||
custom_fields:
|
custom_fields:
|
||||||
breakdown:
|
info:
|
||||||
- font-size: 9px
|
- width: 100%
|
||||||
- color: var(--secondary-text-color)
|
|
||||||
- padding-top: 3px
|
|
||||||
- line-height: 1.3
|
|
||||||
|
|
||||||
- type: custom:button-card
|
- type: custom:button-card
|
||||||
entity: sensor.vanding_tid_i_dag_total
|
entity: sensor.vanding_tid_i_dag_total
|
||||||
icon: mdi:timer-sand
|
show_icon: false
|
||||||
show_icon: true
|
show_name: false
|
||||||
show_name: true
|
show_state: false
|
||||||
show_state: true
|
|
||||||
name: Tid i dag
|
|
||||||
tap_action:
|
tap_action:
|
||||||
action: none
|
action: none
|
||||||
hold_action:
|
hold_action:
|
||||||
action: none
|
action: none
|
||||||
custom_fields:
|
custom_fields:
|
||||||
breakdown: |
|
info: |
|
||||||
[[[
|
[[[
|
||||||
const m = (id) => { const s = states[id]; return s ? Math.round((parseFloat(s.state) || 0) * 60) : 0; };
|
const m = (id) => { const s = states[id]; return s ? Math.round((parseFloat(s.state) || 0) * 60) : 0; };
|
||||||
const cap = () => { const s = states['sensor.vanding_kapillaer_tid_i_dag']; return s ? Math.round(parseFloat(s.state) || 0) : 0; };
|
const cap = () => { const s = states['sensor.vanding_kapillaer_tid_i_dag']; return s ? Math.round(parseFloat(s.state) || 0) : 0; };
|
||||||
return `Ærter ${m('sensor.vanding_hojbed_1_i_dag')} · Kart. ${m('sensor.vanding_hojbed_2_i_dag')} · Rab. ${m('sensor.vanding_hojbed_3_i_dag')}`
|
const total = (() => { const s = states['sensor.vanding_tid_i_dag_total']; return s ? Math.round(parseFloat(s.state) || 0) : 0; })();
|
||||||
+ `<br>Drivhus ${m('sensor.vanding_drivhus_i_dag')} · Kapillær ${cap()}`;
|
const rows = [
|
||||||
|
['Ærter', m('sensor.vanding_hojbed_1_i_dag')],
|
||||||
|
['Kartofler', m('sensor.vanding_hojbed_2_i_dag')],
|
||||||
|
['Rabarber', m('sensor.vanding_hojbed_3_i_dag')],
|
||||||
|
['Drivhus', m('sensor.vanding_drivhus_i_dag')],
|
||||||
|
['Kapillær', cap()],
|
||||||
|
];
|
||||||
|
const list = rows.map(r => `<div style="display:flex;justify-content:space-between;gap:6px"><span>${r[0]}</span><span style="font-variant-numeric:tabular-nums">${r[1]} min</span></div>`).join('');
|
||||||
|
return `<div style="display:flex;flex-direction:column;width:100%;text-align:left">
|
||||||
|
<div style="font-size:11px;color:var(--secondary-text-color)">Tid i dag</div>
|
||||||
|
<div style="font-size:20px;font-weight:bold;line-height:1.1;margin:1px 0 4px">${total} min</div>
|
||||||
|
<div style="font-size:10.5px;color:var(--secondary-text-color);line-height:1.5">${list}</div>
|
||||||
|
</div>`;
|
||||||
]]]
|
]]]
|
||||||
styles:
|
styles:
|
||||||
card:
|
card:
|
||||||
- padding: 8px
|
- padding: 10px
|
||||||
name:
|
grid:
|
||||||
- font-size: 11px
|
- grid-template-areas: '"info"'
|
||||||
- color: var(--secondary-text-color)
|
|
||||||
state:
|
|
||||||
- font-size: 15px
|
|
||||||
- font-weight: bold
|
|
||||||
custom_fields:
|
custom_fields:
|
||||||
breakdown:
|
info:
|
||||||
- font-size: 9px
|
- width: 100%
|
||||||
- color: var(--secondary-text-color)
|
|
||||||
- padding-top: 3px
|
|
||||||
- line-height: 1.3
|
|
||||||
|
|
||||||
# �💡 Lys kontrol
|
# �💡 Lys kontrol
|
||||||
- type: horizontal-stack
|
- type: horizontal-stack
|
||||||
|
|||||||
Reference in New Issue
Block a user