Home view: plæneklipper datoformat + toggle-knapper til plæneklipper og støvsuger

This commit is contained in:
2026-04-24 15:38:08 +02:00
parent 5a0232eeba
commit 30fffd8651
+72 -16
View File
@@ -155,14 +155,49 @@ cards:
target: target:
entity_id: button.roborock_s8_pro_ultra_vac_followed_by_mop entity_id: button.roborock_s8_pro_ultra_vac_followed_by_mop
- type: button - type: custom:button-card
name: Gå til dock entity: vacuum.roborock_s8_pro_ultra
icon: mdi:home-import-outline name: Start
icon: mdi:robot-vacuum
tap_action: tap_action:
action: call-service action: call-service
service: vacuum.return_to_base service: vacuum.start
target: target:
entity_id: vacuum.roborock_s8_pro_ultra entity_id: vacuum.roborock_s8_pro_ultra
state:
- value: cleaning
name: Dock
styles:
card:
- background-color: rgba(255, 200, 0, 0.25)
- border: 1px solid rgba(255, 200, 0, 0.8)
tap_action:
action: call-service
service: vacuum.return_to_base
target:
entity_id: vacuum.roborock_s8_pro_ultra
- value: returning
name: Dock
styles:
card:
- background-color: rgba(255, 200, 0, 0.25)
- border: 1px solid rgba(255, 200, 0, 0.8)
tap_action:
action: call-service
service: vacuum.return_to_base
target:
entity_id: vacuum.roborock_s8_pro_ultra
- value: paused
name: Dock
styles:
card:
- background-color: rgba(255, 200, 0, 0.25)
- border: 1px solid rgba(255, 200, 0, 0.8)
tap_action:
action: call-service
service: vacuum.return_to_base
target:
entity_id: vacuum.roborock_s8_pro_ultra
# 🏎️ Plæneklipper # 🏎️ Plæneklipper
- type: horizontal-stack - type: horizontal-stack
@@ -171,8 +206,25 @@ cards:
entity: input_datetime.ploeneklipper_sidst_koert entity: input_datetime.ploeneklipper_sidst_koert
show_icon: false show_icon: false
show_name: true show_name: true
show_state: true show_state: false
show_label: true
name: Sidst klippet name: Sidst klippet
label: >
[[[
const s = entity.state;
if (!s || s === 'unknown') return 'Ukendt';
const d = new Date(s.replace(' ', 'T'));
if (isNaN(d)) return s;
const now = new Date();
const isToday = d.toDateString() === now.toDateString();
const yesterday = new Date(now);
yesterday.setDate(now.getDate() - 1);
const isYesterday = d.toDateString() === yesterday.toDateString();
const t = d.toLocaleTimeString('da-DK', {hour: '2-digit', minute: '2-digit'});
if (isToday) return 'I dag ' + t;
if (isYesterday) return 'I g\u00e5r ' + t;
return d.toLocaleDateString('da-DK', {day: 'numeric', month: 'short'}) + ' ' + t;
]]]
tap_action: tap_action:
action: none action: none
styles: styles:
@@ -182,14 +234,15 @@ cards:
- font-size: 11px - font-size: 11px
- color: var(--secondary-text-color) - color: var(--secondary-text-color)
- padding-bottom: 4px - padding-bottom: 4px
state: label:
- white-space: normal - white-space: normal
- word-break: break-word - word-break: break-word
- line-height: 1.2 - line-height: 1.2
- font-size: 13px - font-size: 13px
- text-align: center - text-align: center
- type: button - type: custom:button-card
entity: lawn_mower.husqvarna_automower
name: Klip name: Klip
icon: mdi:robot-mower icon: mdi:robot-mower
tap_action: tap_action:
@@ -197,15 +250,18 @@ cards:
service: lawn_mower.start_mowing service: lawn_mower.start_mowing
target: target:
entity_id: lawn_mower.husqvarna_automower entity_id: lawn_mower.husqvarna_automower
state:
- type: button - value: mowing
name: Stop name: Stop
icon: mdi:home-import-outline styles:
tap_action: card:
action: call-service - background-color: rgba(255, 200, 0, 0.25)
service: lawn_mower.dock - border: 1px solid rgba(255, 200, 0, 0.8)
target: tap_action:
entity_id: lawn_mower.husqvarna_automower action: call-service
service: lawn_mower.dock
target:
entity_id: lawn_mower.husqvarna_automower
# 💡 Lys kontrol # 💡 Lys kontrol
- type: horizontal-stack - type: horizontal-stack