Wert in configuration.yaml umrechnen

was soll denn die WLAN-Stärke in % aussagen? Nur, das es schon mal besser oder schlechter war? Warum lässt man das nicht so wie es ist? Signalstärke wird nun mal in dBm gemessen, also eine logarithmische Einheit auf den Leistungspegel des Signals in Bezug auf ein Milliwatt.
 
Ich habe mehrere/viele Anzeigen über die WLAN-Stärke in meinem HA (Steckdosen, ESP's usw.) und alle sind in %.... Nur dieser eine nicht, und das ärgert meinen inneren Monk...
Ob nun % oder dBm genauer sind, ist mir egal... ich möchte es einfach einheitlich haben, bekomme es aber leider selber nicht hin...

Greetz
Günni
 
Gibt ein sehr langes und unübersichtliches template, aber wenn man es möchte muss man sich die Arbeit machen,

Hier mal zur Übersicht wie sich wlan verhält


dbm-to-percent-800x468.png


dBmPercentagedBmPercentagedBmPercentagedBmPercentage
-1100-2698-5178-7638
-2100-2797-5276-7736
-3100-2897-5375-7834
-4100-2996-5474-7932
-5100-3096-5573-8030
-6100-3195-5671-8128
-7100-3295-5770-8226
-8100-3394-5869-8324
-9100-3493-5967-8422
-10100-3593-6066-8520
-11100-3692-6164-8617
-12100-3791-6263-8715
-13100-3890-6361-8813
-14100-3990-6460-8910
-15100-4089-6558-908
-16100-4188-6656-916
-17100-4287-6755-923
-18100-4386-6853-931
-19100-4485-6951-941
-20100-4584-7050-951
-2199-4683-7148-961
-2299-4782-7246-971
-2399-4881-7344-981
-2498-4980-7442-991
-2598-5079-7540-1001
 
wenn würde ich z.B. in 3 Balken umrechnen, wie z.B. auch so ähnlich im Smartphone
also z.B.:

-30 bis -60dBm – Sehr gute Signalstärke
-60 bis -80dBm – ausreichende Signalstärke
unter -80dBm – schwaches unzureichendes Signal
 
Die Formel setzt eine lineare Verteilung der Prozente vorraus, das ja falsch ist, weil das ja eine Kurve ist und keine Gerade.
 
Du must einen template sensor anlegen ähnlich diesem hier nur eben für die unterschiedlichen Werte deiner Signalstärke

Bsp...
YAML:
# Mondphase Bild_version_01
  - sensor:
    - name: 'der Mond'
      unique_id: der_mond
      state: >
        {% if is_state('sensor.moon_phase', 'new_moon') %}
           Neumond
        {% elif is_state('sensor.moon_phase', 'waxing_crescent') %}
           Zuhnemender Sichelmond     
        {% elif is_state('sensor.moon_phase', 'first_quarter') %}
           Zunehmender Halbmond
        {% elif is_state('sensor.moon_phase', 'waxing_gibbous') %}
           Zuhnemender Dreiviertelmond
        {% elif is_state('sensor.moon_phase', 'full_moon') %}
           Vollmond
        {% elif is_state('sensor.moon_phase', 'waning_gibbous') %}
           Abnehmender Deiviertelmond
        {% elif is_state('sensor.moon_phase', 'last_quarter') %}
           Abnehmender Halbmond
        {% elif is_state('sensor.moon_phase', 'waning_crescent') %}
           Abnehmender Sichelmond
        {% endif %}
 
warscheinlich muss man das so irgendwie machen:

YAML:
    - name: "WLAN Prozent"
      unit_of_measurement: '%'
      state: >
        {% if   state('sensor.wifi-signal') >= -20 %} 100
        {% elif state('sensor.wifi-signal') >= -23 AND state('sensor.wifi-signal') < -20 %} 99   
        {% elif state('sensor.wifi-signal') >= -26 AND state('sensor.wifi-signal') < -23 %} 98
        .....
        {% endif %}
 
Verstehe ich grad nicht... unter dem von mir 2x geposteten Link ist folgendes zu sehen:

Code:
- platform: copy # Reports the WiFi signal strength in %
    source_id: wifi_signal_db
    name: "WiFi Signal Percent"
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "Signal %"
    entity_category: "diagnostic"

Was ist an der Berechnung falsch...?
 
Da wird der minimaler und der maximale Wert genommen und dazwischen eine Linie gezogen und die Prozente Prozentual genommen. Wie in der Grafik von alexamend die orangene Gerade. Aber die Prozente laufen nicht linear, sondern folgen der blauen Kurve
 
Zuletzt bearbeitet:
Danke für deine Erklärung , jetzt hab ichs verstanden :)

Dann werde ich mir wohl die Arbeit machen und alle Werte entsprechend der Tabelle umrechnen....
 
