Skip to content

Commit

Permalink
Merge pull request #430 from Barma-lej/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Barma-lej authored Oct 12, 2024
2 parents 008bc93 + ac4dda1 commit 94435bf
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 85 deletions.
34 changes: 32 additions & 2 deletions src/landroid-card-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,40 @@ export default class LandroidCardEditor extends LitElement {
newConfig.entity = lawnMowerEntities[0];
}

// Получаем все объекты для lawn_mower
const mowerEntities = this.entitiesForMower(newConfig.entity);

// Если entity не задано и есть объекты для lawn_mower, добавляем первый entity
if (!newConfig.settings.length > 0 && mowerEntities.length > 0) {
newConfig.settings = mowerEntities;
}

// Assign the new configuration
this.config = newConfig;
}

/**
* Returns an array of all entities of the domains 'select', 'switch', 'number', and 'button'
* for the lawn_mower device specified in the config.
*
* @return {string[]} An array of entity IDs.
*/
entitiesForMower(mower = this.config.entity) {
// const mower = entity || '';
if (!mower) return [];

const domainList = ['select', 'switch', 'number', 'button'];

// Получаем все объекты для конкретного устройства lawn_mower
return domainList
.flatMap((domain) =>
Object.keys(this.hass.states).filter((entityId) =>
entityId.startsWith(`${domain}.${mower.split('.')[1]}`)
)
)
.sort();
}

