Files
cantabile-ha-addons/src/edge/cantabile_edge/names.py
T

308 lines
22 KiB
Python

# Copyright © 2026 Setti Solutions S.R.L, www.setti.md. All rights reserved.
"""Names the agent gives itself in Home Assistant, in HA's language (its
configuration's `language`, chosen in the Hub's setup; on any other HA the
owner's). Areas in every language we know of; entity names where cheap (at
least German). Anything missing: English. The Hub's ha-setup creates the
areas with the same names (hub/.../cantabile/ha-setup: AREAS)."""
AREAS = {
"cantabile": {"en": "Cantabile"},
"flats": {"en": "Flats", "de": "Wohnungen", "ro": "Apartamente", "ru": "Квартиры", "fr": "Appartements",
"it": "Appartamenti", "es": "Pisos", "nl": "Appartementen"},
}
NAMES = {
"cloud": {"de": "Cloud"},
"mode": {"de": "Modus"},
"next_action": {"en": "Next action", "de": "Nächste Aktion"},
"plan": {"en": "{0}: plan", "de": "{0}: Plan"},
"price_import_now": {"en": "Electricity price now", "de": "Strompreis jetzt"},
"price_import_next": {"en": "Electricity price next", "de": "Strompreis als Nächstes"},
"price_export_now": {"en": "Feed-in price now", "de": "Einspeisevergütung jetzt"},
"price_other": {"en": "{0} price", "de": "Preis {0}"},
"model": {"en": "Forecast model", "de": "Prognosemodell"},
"commands": {"en": "Commands received", "de": "Empfangene Befehle"},
"commanded": {"en": "{0}: setting", "de": "{0}: Vorgabe"},
"received": {"en": "Commands received", "de": "Empfangene Befehle"},
# a command in words ({0} the control's name, {1} its value, {2} a mode)
"cmd_mode": {"en": "Mode: {2}", "de": "Modus: {2}"},
"cmd_control": {"en": "{0}: set to {1}", "de": "{0}: auf {1}"},
"cmd_release": {"en": "{0}: back to the plan", "de": "{0}: zurück zum Plan"},
"cmd_limits": {"en": "{0}: new limits", "de": "{0}: neue Grenzen"},
"cmd_tariff": {"en": "New tariff", "de": "Neuer Tarif"},
"cmd_model": {"en": "New forecast model", "de": "Neues Prognosemodell"},
"cmd_building": {"en": "Message from the building", "de": "Nachricht vom Gebäude"},
"flat_grid": {"en": "Grid power", "de": "Netzbezug"},
"flat_flex": {"en": "Flexibility", "de": "Flexibilität"},
"flat_request": {"en": "Building's request", "de": "Anfrage des Gebäudes"},
"flat_state": {"en": "State", "de": "Zustand"},
# the shadow market (a `market` bundle; announce.py, dashboards.py)
"market_exchange": {"en": "Exchange with {0}", "de": "Austausch mit {0}"},
"market_position": {"en": "Market net position", "de": "Markt: Nettoposition"},
"market_position_of": {"en": "{0}: market net position", "de": "{0}: Markt-Nettoposition"},
"market_price": {"en": "Shared energy price", "de": "Preis geteilter Energie"},
"market_actuator": {"en": "{0}: contract target", "de": "{0}: Vertragsvorgabe"},
"card_market": {"en": "Market (shadow)", "de": "Markt (Schattenbetrieb)"},
"mk_sells": {"en": "Sells to {0}", "de": "Verkauft an {0}"},
"mk_buys": {"en": "Buys from {0}", "de": "Kauft von {0}"},
"mk_flats": {"en": "{0} flats, summed", "de": "{0} Wohnungen, summiert"},
"mk_slot": {"en": "{0} kWh last quarter-hour (contract {1})", "de": "{0} kWh letzte Viertelstunde (Vertrag {1})"},
"mk_slot_open": {"en": "{0} kWh last quarter-hour", "de": "{0} kWh letzte Viertelstunde"},
"mk_no_value": {"en": "no metered value yet", "de": "noch kein Messwert"},
"mk_not_now": {"en": "not in force this quarter-hour", "de": "in dieser Viertelstunde nicht gültig"},
"mk_shadow": {"en": "shadow", "de": "Schattenbetrieb"},
"mk_period": {"en": "So far this {0}: {1} kWh · {2} €", "de": "Bisher in diesem {0}: {1} kWh · {2} €"},
"mk_month": {"en": "month", "de": "Monat"},
"mk_quarter": {"en": "quarter", "de": "Quartal"},
"mk_year": {"en": "year", "de": "Jahr"},
"mk_penalties": {"en": "penalties {0} € paid, {1} € received", "de": "Vertragsstrafen {0} € gezahlt, {1} € erhalten"},
"mk_deviation_self": {"en": "deviation {0} kWh, caused here", "de": "Abweichung {0} kWh, hier verursacht"},
"mk_deviation_other": {"en": "deviation {0} kWh, caused by the other side", "de": "Abweichung {0} kWh, von der Gegenseite verursacht"},
"mk_exempt": {"en": "exempt: {0}", "de": "ausgenommen: {0}"},
"mk_state_on": {"en": "on", "de": "ein"},
"mk_state_off": {"en": "off", "de": "aus"},
"mk_state_hold": {"en": "hold", "de": "halten"},
"mk_target": {"en": "contract", "de": "Vertrag"},
"mk_actual": {"en": "now", "de": "jetzt"},
"mk_unknown": {"en": "unknown", "de": "unbekannt"},
"mk_default": {"en": "falls back to {0} after {1} min", "de": "fällt nach {1} min auf {0} zurück"},
"mk_protection": {"en": "protection: {0}", "de": "Schutz: {0}"},
"mk_net_bought": {"en": "Net bought this month", "de": "Netto gekauft diesen Monat"},
"mk_shadow_note": {"en": "Shadow market: computed and shown only. Nothing is switched by it, no money moves; "
"your devices keep their own settings and protection.",
"de": "Schattenmarkt: nur berechnet und angezeigt. Nichts wird dadurch geschaltet, kein Geld "
"fließt; Ihre Geräte behalten ihre eigenen Einstellungen und ihren Schutz."},
"mk_stale": {"en": "The market's values are out of date (no new values from Cantabile Cloud).",
"de": "Die Marktwerte sind veraltet (keine neuen Werte von der Cantabile Cloud)."},
# dashboards (dashboards.py)
"dash_main": {"en": "Cantabile"},
"dash_climate": {"en": "Heating & cooling", "de": "Heizung & Kühlung"},
"card_plan": {"en": "Plan, next 48 h", "de": "Plan, nächste 48 h"},
"card_prices": {"en": "Prices, next 48 h (ct/kWh)", "de": "Preise, nächste 48 h (ct/kWh)"},
"card_devices": {"en": "What Cantabile sets", "de": "Was Cantabile vorgibt"},
"card_power": {"en": "Power", "de": "Leistung"},
"card_price": {"en": "Electricity price", "de": "Strompreis"},
"card_daily": {"en": "Energy per day", "de": "Energie pro Tag"},
"card_monthly": {"en": "Energy per month", "de": "Energie pro Monat"},
"card_rooms": {"en": "Rooms", "de": "Räume"},
"assumed_hint": {"en": "This thermostat does not report back (infrared): what it shows is what was last sent to "
"it, not measured.",
"de": "Dieses Thermostat meldet nichts zurück (Infrarot): Angezeigt wird, was zuletzt gesendet "
"wurde, nicht gemessen."},
"source": {"en": "{0}: from", "de": "{0}: von"},
# the dashboard's views (dashboards.py)
"view_energy": {"en": "Energy", "de": "Energie"},
"view_building": {"en": "Building", "de": "Gebäude"},
"devices_page": {"en": "Devices: use Home Assistant's devices with Cantabile",
"de": "Geräte: Geräte aus Home Assistant mit Cantabile nutzen"},
"card_cloud": {"en": "Cantabile Cloud", "de": "Cantabile Cloud"},
"mode_off": {"en": "Off", "de": "Aus"},
"mode_off_why": {"en": "Cantabile does not read your home.", "de": "Cantabile liest Ihr Zuhause nicht."},
"mode_shadow": {"en": "Watching", "de": "Beobachten"},
"mode_shadow_why": {"en": "Cantabile follows your home and changes nothing.",
"de": "Cantabile verfolgt Ihr Zuhause und verändert nichts."},
"mode_advisory": {"en": "Advising", "de": "Beraten"},
"mode_advisory_why": {"en": "Cantabile plans and suggests; you decide.",
"de": "Cantabile plant und schlägt vor; Sie entscheiden."},
"mode_auto": {"en": "Automatic", "de": "Automatisch"},
"mode_auto_why": {"en": "Cantabile runs the devices you allowed.",
"de": "Cantabile steuert die Geräte, die Sie freigegeben haben."},
"now": {"en": "Now", "de": "Jetzt"},
"today": {"en": "Today", "de": "Heute"},
"solar": {"en": "Solar", "de": "Solar"},
"home": {"en": "Home", "de": "Haus"},
"grid": {"en": "Grid", "de": "Netz"},
"feed_in": {"en": "Feed-in", "de": "Einspeisung"},
"battery": {"en": "Battery", "de": "Batterie"},
"battery_soc": {"en": "Battery charge", "de": "Batterieladung"},
"battery_in": {"en": "Battery charged", "de": "Batterie geladen"},
"battery_out": {"en": "Battery discharged", "de": "Batterie entladen"},
"from_grid": {"en": "From the grid", "de": "Aus dem Netz"},
"to_grid": {"en": "To the grid", "de": "Ins Netz"},
"heat_pump": {"en": "Heat pump", "de": "Wärmepumpe"},
# heat (heat.power, heat.energy) is thermal: never shown as electricity
"heat": {"en": "Heat (thermal)", "de": "Wärme (thermisch)"},
"heat_building": {"en": "Heat from the building (thermal)", "de": "Wärme aus dem Gebäude (thermisch)"},
"heat_delivered": {"en": "Heat delivered (thermal)", "de": "Gelieferte Wärme (thermisch)"},
"heat_today": {"en": "Heat today (thermal)", "de": "Wärme heute (thermisch)"},
"heat_pump_electric": {"en": "Heat pump, electric", "de": "Wärmepumpe, elektrisch"},
"cop": {"en": "COP (heat ÷ electricity)", "de": "COP (Wärme ÷ Strom)"},
"electric_power": {"en": "Electric power", "de": "Elektrische Leistung"},
"heat_not_electric": {"en": "Heat, not electricity: not part of solar, home or grid above.",
"de": "Wärme, kein Strom: nicht Teil von Solar, Haus oder Netz oben."},
"ev": {"en": "Car", "de": "Auto"},
"circuits": {"en": "Circuits", "de": "Stromkreise"},
"of": {"en": "of", "de": "von"},
"total": {"en": "Total", "de": "Gesamt"},
"values": {"en": "Values", "de": "Werte"},
"switched_on": {"en": "switched on", "de": "eingeschaltet"},
"member_of": {"en": "Member of **{0}**, unit {1}.", "de": "Mitglied von **{0}**, Einheit {1}."},
"community_of": {"en": "Member of the community **{0}**.", "de": "Mitglied der Gemeinschaft **{0}**."},
"request_to": {"en": "Asked to join **{0}**: waiting for the operator.",
"de": "Beitritt zu **{0}** angefragt: wartet auf den Betreiber."},
"devices": {"en": "Devices", "de": "Geräte"},
"fan": {"en": "fan", "de": "Lüfter"},
"price_now": {"en": "Electricity now", "de": "Strom jetzt"},
"feed_in_now": {"en": "feed-in", "de": "Einspeisung"},
"cheapest": {"en": "Next 24 h: cheapest", "de": "Nächste 24 h: am günstigsten"},
"dearest": {"en": "dearest", "de": "am teuersten"},
"kind_heating": {"en": "heating", "de": "Heizen"},
"kind_cooling": {"en": "cooling", "de": "Kühlen"},
"coming": {"en": "Coming up", "de": "Als Nächstes"},
"nothing_planned": {"en": "Nothing planned.", "de": "Nichts geplant."},
"sets_release": {"en": "not controlling: your own settings apply",
"de": "keine Vorgabe: Ihre eigenen Einstellungen gelten"},
"your_settings": {"en": "your own settings", "de": "Ihre eigenen Einstellungen"},
"sets_holds": {"en": "holds", "de": "hält"},
"from_plan": {"en": "Following the plan.", "de": "Nach Plan."},
"from_cloud": {"en": "Asked by Cantabile Cloud.", "de": "Von der Cantabile Cloud angefragt."},
"from_building": {"en": "Asked by the building.", "de": "Vom Gebäude angefragt."},
"from_owner": {"en": "You changed it by hand: Cantabile waits.",
"de": "Von Ihnen von Hand geändert: Cantabile wartet."},
"from_safe_default": {"en": "No current plan: your own settings until there is one.",
"de": "Kein aktueller Plan: bis dahin Ihre eigenen Einstellungen."},
"by_cloud": {"en": "Cantabile Cloud", "de": "Cantabile Cloud"},
"by_building": {"en": "Building", "de": "Gebäude"},
"by_grid": {"en": "Grid operator", "de": "Netzbetreiber"},
"by_console": {"en": "Console", "de": "Konsole"},
"what": {"en": "What", "de": "Was"},
"from": {"en": "From", "de": "Von"},
"time": {"en": "Time", "de": "Zeit"},
"control": {"en": "Control", "de": "Gerät"},
"value": {"en": "Value", "de": "Wert"},
"why": {"en": "Why", "de": "Warum"},
# the owner's preferences (preferences.py; announce.py)
"pref_schedule": {"en": "{0}: minimum temperatures", "de": "{0}: Mindesttemperaturen"},
"pref_schedule_cool": {"en": "{0}: maximum temperatures", "de": "{0}: Höchsttemperaturen"},
"pref_boost_c": {"en": "{0}: boost temperature", "de": "{0}: Boost-Temperatur"},
"pref_boost_h": {"en": "{0}: boost hours", "de": "{0}: Boost-Dauer"},
"pref_boost": {"en": "{0}: boost now", "de": "{0}: Boost jetzt"},
"pref_away": {"en": "Away", "de": "Abwesend"},
"pref_away_until": {"en": "Away until", "de": "Abwesend bis"},
"pref_ready": {"en": "{0}: ready by", "de": "{0}: fertig bis"},
"pref_capacity": {"en": "{0}: battery capacity", "de": "{0}: Akkukapazität"},
"pref_needed": {"en": "{0}: needed once at", "de": "{0}: einmalig gebraucht um"},
"pref_reserve": {"en": "{0}: reserve", "de": "{0}: Reserve"},
"pref_reserve_blocks": {"en": "{0}: reserve by time", "de": "{0}: Reserve nach Uhrzeit"},
"pref_result": {"en": "Preferences", "de": "Präferenzen"},
"pref_result_of": {"en": "{0}: preferences", "de": "{0}: Präferenzen"},
# the household's own costs (costs.py; announce.py, dashboards.py view "costs")
"view_costs": {"en": "My energy costs", "de": "Meine Energiekosten"},
"costs_status": {"en": "Energy costs: missing data", "de": "Energiekosten: fehlende Daten"},
"costs_prices": {"en": "Electricity price source now", "de": "Strompreis: Quelle jetzt"},
"cost_of": {"en": "{0}: cost this month", "de": "{0}: Kosten diesen Monat"},
"saving_of": {"en": "{0}: savings this month", "de": "{0}: Ersparnis diesen Monat"},
"carrier_electricity": {"en": "Electricity", "de": "Strom"},
"carrier_gas": {"en": "Gas", "de": "Gas"},
"carrier_heat": {"en": "Heat", "de": "Wärme"},
"carrier_oil": {"en": "Heating oil", "de": "Heizöl"},
"cs_prices": {"en": "Prices", "de": "Preise"},
"cs_costs": {"en": "Monthly cost", "de": "Monatskosten"},
"cs_savings": {"en": "Savings", "de": "Ersparnis"},
"cs_alarm": {"en": "Some figures cannot be shown", "de": "Einige Werte können nicht angezeigt werden"},
"cs_unavailable": {"en": "Not available yet: the agent has not sent these figures.",
"de": "Noch nicht verfügbar: der Agent hat diese Werte nicht gesendet."},
"cs_today": {"en": "Today", "de": "Heute"},
"cs_tomorrow": {"en": "Tomorrow", "de": "Morgen"},
"cs_hour": {"en": "Hour", "de": "Stunde"},
"cs_from": {"en": "From", "de": "Von"},
"cs_own": {"en": "Own supplier", "de": "Eigener Lieferant"},
"cs_own_now": {"en": "own supplier", "de": "eigener Lieferant"},
"cs_offer": {"en": "the building's offer", "de": "Angebot des Gebäudes"},
"cs_offer_of": {"en": "{0}", "de": "{0}"},
"cs_src_offer": {"en": "building", "de": "Gebäude"},
"cs_src_part": {"en": "partly building", "de": "teils Gebäude"},
"cs_src_own": {"en": "supplier", "de": "Lieferant"},
"cs_src_own_long": {"en": "your own supplier", "de": "Ihr eigener Lieferant"},
"cs_hours_offer": {"en": "{0} h from {1}", "de": "{0} h von {1}"},
"cs_offer_shadow": {"en": "The building's price is shown and planned with but not billed yet (shadow): "
"your own supplier still bills you.",
"de": "Der Preis des Gebäudes wird angezeigt und eingeplant, aber noch nicht abgerechnet "
"(Schattenbetrieb): Ihr eigener Lieferant rechnet weiter ab."},
"cs_so_far": {"en": "So far", "de": "Bisher"},
"cs_forecast": {"en": "Month end (forecast)", "de": "Monatsende (Prognose)"},
"cs_last_month": {"en": "last month", "de": "Vormonat"},
"cs_fixed_in": {"en": "Fixed charges included.", "de": "Grundpreise eingerechnet."},
"cs_fixed_out": {"en": "Without fixed charges (not known to the box).",
"de": "Ohne Grundpreise (der Box nicht bekannt)."},
"cs_incomplete": {"en": "* at least: some kWh had no price.", "de": "* mindestens: einige kWh hatten keinen Preis."},
"cs_forecast_how": {"en": "Forecast: the cost per hour of the last {0} days for the rest of the month.",
"de": "Prognose: die Kosten je Stunde der letzten {0} Tage für den Rest des Monats."},
"cs_heat_outlook": {"en": "Expected for heat ({0}) over the next {1} h: {2} for {3} kWh (Cantabile's forecast; "
"not optimised).",
"de": "Erwartet für Wärme ({0}) in den nächsten {1} h: {2} für {3} kWh (Prognose von "
"Cantabile; nicht optimiert)."},
"cs_unbilled_note": {"en": "At your own supplier's price (what is billed now): {0}.",
"de": "Zum Preis Ihres eigenen Lieferanten (was jetzt abgerechnet wird): {0}."},
"cs_offer_saved": {"en": "Building offer vs your own supplier: **{0} saved** this month ({1} kWh)",
"de": "Angebot des Gebäudes statt eigenem Lieferanten: **{0} gespart** diesen Monat ({1} kWh)"},
"cs_offer_would": {"en": "Building offer vs your own supplier: **would have saved {0}** this month ({1} kWh; not billed)",
"de": "Angebot des Gebäudes statt eigenem Lieferanten: **hätte {0} gespart** diesen Monat "
"({1} kWh; nicht abgerechnet)"},
"cs_offer_none_yet": {"en": "Building offer {0}: no metered kWh at its price this month yet.",
"de": "Angebot des Gebäudes {0}: diesen Monat noch keine gemessenen kWh zu seinem Preis."},
"cs_offer_no": {"en": "You buy from your own supplier: no building offer.",
"de": "Sie beziehen von Ihrem eigenen Lieferanten: kein Angebot des Gebäudes."},
"cs_plan_of": {"en": "{0}, Cantabile's plan", "de": "{0}, Plan von Cantabile"},
"cs_plan_saved": {"en": "**{0} saved** (estimated)", "de": "**{0} gespart** (geschätzt)"},
"cs_plan_would": {"en": "**would have saved {0}** (not acted on, or at a price not billed)",
"de": "**hätte {0} gespart** (nicht ausgeführt oder zu einem nicht abgerechneten Preis)"},
"cs_plan_none_month": {"en": "no plan this month yet", "de": "diesen Monat noch kein Plan"},
"cs_savings_how": {"en": "Building offer: the same metered kWh at your own supplier's price. Plan: the plan's "
"estimate of each quarter-hour with and without its actions, at the same prices.",
"de": "Angebot des Gebäudes: dieselben gemessenen kWh zum Preis Ihres eigenen Lieferanten. "
"Plan: die Schätzung des Plans je Viertelstunde mit und ohne seine Aktionen, zu "
"denselben Preisen."},
"cg_failed": {"en": "could not be computed ({0})", "de": "konnte nicht berechnet werden ({0})"},
"cg_no_prices_day": {"en": "no prices yet", "de": "noch keine Preise"},
"cg_no_prices_today": {"en": "no prices for today: no tariff received, or it has expired",
"de": "keine Preise für heute: kein Tarif empfangen oder abgelaufen"},
"cg_no_price_now": {"en": "no electricity price for now in the tariff", "de": "kein Strompreis für jetzt im Tarif"},
"cg_no_own_curve": {"en": "the tariff names a building offer but not your own supplier's price: "
"its saving cannot be computed",
"de": "der Tarif nennt ein Angebot des Gebäudes, aber nicht den Preis Ihres eigenen "
"Lieferanten: dessen Ersparnis ist nicht berechenbar"},
"cg_no_forecast_param": {"en": "no forecast: the parameter {0} is not in the tariff (Parameters page)",
"de": "keine Prognose: der Parameter {0} fehlt im Tarif (Parameter-Seite)"},
"cg_no_fixed": {"en": "fixed charges unknown: the tariff does not carry them yet",
"de": "Grundpreise unbekannt: der Tarif enthält sie noch nicht"},
"cg_no_meter_electricity": {"en": "no grid meter mapped (energy from the grid or grid power)",
"de": "kein Netzzähler zugeordnet (Energie aus dem Netz oder Netzleistung)"},
"cg_no_meter_gas": {"en": "gas is priced but no gas meter is mapped", "de": "Gas hat einen Preis, aber kein Gaszähler ist zugeordnet"},
"cg_no_meter_heat": {"en": "heat is priced but no heat meter is mapped",
"de": "Wärme hat einen Preis, aber kein Wärmezähler ist zugeordnet"},
"cg_no_meter_data": {"en": "no metered values this month yet", "de": "diesen Monat noch keine Messwerte"},
"cg_unpriced": {"en": "{0} kWh without a price", "de": "{0} kWh ohne Preis"},
"cg_unpriced_of": {"en": "{0}: {1} kWh this month had no price (no tariff then): the cost is at least the figure shown",
"de": "{0}: {1} kWh diesen Monat hatten keinen Preis (damals kein Tarif): die Kosten sind mindestens der gezeigte Wert"},
"cg_forecast_short": {"en": "less than an hour metered: no forecast yet",
"de": "weniger als eine Stunde gemessen: noch keine Prognose"},
"cg_no_plan": {"en": "no plan: Cantabile controls no device here", "de": "kein Plan: Cantabile steuert hier kein Gerät"},
"cg_no_plan_yet": {"en": "no plan with prices this month yet", "de": "diesen Monat noch kein Plan mit Preisen"},
}
COMMA = ("de", "fr", "it", "es", "nl", "ro", "ru", "pt", "pl", "cs", "da", "sv", "nb", "fi", "tr", "uk")
def number(v: float, language: str | None, digits: int = 1) -> str:
"""A number with the language's decimal mark (1.5 / 1,5)."""
s = f"{v:.{digits}f}"
return s.replace(".", ",") if lang(language) in COMMA else s
def lang(code: str | None) -> str:
"""HA's language ("de", "de-CH", "pt-BR") as our two-letter key."""
return (code or "en").split("-")[0].split("_")[0].lower() or "en"
def area(key: str, language: str | None) -> str:
t = AREAS[key]
return t.get(lang(language)) or t["en"]
def name(key: str, language: str | None, *args) -> str:
t = NAMES[key]
text = t.get(lang(language)) or t.get("en") or key.replace("_", " ").capitalize()
return text.format(*args)