je nachdem wie die da den min und max Wert ermitelt haben, hat die o.g. Formel vieleicht nur 20% Abweichung und nicht 30%. Aber trotzdem doof.

1680451341302.png
 
also so geht's

YAML:
    - name: "wifi_signal_in_prozent"
      unit_of_measurement: '%'
      state: >
        {% set wifi = states('sensor.wifi_signal_in_dbm') | float %}
        {% if   wifi >= -20 %} 100
        {% elif wifi >= -23 and wifi < -20 %} 99  
        {% elif wifi >= -26 and wifi < -23 %} 98
        {% elif wifi >= -28 and wifi < -26 %} 97
        {% elif wifi >= -30 and wifi < -28 %} 96
        {% elif wifi >= -32 and wifi < -30 %} 95
        {% elif wifi >= -33 and wifi < -32 %} 94
        {% elif wifi >= -35 and wifi < -33 %} 93
        {% elif wifi >= -36 and wifi < -35 %} 92
        {% elif wifi >= -37 and wifi < -36 %} 91
        {% elif wifi >= -39 and wifi < -37 %} 90
        {% elif wifi >= -40 and wifi < -39 %} 89
        {% elif wifi >= -41 and wifi < -40 %} 88
        {% elif wifi >= -42 and wifi < -41 %} 87
        {% elif wifi >= -43 and wifi < -42 %} 86
        {% elif wifi >= -44 and wifi < -43 %} 85
        {% elif wifi >= -45 and wifi < -44 %} 84
        {% elif wifi >= -46 and wifi < -45 %} 83
        {% elif wifi >= -47 and wifi < -46 %} 82
        {% elif wifi >= -48 and wifi < -37 %} 81
        {% elif wifi >= -49 and wifi < -48 %} 80
        {% elif wifi >= -50 and wifi < -49 %} 79
        {% elif wifi >= -51 and wifi < -50 %} 78
        {% elif wifi >= -52 and wifi < -51 %} 76
        {% elif wifi >= -53 and wifi < -52 %} 75
        {% elif wifi >= -54 and wifi < -53 %} 73
        {% elif wifi >= -55 and wifi < -54 %} 71
        {% elif wifi >= -56 and wifi < -55 %} 70
        {% elif wifi >= -57 and wifi < -56 %} 69
        {% elif wifi >= -58 and wifi < -57 %} 67
        {% elif wifi >= -59 and wifi < -58 %} 66
        {% elif wifi >= -60 and wifi < -59 %} 64
        {% elif wifi >= -61 and wifi < -60 %} 63
        {% elif wifi >= -62 and wifi < -61 %} 61
        {% elif wifi >= -63 and wifi < -62 %} 60
        {% elif wifi >= -64 and wifi < -63 %} 58
        {% elif wifi >= -65 and wifi < -64 %} 56
        {% elif wifi >= -66 and wifi < -65 %} 55
        {% elif wifi >= -67 and wifi < -66 %} 53
        {% elif wifi >= -68 and wifi < -67 %} 51
        {% elif wifi >= -69 and wifi < -68 %} 50
        {% elif wifi >= -70 and wifi < -69 %} 48
        {% elif wifi >= -71 and wifi < -70 %} 46
        {% elif wifi >= -72 and wifi < -71 %} 44
        {% elif wifi >= -73 and wifi < -72 %} 42
        {% elif wifi >= -74 and wifi < -73 %} 40
        {% elif wifi >= -75 and wifi < -74 %} 38
        {% elif wifi >= -76 and wifi < -75 %} 36
        {% elif wifi >= -77 and wifi < -76 %} 34
        {% elif wifi >= -78 and wifi < -77 %} 32
        {% elif wifi >= -79 and wifi < -78 %} 30
        {% elif wifi >= -80 and wifi < -79 %} 28
        {% elif wifi >= -81 and wifi < -80 %} 26
        {% elif wifi >= -82 and wifi < -81 %} 24
        {% elif wifi >= -83 and wifi < -82 %} 22
        {% elif wifi >= -84 and wifi < -83 %} 20
        {% elif wifi >= -85 and wifi < -84 %} 17
        {% elif wifi >= -86 and wifi < -85 %} 15
        {% elif wifi >= -87 and wifi < -86 %} 13
        {% elif wifi >= -88 and wifi < -87 %} 10
        {% elif wifi >= -89 and wifi < -88 %} 8
        {% elif wifi >= -90 and wifi < -89 %} 6
        {% elif wifi >= -91 and wifi < -90 %} 3
        {% elif wifi >= -93 %} 1
        {% endif %}

siehe:
1680463024688.png
 
Vielenvielenvielen Dank für deine Hilfe und die Arbeit für das Erstellen von dem Script :)
Das hilft mir sehr :)

Greetz
Günni
 
also so geht's