/**
* Returns an array of entity IDs from the Home Assistant state object that match the given domain.
* If the domain is 'camera', an empty string is added to the array.
Expand Down Expand Up @@ -111,7 +141,7 @@ export default class LandroidCardEditor extends LitElement {
* @return {TemplateResult} The rendered UI as a lit-html TemplateResult.
*/
render() {
if (!this.hass) {
if (!this.hass || !this.config) {
return nothing;
}

Expand All @@ -128,7 +158,7 @@ export default class LandroidCardEditor extends LitElement {
(entity) => html`
<mwc-list-item
.value="${entity}"
?selected=${entity === this.config.entity}
?selected=${entity === this.config.camera}
>${entity}
</mwc-list-item>
`,
Expand Down
62 changes: 31 additions & 31 deletions src/translations/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,36 +58,36 @@
"camera_error": "Camera error",
"charge_error": "Error charging",
"charging_station_docking_error": "Charging station docking error",
"close_door_to_go_home": "Close door to go home",
"close_door_to_mow": "Close door to mow",
"excessive_slope": "Excessive slope detected",
"hbi_error": "HBI error",
"headlight_error": "Headlight error",
"insufficient_sensor_data": "Insufficient sensor data",
"close_door_to_go_home": "Zavřít dveře pro návrat domů",
"close_door_to_mow": "Zavřít dveře na sev",
"excessive_slope": "Zjištěn nadměrný sklon",
"hbi_error": "Chyba HBI",
"headlight_error": "Chyba světla",
"insufficient_sensor_data": "Nedostatek dat senzoru",
"lifted": "Zvednuta",
"locked": "Mower is locked",
"map_error": "Map error",
"mapping_exploration_failed": "Mapping exploration failed",
"mapping_exploration_required": "Mapping exploration required",
"missing_charging_station": "Missing charging station",
"locked": "Mower je uzamčen",
"map_error": "Chyby mapy",
"mapping_exploration_failed": "Průzkum mapování se nezdařil",
"mapping_exploration_required": "Je vyžadován průzkum mapování",
"missing_charging_station": "Chybějící nabíjecí stanice",
"missing_entity": "Je vyžadováno zadání entity!",
"no_error": "No error",
"ota_error": "OTA error",
"outside_wire": "Outside wire",
"rain_delay": "Rain delay active",
"reverse_wire": "Wire is reversed",
"rfid_reader_error": "RFID reader error",
"timeout_finding_home": "Timed out while finding home",
"training_start_disallowed": "Training start disallowed",
"no_error": "Bez chyby",
"ota_error": "OTA chyba",
"outside_wire": "Vnější dráty",
"rain_delay": "Zpoždění deště aktivní",
"reverse_wire": "Drát je obrácený",
"rfid_reader_error": "Chyba čtečky RFID",
"timeout_finding_home": "Vypršel časový limit při hledání domova",
"training_start_disallowed": "Začátek školení zakázán",
"trapped": "Uvězněna",
"trapped_timeout": "Timed out while trapped",
"unknown": "Unknown",
"unreachable_charging_station": "Unreachable charging station",
"unreachable_zone": "Unreachable zone",
"upside_down": "Mower is upside down",
"wheel_motor_blocked": "Wheel motor is blocked",
"wire_missing": "Wire missing",
"wire_sync": "Wire sync"
"trapped_timeout": "Vypršel časový limit při zachycení",
"unknown": "Neznámý",
"unreachable_charging_station": "Nedostupná nabíjecí stanice",
"unreachable_zone": "Nedostupná zóna",
"upside_down": "Mower je vzhůru",
"wheel_motor_blocked": "Dvojkolí motor je blokován",
"wire_missing": "Drát chybí",
"wire_sync": "Wire synchronizace"
},
"warning": {
"actions_array": "POZOR: 'actions' je rezervováno k přepisu výchozí akce stávajících tlačítek. Pokud jste měli v úmyslu přidat další akce, použijte volbu 'shortcuts'."
Expand All @@ -96,10 +96,10 @@
"entity": "Entita (povinné)",
"camera": "Kamera (volitelné)",
"image": "Obrázek (volitelné)",
"image_left": "Image on the left",
"image_left_aria_label_on": "Image on the left",
"image_left_aria_label_off": "Image from above",
"image_size": "Image size (Optional)",
"image_left": "Obrázek vlevo",
"image_left_aria_label_on": "Obrázek vlevo",
"image_left_aria_label_off": "Obrázek shora",
"image_size": "Velikost obrázku (nepovinné)",
"compact_view": "Kompaktní zobrazení",
"compact_view_aria_label_on": "Zapnout kompaktní zobrazení",
"compact_view_aria_label_off": "Vypnout kompaktní zobrazení",
Expand Down
98 changes: 49 additions & 49 deletions src/translations/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,61 +33,61 @@
"edgecut": "Kantklipning",
"locate": "Find plæneklipperen",
"lock": "Lås",
"multizone_distances": "Set multizone distance",
"multizone_probabilities": "Set multizone probabilities",
"ots": "Start One-Time-Schedule",
"multizone_distances": "Sæt multizone afstand",
"multizone_probabilities": "Sæt multizone sandsynligheder",
"ots": "Start Engangs-Tidsplan",
"pause": "Pause",
"partymode": "Festtilstand",
"raindelay": "Set rain delay",
"dock": "Dock",
"restart": "Restart",
"raindelay": "Indstil regn forsinkelse",
"dock": "Dok",
"restart": "Genstart",
"resume": "Fortsæt",
"schedule": "Set or change the schedule of the mower",
"setzone": "Set zone",
"schedule": "Indstil eller ændre tidsplanen for plæneklipperen",
"setzone": "Sæt zone",
"start_mowing": "Start",
"stop": "Stop",
"timeextension": "Set time extension",
"torque": "Set wheel torque"
"timeextension": "Angiv tidsforlængelse",
"torque": "Angiv hjuldrejningsmoment"
},
"error": {
"battery_low": "Battery low",
"battery_temperature_error": "Battery temperature error",
"battery_trunk_open_timeout": "Battery trunk open timeout",
"blade_height_adjustment_blocked": "Blade height adjustment blocked",
"blade_motor_blocked": "Blade motor is blocked",
"camera_error": "Camera error",
"charge_error": "Error charging",
"charging_station_docking_error": "Charging station docking error",
"close_door_to_go_home": "Close door to go home",
"close_door_to_mow": "Close door to mow",
"excessive_slope": "Excessive slope detected",
"hbi_error": "HBI error",
"headlight_error": "Headlight error",
"insufficient_sensor_data": "Insufficient sensor data",
"battery_low": "Lavt batteriniveau",
"battery_temperature_error": "Batteri temperaturfejl",
"battery_trunk_open_timeout": "Batteri trunk åben timeout",
"blade_height_adjustment_blocked": "Bladhøjde blokeret",
"blade_motor_blocked": "Knivmotoren er blokeret",
"camera_error": "Kamerafejl",
"charge_error": "Fejl under opladning",
"charging_station_docking_error": "Fejl i dockingstation for opladning",
"close_door_to_go_home": "Luk dør for at gå hjem",
"close_door_to_mow": "Luk dør for slag",
"excessive_slope": "Overdreven hældning detekteret",
"hbi_error": "HBI fejl",
"headlight_error": "Fejl i forlygte",
"insufficient_sensor_data": "Utilstrækkelige sensordata",
"lifted": "Løftet",
"locked": "Mower is locked",
"map_error": "Map error",
"mapping_exploration_failed": "Mapping exploration failed",
"mapping_exploration_required": "Mapping exploration required",
"missing_charging_station": "Missing charging station",
"locked": "Plæneklipper er låst",
"map_error": "Kort fejl",
"mapping_exploration_failed": "Udforskning af kortlægning mislykkedes",
"mapping_exploration_required": "Kortlægning efterforskning kræves",
"missing_charging_station": "Manglende ladestation",
"missing_entity": "Angivelse af Entity er påkrævet!",
"no_error": "No error",
"ota_error": "OTA error",
"outside_wire": "Outside wire",
"rain_delay": "Rain delay active",
"reverse_wire": "Wire is reversed",
"rfid_reader_error": "RFID reader error",
"timeout_finding_home": "Timed out while finding home",
"training_start_disallowed": "Training start disallowed",
"trapped": "Fanget!",
"trapped_timeout": "Timed out while trapped",
"unknown": "Unknown",
"unreachable_charging_station": "Unreachable charging station",
"unreachable_zone": "Unreachable zone",
"upside_down": "Mower is upside down",
"wheel_motor_blocked": "Wheel motor is blocked",
"wire_missing": "Wire missing",
"wire_sync": "Wire sync"
"no_error": "Ingen fejl",
"ota_error": "OTA fejl",
"outside_wire": "Uden for ledningen",
"rain_delay": "Regn forsinkelse aktiv",
"reverse_wire": "Wire er vendt",
"rfid_reader_error": "RFID læserfejl",
"timeout_finding_home": "Timeout under at finde hjem",
"training_start_disallowed": "Uddannelsesstart er ikke tilladt",
"trapped": "Fanget",
"trapped_timeout": "Timeout mens fanget er fanget",
"unknown": "Ukendt",
"unreachable_charging_station": "Utilgængelig ladestation",
"unreachable_zone": "Utilgængelig zone",
"upside_down": "Plæneklipperen er på hovedet",
"wheel_motor_blocked": "Hjulmotoren er blokeret",
"wire_missing": "Wire mangler",
"wire_sync": "Wire synkronisering"
},
"warning": {
"actions_array": "ADVARSEL: 'actions' er reserveret til at tilsidesætte standardhandlinger for eksisterende knapper. Hvis din hensigt var at tilføje yderligere handlinger, skal du bruge 'shortcuts' mulighed i stedet for."
Expand All @@ -112,9 +112,9 @@
"show_toolbar": "Vis værktøjslinje",
"show_toolbar_aria_label_on": "Slå visning af værktøjslinje til",
"show_toolbar_aria_label_off": "Slå visning af værktøjslinje fra",
"show_animation": "Show Animation",
"show_animation_aria_label_on": "Toggle animation on",
"show_animation_aria_label_off": "Toggle animation off",
"show_animation": "Vis animation",
"show_animation_aria_label_on": "Skift animation til",
"show_animation_aria_label_off": "Skift animation fra",
"code_only_note": "Bemærk: Indstilling af 'actions', 'shortcuts' og 'stats' er udelukkende muligt via Code Editor."
}
}
2 changes: 1 addition & 1 deletion src/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"map_error": "Kartenfehler",
"mapping_exploration_failed": "Kartierungserkundung fehlgeschlagen",
"mapping_exploration_required": "Kartierungserkundung erforderlich",
"missing_entity": "Angabe der Entität erforderlich",
"missing_charging_station": "Ladestation fehlt",
"missing_entity": "Angabe der Entität erforderlich",
"no_error": "Kein Fehler",
"ota_error": "OTA-Fehler",
"outside_wire": "Außerhalb des Begrenzungsdrahts",
Expand Down
2 changes: 1 addition & 1 deletion src/translations/et.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"map_error": "Kaardi viga",
"mapping_exploration_failed": "Kaardistamine ebaõnnestus",
"mapping_exploration_required": "Kaardistamine on vajalik",
"missing_entity": "Spetsifitseerimine on vajalik!",
"missing_charging_station": "Laadimisjaam on kättesaamatu",
"missing_entity": "Spetsifitseerimine on vajalik!",
"no_error": "Vigu pole",
"ota_error": "OTA viga",
"outside_wire": "Väljaspool piirdetraati",
Expand Down
2 changes: 1 addition & 1 deletion src/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"not_available": "Grasmaaier is niet bereikbaar"
},
"action": {
"config": "Configuratie",
"config": "Configuratie",
"edgecut": "Randroutine",
"locate": "Lokaliseer maaier",
"lock": "Vergrendeling in- of uitschakelen",
Expand Down

0 comments on commit 94435bf

Please sign in to comment.