Ausgegebener Text übersetzen/ersetzen

Hi Leute,

Ich betreibe einen Homematic Regensensor, dieser gibt mir im
HA Dashboard die Werte (Value) „Trocken“ und „Nass“ aus.
Mit der Anzeige Trocken bei keinem Regen kann ich leben, aber Nass wenn es regnet gefällt mir gar nicht.
Hier hätte ich gerne „Regen“ stehen, anstatt „Nass“ !!

Nun weiß ich nicht welches Werkzeug (Card_Mod, Helfer oder Templ.) ich dafür benötige, geschweige denn was, zu tun ist ??
Wie immer hänge ich meinen Code an :

type: entity
state_color: false
grid_options:
  columns: 6
  rows: 2
name: Regen
entity: binary_sensor.hm_sen_rd_o_qeq0808454_ch1
icon: mdi:weather-pouring
card_mod:
  style: |
    :host {
     {% if is_state('binary_sensor.hm_sen_rd_o_qeq0808454_ch1', 'on') %}
      --card-mod-icon:  mdi:weather-pouring;
      --card-mod-icon-color: #039dfc;
      {% else %}
      --card-mod-icon: mdi:weather-cloudy;
      --card-mod-icon-color: #f2f2f2;
      {% endif %}
     
    }
    .name {
       font-size: 20px !important;
       margin-top: px;
      }
    .value {
       font-size: 35px !important;
      margin-left: px !important;
      }
    .icon {
       --mdc-icon-size: 40px;
       margin-top: 25px;
       margin-right: -10px;
      }

Ich hoffe Ihr könnt mir helfen,

Gruß Jürgen

Hi Jürgen,

ich frage dazu immer gerne Gemini.
Das hat er ausgespuckt.
versuch es doch bitte mal.

type: entity
state_color: false
grid_options:
  columns: 6
  rows: 2
name: Regen # Dies bleibt der Titel der Karte
entity: binary_sensor.hm_sen_rd_o_qeq0808454_ch1

card_mod:
  style: |
    :host {
     {% if is_state('binary_sensor.hm_sen_rd_o_qeq0808454_ch1', 'on') %}
      --card-mod-icon:  mdi:weather-pouring;
      --card-mod-icon-color: #039dfc;
      {% else %}
      --card-mod-icon: mdi:weather-cloudy;
      --card-mod-icon-color: #f2f2f2;
      {% endif %}
    }
    .name {
       font-size: 20px !important;
       margin-top: 0px; 
      }
    .value { 
       font-size: 35px !important;
       margin-left: 0px !important; 
       visibility: hidden;
       position: relative;
       display: inline-block; 
      }
    .value::before { 
       content: ""; 
       visibility: visible; 
       position: absolute; 
       top: 0;
       left: 0;
       right: 0;
       bottom: 0;
       display: flex; 
       justify-content: center;
       align-items: center;
       line-height: 1;
    }
    /* Füge den Text "Regen" nur ein, wenn der Sensor 'on' ist */
    {% if is_state('binary_sensor.hm_sen_rd_o_qeq0808454_ch1', 'on') %}
      .value::before {
        content: "Regen";
      }
    {% endif %}

    .icon {
       --mdc-icon-size: 40px;
       margin-top: 25px;
       margin-right: -10px;
      }
1 „Gefällt mir“

Mit .value::before sollte das auf jeden Fall funktionieren. Nutze ich bei mir auch an der eine oder anderen Stelle.

Hi Daniel, Jan

Danke für eure Antwort. Habe nur „Siri“, die ist weiterhin Dumm trotz großem update… :stuck_out_tongue_winking_eye:

Also das mit dem Text „Regen“ anstatt „Nass“ funktioniert.
Allerdings habe ich jetzt bei kein Regen auch kein Text, vorher „Trocken“.
Dies hätte ich schon gerne behalten, kannst da bitte nochmal schauen?
(Es regnet nicht = Trocken, es regnet = Regen)

Vielen Dank und Gruß Jürgen