YAML:
    - name: "wifi_signal_in_prozent"
      unit_of_measurement: '%'
      state: >
        {% set wifi = states('sensor.wifi_signal_in_dbm') | float %}
        {% if   wifi >= -20 %} 100
        {% elif wifi >= -23 and wifi < -20 %} 99 
        {% elif wifi >= -26 and wifi < -23 %} 98
        {% elif wifi >= -28 and wifi < -26 %} 97
        {% elif wifi >= -30 and wifi < -28 %} 96
        {% elif wifi >= -32 and wifi < -30 %} 95
        {% elif wifi >= -33 and wifi < -32 %} 94
        {% elif wifi >= -35 and wifi < -33 %} 93
        {% elif wifi >= -36 and wifi < -35 %} 92
        {% elif wifi >= -37 and wifi < -36 %} 91
        {% elif wifi >= -39 and wifi < -37 %} 90
        {% elif wifi >= -40 and wifi < -39 %} 89
        {% elif wifi >= -41 and wifi < -40 %} 88
        {% elif wifi >= -42 and wifi < -41 %} 87
        {% elif wifi >= -43 and wifi < -42 %} 86
        {% elif wifi >= -44 and wifi < -43 %} 85
        {% elif wifi >= -45 and wifi < -44 %} 84
        {% elif wifi >= -46 and wifi < -45 %} 83
        {% elif wifi >= -47 and wifi < -46 %} 82
        {% elif wifi >= -48 and wifi < -37 %} 81
        {% elif wifi >= -49 and wifi < -48 %} 80
        {% elif wifi >= -50 and wifi < -49 %} 79
        {% elif wifi >= -51 and wifi < -50 %} 78
        {% elif wifi >= -52 and wifi < -51 %} 76
        {% elif wifi >= -53 and wifi < -52 %} 75
        {% elif wifi >= -54 and wifi < -53 %} 73
        {% elif wifi >= -55 and wifi < -54 %} 71
        {% elif wifi >= -56 and wifi < -55 %} 70
        {% elif wifi >= -57 and wifi < -56 %} 69
        {% elif wifi >= -58 and wifi < -57 %} 67
        {% elif wifi >= -59 and wifi < -58 %} 66
        {% elif wifi >= -60 and wifi < -59 %} 64
        {% elif wifi >= -61 and wifi < -60 %} 63
        {% elif wifi >= -62 and wifi < -61 %} 61
        {% elif wifi >= -63 and wifi < -62 %} 60
        {% elif wifi >= -64 and wifi < -63 %} 58
        {% elif wifi >= -65 and wifi < -64 %} 56
        {% elif wifi >= -66 and wifi < -65 %} 55
        {% elif wifi >= -67 and wifi < -66 %} 53
        {% elif wifi >= -68 and wifi < -67 %} 51
        {% elif wifi >= -69 and wifi < -68 %} 50
        {% elif wifi >= -70 and wifi < -69 %} 48
        {% elif wifi >= -71 and wifi < -70 %} 46
        {% elif wifi >= -72 and wifi < -71 %} 44
        {% elif wifi >= -73 and wifi < -72 %} 42
        {% elif wifi >= -74 and wifi < -73 %} 40
        {% elif wifi >= -75 and wifi < -74 %} 38
        {% elif wifi >= -76 and wifi < -75 %} 36
        {% elif wifi >= -77 and wifi < -76 %} 34
        {% elif wifi >= -78 and wifi < -77 %} 32
        {% elif wifi >= -79 and wifi < -78 %} 30
        {% elif wifi >= -80 and wifi < -79 %} 28
        {% elif wifi >= -81 and wifi < -80 %} 26
        {% elif wifi >= -82 and wifi < -81 %} 24
        {% elif wifi >= -83 and wifi < -82 %} 22
        {% elif wifi >= -84 and wifi < -83 %} 20
        {% elif wifi >= -85 and wifi < -84 %} 17
        {% elif wifi >= -86 and wifi < -85 %} 15
        {% elif wifi >= -87 and wifi < -86 %} 13
        {% elif wifi >= -88 and wifi < -87 %} 10
        {% elif wifi >= -89 and wifi < -88 %} 8
        {% elif wifi >= -90 and wifi < -89 %} 6
        {% elif wifi >= -91 and wifi < -90 %} 3
        {% elif wifi >= -93 %} 1
        {% endif %}

siehe:
Anhang anzeigen 3533
Hallo,

genau so hätte ich es gerne. Leider bekomme ich das nicht hin, bin "noch" neu in der ESPHome-Welt.

Meine .yaml seiht so aus:

