-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaking out additional info into own entities? #8
Comments
Hi, I'd be keen for this information as well. Thanks! |
The easiest way is to create a sensor template. One sensor per attibute
test_bmi = name sensor (sensor.test_bmi) (sensor.test_water)....... |
Thanks very much! I'll give that a go tonight. |
I am a little bit confused on this one... this is an HA config, .test i the name of the esphome integration? |
It is a sensor template in ha. Test in model {{ state_attr('bodymiscale.name', 'bmi') }} |
ok got it.. here is small bash script to generate sensors for all the attributes. all you need to provide as argument is the user names as defined in esphome (user1,... in the example) #!/usr/bin/env bash
user=$1
attr=(bmi basal_metabolism visceral_fat ideal bmi_label lean_body_mass body_fat water bone_mass muscle_mass fat_mass_to_lose fat_mass_to_gain protein body_type body_score metabolic_age)
units=(None kcal None kg None kg % % kg kg kg kg % None None years)
echo "- platform: template"
echo " sensors:"
i=0
for a in ${attr[*]}; do
echo " ${a}_$user:
friendly_name: \"${user^}'s ${a/_/ }\""
if [[ "${units[i]}" != "None" ]]; then
echo " unit_of_measurement: \"${units[i]}\""
fi
echo " value_template: >
{{ state_attr('bodymiscale.$user', '$a') }}"
((i++))
done
update to have units |
above example is fine, if you want to use platform template..
i assumed in configuration.yaml one has
a script to generate all for a user #!/usr/bin/env bash
user=$1
attr=(bmi basal_metabolism visceral_fat ideal bmi_label lean_body_mass body_fat water bone_mass muscle_mass fat_mass_to_lose fat_mass_to_gain protein body_type body_score metabolic_age)
units=(No kcal No kg No kg % % kg kg kg kg % No No years)
i=0
for a in ${attr[*]}; do
echo "- sensor:
- name: \"${a/_/ } $user\""
echo " unit_of_measurement: \"${units[i]}\""
echo " state: >
{{ state_attr('bodymiscale.$user', '$a') }}
state_class: measurement"
((i++))
done this approach shall make sensors available in statistics for HA. |
Your approach is very interesting. But if I understood correctly that makes your script limited to esphome? For example, for my part, I no longer use esphome for users, only for weight and impedance data. Now I have node red which sends me a notification so that I select the person who weighs himself. This card and component should be open to the other solution. |
yap this assumes person selection is done at esphome level... I like it like that ideally all the processing will be nice to happen their so HA just displays... all I tried there was to generalise you solution from there and in second to port it to the template integration which supposes to be better for stats. |
Hi, thanks for the component. How would I break out the individual measurements such as Body fat, Visceral fat or BMI into their own entities so I can track them over time with things like Grafana? Thank you!
The text was updated successfully, but these errors were encountered: