Skip to content

Commit

Permalink
Merge pull request #339 from matt8707/update
Browse files Browse the repository at this point in the history
Add 'update' modal
  • Loading branch information
matt8707 authored Feb 3, 2024
2 parents 803f0c3 + e08b302 commit 85d64a5
Show file tree
Hide file tree
Showing 70 changed files with 1,014 additions and 65 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dependencies": {
"@codemirror/autocomplete": "^6.12.0",
"@codemirror/commands": "^6.3.3",
"@codemirror/language": "^6.10.0",
"@codemirror/language": "^6.10.1",
"@codemirror/legacy-modes": "^6.3.3",
"@codemirror/lint": "^6.5.0",
"@codemirror/state": "^6.4.0",
Expand All @@ -57,10 +57,11 @@
"home-assistant-js-websocket": "^9.1.0",
"http-proxy-middleware": "^2.0.6",
"js-yaml": "^4.1.0",
"maplibre-gl": "^3.6.2",
"konva": "^9.3.2",
"maplibre-gl": "^4.0.0",
"marked": "^11.2.0",
"svelecte": "^3.17.2",
"svelte-confetti": "^1.3.1",
"svelte-confetti": "^1.3.2",
"svelte-dnd-action": "^0.9.38",
"svelte-modals": "^1.3.0",
"svelte-ripple": "^0.1.1"
Expand Down
84 changes: 49 additions & 35 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions scripts/translations/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ def process_dir(_dir, _output, _keys):
("fan_speed_low", ["ui.card.fan.speed.low"]),
("fan_speed_medium", ["ui.card.fan.speed.medium"]),
("fan_speed_high", ["ui.card.fan.speed.high"]),
("update_installing_progress", ["ui.card.update.installing_with_progress"]),
("update_installing", ["ui.card.update.installing"]),
("update_release_notes", ["ui.dialogs.more_info_control.update.release_announcement"]),
("update_create_backup", ["ui.dialogs.more_info_control.update.create_backup"]),
("update_skip", ["ui.dialogs.more_info_control.update.skip"]),
("update_clear_skipped", ["ui.dialogs.more_info_control.update.clear_skipped"]),
("update_install", [ "ui.dialogs.more_info_control.update.install"]),
],
),
( # MEDIA_PLAYER
Expand All @@ -138,6 +145,16 @@ def process_dir(_dir, _output, _keys):
("camera", ["title"]),
],
),
( # UPDATE
f"{COMPONENTS}/update/translations/",
[
("update", ["title"]),
("update_available", ["entity_component", "_", "state", "on"]),
("update_up_to_date", ["entity_component", "_", "state", "off"]),
("update_installed_version", ["entity_component", "_", "state_attributes", "installed_version", "name"]),
("update_latest_version", ["entity_component", "_", "state_attributes", "latest_version", "name"]),
],
),
( # DOORBIRD (CAMERA)
f"{COMPONENTS}/doorbird/translations/",
[
Expand Down
26 changes: 19 additions & 7 deletions src/lib/Components/StateLogic.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,42 @@
{:else if getDomain(entity_id) === 'climate' && attributes?.hvac_action}
{$lang(attributes?.hvac_action)}

<!-- Climate -->
{:else if getDomain(entity_id) === 'update'}
{#if attributes?.in_progress}
{typeof attributes?.in_progress === 'number'
? $lang('update_installing_progress').replace('{progress}', String(attributes?.in_progress))
: $lang('update_installing')}
{:else if state === 'on'}
{$lang('update_available')}
{:else if state === 'off'}
{$lang('update_up_to_date')}
{/if}

<!-- Humidifier -->
{:else if getDomain(entity_id) === 'humidifier' && entity?.state === 'on' && attributes?.action}
{:else if getDomain(entity_id) === 'humidifier' && state === 'on' && attributes?.action}
{$lang('humidifier_' + attributes?.action)}

<!-- Water Heater -->
{:else if getDomain(entity_id) === 'water_heater'}
{$lang('water_heater_' + entity?.state)}
{$lang('water_heater_' + state)}

<!-- Input Number / Number -->
{:else if entity_id && (getDomain(entity_id) === 'input_number' || getDomain(entity_id) === 'number')}
{Number(state) || $lang('unknown')}
{#if attributes?.unit_of_measurement}{attributes.unit_of_measurement}{/if}

<!-- Camera -->
{:else if entity_id && entity_id.split('.')[0] === 'camera'}
{:else if getDomain(entity_id) === 'camera'}
<!-- instead of idle? -->
{$lang('camera')}

<!-- Weather -->
{:else if entity_id && entity_id.split('.')[0] === 'weather'}
{:else if getDomain(entity_id) === 'weather'}
{$lang('weather_' + state?.replace('_', '-')) || state || $lang('unknown')}

<!-- Text -->
{:else if entity_id && (getDomain(entity_id) === 'input_text' || getDomain(entity_id) === 'text')}
{:else if getDomain(entity_id) === 'input_text' || getDomain(entity_id) === 'text'}
{#if state === 'unknown'}
{$lang('unknown')}
{:else if state === ''}
Expand All @@ -101,7 +113,7 @@
{#if statePrecision}
{statePrecision}
{:else}
{@html $lang(state) || state}
{@html $lang(state)}
{/if}

<!-- Unit -->
Expand All @@ -115,7 +127,7 @@
{#if statePrecision}
{statePrecision}
{:else}
{@html $lang(state) || state}
{@html $lang(state)}
{/if}

<!-- Unit -->
Expand Down
Loading

0 comments on commit 85d64a5

Please sign in to comment.