Du musst jetzt einfach nur noch den Teil else hinzufügen.
Also bei on Regen und bei off Trocken anzeigen. :slight_smile:

type: entity
state_color: false
grid_options:
  columns: 6
  rows: 2
name: Regen # Dies bleibt der Titel der Karte
entity: binary_sensor.hm_sen_rd_o_qeq0808454_ch1

card_mod:
  style: |
    :host {
     {% if is_state('binary_sensor.hm_sen_rd_o_qeq0808454_ch1', 'on') %}
      --card-mod-icon:  mdi:weather-pouring;
      --card-mod-icon-color: #039dfc;
      {% else %}
      --card-mod-icon: mdi:weather-cloudy;
      --card-mod-icon-color: #f2f2f2;
      {% endif %}
    }
    .name {
       font-size: 20px !important;
       margin-top: 0px; 
      }
    .value { 
       font-size: 35px !important;
       margin-left: 0px !important; 
       visibility: hidden;
       position: relative;
       display: inline-block; 
      }
    .value::before { 
       content: ""; 
       visibility: visible; 
       position: absolute; 
       top: 0;
       left: 0;
       right: 0;
       bottom: 0;
       display: flex; 
       justify-content: center;
       align-items: center;
       line-height: 1;
    }
    {% if is_state('binary_sensor.hm_sen_rd_o_qeq0808454_ch1', 'on') %}
    .value::before {
      content: "Regen";
    }
    {% else %}
      .value::before {
        content: "Trocken";
      }
    {% endif %}
    .icon {
       --mdc-icon-size: 40px;
       margin-top: 25px;
       margin-right: -10px;
      }
1 „Gefällt mir“

Unglaublich, bin selber drauf gekommen:

Mit zusätzlichem einfügen von

      {% else %}
       .value::before {
        content: "Trocken";
        }

funktioniert es.

Der komplette Code wäre dann:

type: entity
state_color: false
grid_options:
  columns: 6
  rows: 2
name: Regen
entity: binary_sensor.hm_sen_rd_o_qeq0808454_ch1
card_mod:
  style: |
    :host {
     {% if is_state('binary_sensor.hm_sen_rd_o_qeq0808454_ch1', 'on') %}
      --card-mod-icon:  mdi:weather-pouring;
      --card-mod-icon-color: #039dfc;
      {% else %}
      --card-mod-icon: mdi:weather-cloudy;
      --card-mod-icon-color: #f2f2f2;
      {% endif %}
    }
    .name {
       font-size: 20px !important;
       margin-top: 0px; 
      }
    .value { 
       font-size: 35px !important;
       margin-left: 0px !important; 
       visibility: hidden;
       position: relative;
       display: inline-block; 
      }
    .value::before { 
       content: ""; 
       visibility: visible; 
       position: absolute; 
       top: 0;
       left: 0;
       right: 0;
       bottom: 0;
       display: flex; 
       justify-content: center;
       align-items: center;
       line-height: 1;
    }
    /* Füge den Text "Regen" nur ein, wenn der Sensor 'on' ist */
    {% if is_state('binary_sensor.hm_sen_rd_o_qeq0808454_ch1', 'on') %}
      .value::before {
        content: "Regen";
      }
      {% else %}
       .value::before {
        content: "Trocken";
        }
    {% endif %}

    .icon {
       --mdc-icon-size: 40px;
       margin-top: 25px;
       margin-right: -10px;
      }

Falls jemand braucht…
Ich danke euch für die Hilfe und Gruß

Jürgen

2 „Gefällt mir“

Ok, da warst du schneller, als ich schreiben konnte :grinning:

Ich feier trotzdem meinen kleinen Erfolg… :stuck_out_tongue_winking_eye:

jedenfalls vielen Dank für deine Hilfe
und Gruß Jürgen

1 „Gefällt mir“

Top… :+1: :slight_smile: So lernt man am besten dazu, einfach ausprobieren, dabei kann man erstmal nichts kaputt machen.

2 „Gefällt mir“

gemini ist frei und kostet nichts.
einfach loslegen. :grinning:

1 „Gefällt mir“