Code:
  - platform: wifi_signal
    name: "${device_name}"
    id: wifi_signal_db
    update_interval: 60s
    entity_category: "diagnostic"

  - platform: copy # Reports the WiFi signal strength in %
    source_id: wifi_signal_db
    name: "wifi_signal_in_prozent"
    unit_of_measurement: '%'
    state: >
      {% set wifi = states('sensor.wifi_signal_in_dbm') | float %}
      {% if   wifi >= -20 %} 100
      {% elif wifi >= -23 and wifi < -20 %} 99 
      {% elif wifi >= -26 and wifi < -23 %} 98
      {% elif wifi >= -28 and wifi < -26 %} 97
      {% elif wifi >= -30 and wifi < -28 %} 96
      {% elif wifi >= -32 and wifi < -30 %} 95
      {% elif wifi >= -33 and wifi < -32 %} 94
      {% elif wifi >= -35 and wifi < -33 %} 93
      {% elif wifi >= -36 and wifi < -35 %} 92
      {% elif wifi >= -37 and wifi < -36 %} 91
      {% elif wifi >= -39 and wifi < -37 %} 90
      {% elif wifi >= -40 and wifi < -39 %} 89
      {% elif wifi >= -41 and wifi < -40 %} 88
      {% elif wifi >= -42 and wifi < -41 %} 87
      {% elif wifi >= -43 and wifi < -42 %} 86
      {% elif wifi >= -44 and wifi < -43 %} 85
      {% elif wifi >= -45 and wifi < -44 %} 84
      {% elif wifi >= -46 and wifi < -45 %} 83
      {% elif wifi >= -47 and wifi < -46 %} 82
      {% elif wifi >= -48 and wifi < -37 %} 81
      {% elif wifi >= -49 and wifi < -48 %} 80
      {% elif wifi >= -50 and wifi < -49 %} 79
      {% elif wifi >= -51 and wifi < -50 %} 78
      {% elif wifi >= -52 and wifi < -51 %} 76
      {% elif wifi >= -53 and wifi < -52 %} 75
      {% elif wifi >= -54 and wifi < -53 %} 73
      {% elif wifi >= -55 and wifi < -54 %} 71
      {% elif wifi >= -56 and wifi < -55 %} 70
      {% elif wifi >= -57 and wifi < -56 %} 69
      {% elif wifi >= -58 and wifi < -57 %} 67
      {% elif wifi >= -59 and wifi < -58 %} 66
      {% elif wifi >= -60 and wifi < -59 %} 64
      {% elif wifi >= -61 and wifi < -60 %} 63
      {% elif wifi >= -62 and wifi < -61 %} 61
      {% elif wifi >= -63 and wifi < -62 %} 60
      {% elif wifi >= -64 and wifi < -63 %} 58
      {% elif wifi >= -65 and wifi < -64 %} 56
      {% elif wifi >= -66 and wifi < -65 %} 55
      {% elif wifi >= -67 and wifi < -66 %} 53
      {% elif wifi >= -68 and wifi < -67 %} 51
      {% elif wifi >= -69 and wifi < -68 %} 50
      {% elif wifi >= -70 and wifi < -69 %} 48
      {% elif wifi >= -71 and wifi < -70 %} 46
      {% elif wifi >= -72 and wifi < -71 %} 44
      {% elif wifi >= -73 and wifi < -72 %} 42
      {% elif wifi >= -74 and wifi < -73 %} 40
      {% elif wifi >= -75 and wifi < -74 %} 38
      {% elif wifi >= -76 and wifi < -75 %} 36
      {% elif wifi >= -77 and wifi < -76 %} 34
      {% elif wifi >= -78 and wifi < -77 %} 32
      {% elif wifi >= -79 and wifi < -78 %} 30
      {% elif wifi >= -80 and wifi < -79 %} 28
      {% elif wifi >= -81 and wifi < -80 %} 26
      {% elif wifi >= -82 and wifi < -81 %} 24
      {% elif wifi >= -83 and wifi < -82 %} 22
      {% elif wifi >= -84 and wifi < -83 %} 20
      {% elif wifi >= -85 and wifi < -84 %} 17
      {% elif wifi >= -86 and wifi < -85 %} 15
      {% elif wifi >= -87 and wifi < -86 %} 13
      {% elif wifi >= -88 and wifi < -87 %} 10
      {% elif wifi >= -89 and wifi < -88 %} 8
      {% elif wifi >= -90 and wifi < -89 %} 6
      {% elif wifi >= -91 and wifi < -90 %} 3
      {% elif wifi >= -93 %} 1
      {% endif %}
    entity_category: "diagnostic"
 
er bemängelt "[state] is an invalid option for [sensor.copy]. Did you mean [state_topic], [state_class]?"
Ich habe ein Shelly Plus 1PM.
 

Zurzeit aktive Besucher

Keine Mitglieder online.

Letzte Anleitungen

Statistik des Forums

Themen
4.833
Beiträge
48.798
Mitglieder
4.488
Neuestes Mitglied
connect
Zurück
Oben