Compare commits
2 Commits
54846a8b7e
...
ccecb85c27
| Author | SHA1 | Date | |
|---|---|---|---|
| ccecb85c27 | |||
| c50a941c4a |
1129
home_assistant/dashboard_config.yaml
Normal file
1129
home_assistant/dashboard_config.yaml
Normal file
File diff suppressed because it is too large
Load Diff
158
home_assistant/fitness_tracking.yaml
Normal file
158
home_assistant/fitness_tracking.yaml
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
# /config/packages/fitness_tracking.yaml
|
||||||
|
|
||||||
|
template:
|
||||||
|
sensor:
|
||||||
|
# 3. Personen-Erkennung (Deine Logik, leicht bereinigt)
|
||||||
|
- name: "Prasanna Weight"
|
||||||
|
unique_id: prasanna_weight_correct
|
||||||
|
unit_of_measurement: "kg"
|
||||||
|
state: >
|
||||||
|
{% set weight = states("sensor.prasanna_weight") | float(0) %}
|
||||||
|
{% set limit = states("input_number.prasanna_korpergewicht_minimum") %}
|
||||||
|
|
||||||
|
{% if weight > limit %}
|
||||||
|
{{ weight }}
|
||||||
|
{% else %}
|
||||||
|
{{ states("sensor.prasanna_weight_correct") }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
- name: "Jathusha Weight Tracking"
|
||||||
|
unique_id: jathusha_weight_tracking
|
||||||
|
unit_of_measurement: "kg"
|
||||||
|
state: >
|
||||||
|
{% if states("sensor.prasanna_weight") < states("input_number.prasanna_korpergewicht_minimum") -%}
|
||||||
|
{{states("sensor.prasanna_weight")}}
|
||||||
|
{% else %}
|
||||||
|
{{this.state}}
|
||||||
|
{% endif -%}
|
||||||
|
|
||||||
|
- name: "Gewichtsentwicklung nach 7 Tagen"
|
||||||
|
unique_id: weight_weekly_difference
|
||||||
|
unit_of_measurement: "g"
|
||||||
|
state_class: measurement
|
||||||
|
state: >
|
||||||
|
{% set current_weight = states("sensor.prasanna_weight_correct") | float(0) %}
|
||||||
|
{% set last_week_weight = states("sensor.prasanna_weight_last_weekday") | float(0) %}
|
||||||
|
{% if current_weight > 0 and last_week_weight > 0 %}
|
||||||
|
{{((current_weight - last_week_weight)*1000) | round(0)}}
|
||||||
|
{% else %}
|
||||||
|
0
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
- name: "Gewichtsentwicklung nach 7 Tagen Durchschnitt"
|
||||||
|
unique_id: weight_weekly_avg_difference
|
||||||
|
unit_of_measurement: "g"
|
||||||
|
state_class: measurement
|
||||||
|
state: >
|
||||||
|
{% set current_weight = states("sensor.prasanna_weight_correct") | float(0) %}
|
||||||
|
{% set last_week_weight = states("sensor.prasanna_weight_last_week_avg") | float(0) %}
|
||||||
|
{% if current_weight > 0 and last_week_weight > 0 %}
|
||||||
|
{{((current_weight - last_week_weight)*1000) | round(0)}}
|
||||||
|
{% else %}
|
||||||
|
0
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
- name: "Prasanna: Gewichtstrend Status (Smart)"
|
||||||
|
unique_id: prasanna_smart_trend
|
||||||
|
icon: mdi:scale-balance
|
||||||
|
state: >
|
||||||
|
{# Wir holen den geglätteten 7-Tage Durchschnitt #}
|
||||||
|
{% set avg_now = states('sensor.prasanna_gewicht_7_tage_durchschnitt') | float(0) %}
|
||||||
|
|
||||||
|
{# Wir simulieren den Vergleichswert (hier vereinfacht: aktueller Durchschnitt vs. Wert vor 7 Tagen #}
|
||||||
|
{# Für eine echte Trendlinie bräuchtest du einen SQL Sensor oder 'utility_meter' mit cycle weekly #}
|
||||||
|
{# Workaround: Wir nutzen den Unterschied zwischen 'jetzt' und dem Wochen-Schnitt #}
|
||||||
|
|
||||||
|
{% set current = states('sensor.prasanna_weight_correct') | float(0) %}
|
||||||
|
{# Delta: Ist der heutige Tag über oder unter meinem Wochendurchschnitt? #}
|
||||||
|
{% set delta = (current - avg_now) * 1000 %}
|
||||||
|
|
||||||
|
{# HIER IST DIE MAGIE: Wir bewerten den Trend, nicht den Tag #}
|
||||||
|
{# Angenommenes Ziel: Leichter Muskelaufbau (Lean Bulk) #}
|
||||||
|
|
||||||
|
{% if delta > 500 %}
|
||||||
|
Achtung: Schnelle Zunahme (Wasser/Fett?)
|
||||||
|
{% elif delta > 100 %}
|
||||||
|
Optimaler Aufbau-Trend (+{{ delta | round(0) }}g)
|
||||||
|
{% elif delta >= -200 and delta <= 200 %}
|
||||||
|
Gewicht stabil (Erhalt)
|
||||||
|
{% elif delta < -500 %}
|
||||||
|
Achtung: Zu schnelle Abnahme
|
||||||
|
{% else %}
|
||||||
|
Leichte Abnahme
|
||||||
|
{% endif %}
|
||||||
|
attributes:
|
||||||
|
delta_gramm: >
|
||||||
|
{{ ((states('sensor.prasanna_weight_correct') | float(0) - states('sensor.prasanna_gewicht_7_tage_durchschnitt') | float(0)) * 1000) | round(0) }}
|
||||||
|
- name: "Jathusha: Gewichtstrend Status (Smart)"
|
||||||
|
unique_id: jathusha_smart_trend
|
||||||
|
icon: mdi:scale-balance
|
||||||
|
state: >
|
||||||
|
{# Wir holen den geglätteten 7-Tage Durchschnitt #}
|
||||||
|
{% set avg_now = states('sensor.jathusha_gewicht_7_tage_durchschnitt') | float(0) %}
|
||||||
|
|
||||||
|
{# Wir simulieren den Vergleichswert (hier vereinfacht: aktueller Durchschnitt vs. Wert vor 7 Tagen #}
|
||||||
|
{# Für eine echte Trendlinie bräuchtest du einen SQL Sensor oder 'utility_meter' mit cycle weekly #}
|
||||||
|
{# Workaround: Wir nutzen den Unterschied zwischen 'jetzt' und dem Wochen-Schnitt #}
|
||||||
|
|
||||||
|
{% set current = states('sensor.jathusha_weight_tracking') | float(0) %}
|
||||||
|
{# Delta: Ist der heutige Tag über oder unter meinem Wochendurchschnitt? #}
|
||||||
|
{% set delta = (current - avg_now) * 1000 %}
|
||||||
|
|
||||||
|
{# HIER IST DIE MAGIE: Wir bewerten den Trend, nicht den Tag #}
|
||||||
|
{# Angenommenes Ziel: Leichter Muskelaufbau (Lean Bulk) #}
|
||||||
|
|
||||||
|
{% if delta > 500 %}
|
||||||
|
Achtung: Schnelle Zunahme (Wasser/Fett?)
|
||||||
|
{% elif delta > 100 %}
|
||||||
|
Optimaler Aufbau-Trend (+{{ delta | round(0) }}g)
|
||||||
|
{% elif delta >= -200 and delta <= 200 %}
|
||||||
|
Gewicht stabil (Erhalt)
|
||||||
|
{% elif delta < -500 %}
|
||||||
|
Achtung: Zu schnelle Abnahme
|
||||||
|
{% else %}
|
||||||
|
Leichte Abnahme
|
||||||
|
{% endif %}
|
||||||
|
attributes:
|
||||||
|
delta_gramm: >
|
||||||
|
{{ ((states('sensor.jathusha_weight_tracking') | float(0) - states('sensor.jathusha_gewicht_7_tage_durchschnitt') | float(0)) * 1000) | round(0) }}
|
||||||
|
sensor:
|
||||||
|
- platform: statistics
|
||||||
|
name: "Prasanna Gewicht 7-Tage Durchschnitt"
|
||||||
|
unique_id: prasanna_gewicht_7_tage_durchschnitt
|
||||||
|
entity_id: sensor.prasanna_weight_correct
|
||||||
|
state_characteristic: mean
|
||||||
|
max_age:
|
||||||
|
days: 7
|
||||||
|
sampling_size: 20
|
||||||
|
precision: 1
|
||||||
|
- platform: statistics
|
||||||
|
name: "Jathusha Gewicht 7-Tage Durchschnitt"
|
||||||
|
unique_id: jathusha_gewicht_7_tage_durchschnitt
|
||||||
|
entity_id: sensor.jathusha_weight_tracking
|
||||||
|
state_characteristic: mean
|
||||||
|
max_age:
|
||||||
|
days: 7
|
||||||
|
sampling_size: 20
|
||||||
|
precision: 1
|
||||||
|
# 1. Statistik-Sensor (Glättet dein Gewicht über 7 Tage)
|
||||||
|
# Das eliminiert Wasser-Schwankungen. Das ist deine "echte" Masse.
|
||||||
|
- platform: statistics
|
||||||
|
name: "Prasanna Gewicht Durchschnitt"
|
||||||
|
unique_id: prasanna_weight_avg_stats
|
||||||
|
entity_id: sensor.prasanna_weight_correct
|
||||||
|
state_characteristic: mean
|
||||||
|
max_age:
|
||||||
|
days: 7
|
||||||
|
sampling_size: 50
|
||||||
|
precision: 2
|
||||||
|
# 2. Derivative Sensor (Die Magie für den Muskelaufbau)
|
||||||
|
# Berechnet, wie schnell dein Durchschnittsgewicht steigt oder fällt.
|
||||||
|
# Einheit wird umgerechnet auf "Veränderung pro Woche".
|
||||||
|
- platform: derivative
|
||||||
|
name: "Prasanna Zunahme pro Woche"
|
||||||
|
unique_id: prasanna_weight_gain_weekly
|
||||||
|
source_sensor: sensor.prasanna_gewicht_durchschnitt
|
||||||
|
unit_time: d # Berechne pro Tag
|
||||||
|
time_window: "3d" # Schaut sich den Trend der letzten 3 Tage an
|
||||||
|
unit: "kg"
|
||||||
Reference in New Issue
Block a user