dckiller51 / bodymiscale Goto Github PK
View Code? Open in Web Editor NEWCustom_components Body Metrics for Xiaomi Miscale 1 and 2 (esphome or BLE monitor for Homeassistant)
License: Apache License 2.0
Custom_components Body Metrics for Xiaomi Miscale 1 and 2 (esphome or BLE monitor for Homeassistant)
License: Apache License 2.0
This is more a question.
Is it possible to skip all data/update/states/attributes when a person is using a scale who is below 80Kg?
Reason is:
Me, main user of the intergration, is above 80Kg. But all others in our household are below 80Kg nd they are not interested in details exept weight the scale is showing when they use it.
But that destroyes my longterm data.
So, it is possible to avoid all data transferred or stored when the user is below 80Kg?
Of course, a multi user arrangment would be better, but for the beginning that would help to skip all below 80Kg.
Thanx
Can you put the age on Attributs ?
Originally posted by @dckiller51 in #104 (comment)
It probably is in kg or %.
Thanks for your great addition to home assistant :)
Hello I managed to integrate this component, as I am not receiving data, it is not clear to me if I should use this configuration in my esp32 module:
esphome:
name: bilancia_xiaomi
platform: ESP32
board: nodemcu-32s
wifi:
ssid: "WiFi"
password: "passwoidfoisuf4"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "NodeMcu"
password: "1234567890"
captive_portal:
# Enable Web server.
web_server:
port: 80
# Enable logging
logger:
## LED BLU ##
status_led:
pin:
number: GPIO2
inverted: false
# Enable Home Assistant API
api:
ota:
# abilita il tracking via BLE
esp32_ble_tracker:
sensor:
- platform: xiaomi_miscale2
mac_address: '70:87:9E:2D:CD:52'
weight:
name: "Xiaomi Mi Scale 2 Peso"
id: weight_miscale
on_value:
then:
- lambda: |-
if (id(weight_miscale).state >= 72 && id(weight_miscale).state <= 88.50) {
return id(peso_tiziano).publish_state(x);}
else if (id(weight_miscale).state >= 55.50 && id(weight_miscale).state <= 65) {
return id(peso_alice).publish_state(x);}
impedance:
name: "Xiaomi Mi Scale Impedenza"
id: impedance_xiaomi
on_value:
then:
- lambda: |-
if (id(weight_miscale).state >= 72 && id(weight_miscale).state <= 88.50) {
return id(impedenza_tiziano).publish_state(x);}
else if (id(weight_miscale).state >= 55.50 && id(weight_miscale).state <= 65) {
return id(impedenza_alice).publish_state(x);}
- platform: template
name: Peso Tiziano
id: peso_tiziano
unit_of_measurement: 'kg'
icon: mdi:weight-kilogram
accuracy_decimals: 2
- platform: template
name: Impedenza Tiziano
id: impedenza_tiziano
unit_of_measurement: 'ohm'
icon: mdi:omega
accuracy_decimals: 0
- platform: template
name: Peso Alice
id: peso_alice
unit_of_measurement: 'kg'
icon: mdi:weight-kilogram
accuracy_decimals: 2
- platform: template
name: Impedenza Alice
id: impedenza_alice
unit_of_measurement: 'ohm'
icon: mdi:omega
accuracy_decimals: 0
I have installed HA and Lauguage set to CHS but interface show me all in English.
Is there any way manully setting it to ZH-HANS?
Hi,
When I wanted to look at my weight development over the past months I realized that the weight and impedance are stored only for 10 days.
Is this an error in my installation or is this intended?
The point in having this integration in the first place is for me to see how I develop over time. Would highly appreciate if this can be changed
KR
Milan
I´ve done the BLE configuration in ESPHome and now I´ve two sensors (weight and impedance) working in my HA. I also installed your custom component and configurated the file bodymiscale.yaml. However the sensors created at bodmiyscale.yaml doesn´t show me any information about weight and impedance.
Should these sensors been vinculated to ESPHome sensors somehow?? In afirmative case, what should I do to get it?
Thanks
CONFIGURATION TABLE
#1
plateform (Required) | string | bodymiscale
Typo cause you meant platform
#2
name (Required) | string | Custom name for the sensor. bodymiscale.nom
at the end it should be most likely like in the card mean name instead of nom, so bodymiscale.name
#3
Then in the yaml file description I'd suggest to change the definition to the source sensor that is there when you had installed the miscale instead of using a specific one. I had struggled a lot, really about 10 hours to get it working simply due to my misunderstanding about the meaning of nom / name and the sensor. I did not get anything further without your help but I guess I would not have struggled if that would have been changed.
instead of weight: sensor.weight_aurelien
then sensor.ble_weight_mi_scale2
#4
and maybe a tiny bit more explanations below these 2 settings
[configuration.yaml]
bodymiscale: !include components/bodymiscale.yaml
[bodymiscale.yaml]
aurelien:
sensors:
weight: sensor.ble_weight_mi_scale2
height: 176
...
The configuration.yaml entry will create a plattform sensor called
bodymiscale
.
The name of the sensor itself is defined in the bodymiscale.yaml file in the first line byaurelien:
To check if the configruation is working properly go to the developer tools and look for the values of the
bodymiscale sensor by typing bodymiscale . You should see a sensor in this case called bodymicale.aurelien which has a lot of values (number of values shown is depending on your scale model).
Not so many changes but will reduce the demand of support and struggles - hopefully.
Hi there,
Thanks for the great add-on. I have this working with an ESPHome BLE scanner using the code below. While the weight comes in within a few seconds, if I update ESPHome on the BLE scanner (something that happens regularly), the captured weight reading is lost and the entities return a state of unknown.
I believe this may also happen sometimes when I restart HA but I haven't categorically proven that yet.
Is there something I'm missing to make the data state in Home Assistant permanent?
sensor:
- platform: xiaomi_miscale
mac_address: 'xx:xxx:xx:xx:xx'
weight:
name: "Xiaomi Mi Scale Weight"
id: weight_miscale
on_value:
then:
- lambda: |-
if (id(weight_miscale).state >= 67 && id(weight_miscale).state <= 80) {
return id(weight_user1).publish_state(x);}
else if (id(weight_miscale).state >= 45 && id(weight_miscale).state <= 65) {
return id(weight_user2).publish_state(x);}
- platform: template
state_class: measurement
name: Weight Pete
id: weight_user1
unit_of_measurement: 'kg'
icon: mdi:weight-kilogram
accuracy_decimals: 2
- platform: template
state_class: measurement
name: Weight Ali
id: weight_user2
unit_of_measurement: 'kg'
icon: mdi:weight-kilogram
accuracy_decimals: 2
hello the folder /config/components non exist, why?
After doing the installation using the repository documentation, I restarted and this error message appeared in the HA logs:
Logger: homeassistant.setup
Source: custom_components/bodymiscale/init.py:280
First occurred: 12:16:14 (1 occurrences)
Last logged: 12:16:14
Error during setup of component bodymiscale
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
result = await task
File "/config/custom_components/bodymiscale/init.py", line 114, in async_setup
await component.async_add_entities(entities)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 317, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 509, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 530, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 295, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 321, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/config/custom_components/bodymiscale/init.py", line 280, in state_attributes
ATTR_WEIGHT: "{:.2f}".format(weight),
TypeError: unsupported format string passed to NoneType.format
bodymiscale: !include components/bodymiscale.yaml
My file: /config/components/bodymiscale.yaml
aurelien:
sensors:
weight: sensor.weight_aurelien
impedance: sensor.impedance_aurelien
height: 183
born: "1978-02-08"
gender: "male"
# model_miscale: "181B"
Logger: custom_components.bodymiscale
Source: custom_components/bodymiscale/__init__.py:280
Integration: bodymiscale (documentation)
First occurred: 12:16:14 (1 occurrences)
Last logged: 12:16:14
Error adding entities for domain bodymiscale with platform bodymiscale
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 317, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 509, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 530, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 295, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 321, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/config/custom_components/bodymiscale/__init__.py", line 280, in state_attributes
ATTR_WEIGHT: "{:.2f}".format(weight),
TypeError: unsupported format string passed to NoneType.__format__
Hi,
would it be possible to read the BLE advertisments of the honor scale 2 (LUP-B19) with this component?
Hello,
I have a Huawei AH100 scale, with very similar parameters to the Xiaomi described.
Would it be possible to integrate it?
Can I do it manually or could I contribute by provididng more data, testing etc?
Thanks in advance,
Robert
can not modify the height, weight and Impedance options on the GUI
Could the ReadMe be updated with the units of measurement that the generated data is in, please?
e.g weight (lbs or kg), bone mass etc.
Not sure if this is expected. Everytime restart HA, all data from bodymiscale will lose and status will become problem.
I suggest to cut round to 0 or 1 decimal.
The ideal kg with 2 decimals are as misleading as the bmi and visceral fat and basal metabolism of 1515,97 kcal.
Most likely 0 decimals should be enough, maybe bmi with 1 decimal.
I guess that has to be done here and not in the card where I saw these figures.
i tried to use stats graphs in ha but none of the sensors from miscale shows.
bodymiscale.userxxx needs to have state_class: 'measurement' set
default is none
see more here https://www.home-assistant.io/more-info/statistics/
I need to capture the data individually, to use in graphics and other ideas that I have. Currently it is not possible, as the sensors are grouped and are displayed in a modal, for example sensor.weight_aurelien.
I need the Visceral fat sensor, but it is not possible to obtain the data, since it is grouped. Is it possible to separate?
It looks like the integration does not handle the situation where one sensor has updated and the other has not at startup.
It needs to wait until HA reports it has finished setting up.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 273, in _async_state_change_dispatcher
hass.async_run_hass_job(job, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 526, in async_run_hass_job
cast(Callable[..., _R], hassjob.target)(*args)
File "/config/custom_components/bodymiscale/__init__.py", line 170, in _state_changed_event
self.state_changed(event.data.get("entity_id"), event.data.get("new_state"))
File "/config/custom_components/bodymiscale/__init__.py", line 195, in state_changed
self._update_state()
File "/config/custom_components/bodymiscale/__init__.py", line 221, in _update_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 574, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/config/custom_components/bodymiscale/__init__.py", line 300, in state_attributes
lib = body_metrics.bodyMetrics(weight, height, age, gender, 0)
File "/config/custom_components/bodymiscale/body_metrics.py", line 17, in __init__
raise Exception("Weight is either too low or too high (limits: <10kg and >200kg)")
Exception: Weight is either too low or too high (limits: <10kg and >200kg)
2022-03-04 11:20:50 ERROR (MainThread) [homeassistant.helpers.event] Error while processing state change for sensor.impedance_karen
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 273, in _async_state_change_dispatcher
hass.async_run_hass_job(job, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 526, in async_run_hass_job
cast(Callable[..., _R], hassjob.target)(*args)
File "/config/custom_components/bodymiscale/__init__.py", line 170, in _state_changed_event
self.state_changed(event.data.get("entity_id"), event.data.get("new_state"))
File "/config/custom_components/bodymiscale/__init__.py", line 189, in state_changed
value = int(float(value))
ValueError: could not convert string to float: ''
On startup, it needs to wait until it processes data and handle this smoothly.
AFter copying the corresponding files to de custom_components folder, esphome still does not recognize the bodymiscale in the yaml for the board.
Since the Update to HomeAssistant core-2021.7.0 and core-2021.7.1 i get the following error with my sensors for the bodyscale:
Logger: homeassistant.helpers.event
Source: custom_components/bodymiscale/body_metrics.py:20
Integration: Bodymiscale (documentation)
First occurred: 16:00:38 (2 occurrences)
Last logged: 16:00:38
Error while processing state change for sensor.xiaomiscale1
Error while processing state change for sensor.xiaomiscale2
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 272, in _async_state_change_dispatcher
hass.async_run_hass_job(job, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 432, in async_run_hass_job
hassjob.target(*args)
File "/config/custom_components/bodymiscale/__init__.py", line 168, in _state_changed_event
self.state_changed(event.data.get("entity_id"), event.data.get("new_state"))
File "/config/custom_components/bodymiscale/__init__.py", line 191, in state_changed
self._update_state()
File "/config/custom_components/bodymiscale/__init__.py", line 218, in _update_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 419, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 455, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/config/custom_components/bodymiscale/__init__.py", line 301, in state_attributes
lib = body_metrics.bodyMetrics(weight, height, age, gender, impedance)
File "/config/custom_components/bodymiscale/body_metrics.py", line 20, in __init__
elif impedance > 3000:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
would be nice to have some form of monitoring attributes something like
current weight - last weight
current weight - 1 week ago weight
current weight - 2 week ago weight
I am occasionally seeing double reports from the component within a few milliseconds of each other.
I wonder if this is caused by the 2 sensors being updated at slightly different times?
Does the component wait for both sensors to be updated before doing the calculations?
Hi @dckiller51,
first thank for this component. Currently I prepare the PR to add config flow for this component and I got some questions:
bodyscale
or what do you think?min_weight
, max_weight
, min_impedance
, max_impedance
still used? There is no documentation about it and I suggest to remove them. I understand why you introduced them, but if there are two persons, we need to separate their readings outside this component (examples esphome, #11) and therefore these config options are useless imo.After I have added the config flow support, it easy to add a sensor for each attribute (#40) and also fix #39, #37, #25.
What do you think?
Hey guys,
My HA server is to far away from my scale, so i have a ESP32 with ESPHome to get the data to HA. I get the weight and impedance for 2 users. Ive entered these sensors in the bodymiscale.yaml, but i dont get any attributes like BMI, Bone mass etc.
Is There something i have done wrong? Does the calculated data appear as attributes to the original sensors?
I have 4 sensor, 2 per user, both with weight and impedance. My bodymiscale.yaml is as follow:
twan:
sensors:
weight: sensor.weight_user1
impedance: sensor.impedance_user1
height: 185
born: "xxxx-xx-xx"
gender: "male"
model_miscale: "181B"
jennifer:
sensors:
weight: sensor.weight_user2
impedance: sensor.impedance_user2
height: 175
born: "xxxx-xx-xx"
gender: "female"
model_miscale: "181B"
Hello, I had this working with two users without any trouble, with the last update now it looks like the sensors are switching. I cannot make it work with two users.
If I setup the first user it works ok, but when I add the second user, the firs user gets the data from the second user and viceversa.
I hope it can be fixed since it is an excellent integratio.
I am always getting this error on boot. But the integration works fine after that.
Logger: homeassistant.helpers.event
Source: custom_components/bodymiscale/body_metrics.py:20
Integration: Bodymiscale (documentation)
First occurred: 9:33:01 AM (1 occurrences)
Last logged: 9:33:01 AM
Error while processing state change for sensor.ben_weight_kg
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 272, in _async_state_change_dispatcher
hass.async_run_hass_job(job, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 433, in async_run_hass_job
hassjob.target(*args)
File "/config/custom_components/bodymiscale/__init__.py", line 169, in _state_changed_event
self.state_changed(event.data.get("entity_id"), event.data.get("new_state"))
File "/config/custom_components/bodymiscale/__init__.py", line 192, in state_changed
self._update_state()
File "/config/custom_components/bodymiscale/__init__.py", line 219, in _update_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 500, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/config/custom_components/bodymiscale/__init__.py", line 305, in state_attributes
lib = body_metrics.bodyMetrics(weight, height, age, gender, impedance)
File "/config/custom_components/bodymiscale/body_metrics.py", line 20, in __init__
elif impedance > 3000:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
this is my config:
bodymiscale:
ben:
sensors:
weight: sensor.ben_weight_kg
impedance: sensor.ben_impedance
height: 165
born: "1975-02-05"
gender: "male"
model_miscale: "181B"
and my scale reports me in Lbs so I have to convert it to kg before using bodymisle using the following: ben_weight_kg is defined as a template:
sensor:
- name: ben_weight_kg
unique_id: ben_weight_kg
unit_of_measurement: "kg"
icon: mdi:weight-kilogram
state_class: measurement
state: >
{% set weight = states('sensor.ble_weight') | float %}
{% if 135 <= weight <= 150 %}
{{ (states('sensor.ble_weight') | float / 2.20462) | round(1)}}
{% else %}
{{ states("sensor.ben_weight_kg") }}
{% endif %}
finally the sensor.ble_weight is comming from Passive BLE monitor integration
Also whenever I do not record a weight for more that 24hrs and I do a system reboot, all values go to 0. If I have measuered within 24hrs then all is fine.
Thanks
Ben
while a bodyscore exists is never actually calculated and exposed. in const.py there is actually no attribute for it
Hi, can you add Yunmai color support?
V2.0.0 does not work when the sensors are updated.
I have 2 x Scales defined and both updated when one set of sensors updated.
Node-Red did not pick up the state change so something is amiss.
Reverted to 1.1.5 and all OK.
In the docs please clarify if the DOB is YYY-MM-DD or YYY-DD-MM.
Neither format calculates the age correctly when DOB is 7th Dec 1964.
Just installed your component using HACS on HA 2021.2.3 running in Docker. On startup I get the following stack trace:
2021-03-07 14:23:05 ERROR (MainThread) [homeassistant.setup] Error during setup of component bodymiscale
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
result = await task
File "/config/custom_components/bodymiscale/__init__.py", line 114, in async_setup
await component.async_add_entities(entities)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 315, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 506, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 322, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/config/custom_components/bodymiscale/__init__.py", line 280, in state_attributes
ATTR_WEIGHT: "{:.2f} kg".format(weight),
TypeError: unsupported format string passed to NoneType.__format__
docker@bpi2:~/homeassistant/config $ docker exec -it 1bba12d5fffb bash
bash-5.0# python3 --version
Python 3.8.7
Hi,
After configuring multiple users I got this error after using the weight:
Logger: homeassistant.helpers.event
Source: custom_components/bodymiscale/body_metrics.py:20
Integration: Bodymiscale (documentation)
First occurred: 17:47:18 (1 occurrences)
Last logged: 17:47:18
Error while processing state change for sensor.weight_karol
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 272, in _async_state_change_dispatcher
hass.async_run_hass_job(job, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 432, in async_run_hass_job
hassjob.target(*args)
File "/config/custom_components/bodymiscale/init.py", line 168, in _state_changed_event
self.state_changed(event.data.get("entity_id"), event.data.get("new_state"))
File "/config/custom_components/bodymiscale/init.py", line 191, in state_changed
self._update_state()
File "/config/custom_components/bodymiscale/init.py", line 218, in _update_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 368, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 404, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/config/custom_components/bodymiscale/init.py", line 301, in state_attributes
lib = body_metrics.bodyMetrics(weight, height, age, gender, impedance)
File "/config/custom_components/bodymiscale/body_metrics.py", line 20, in init
elif impedance > 3000:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
Regards,
Charles
The output from this should be a device with entities not an entity.
For instance, the attribute 'weight' should be an entity sensor with attributes for Unit_of_measurment.
Most of the current attributes, need to be entities with attributes specifying units as a minimum.
Really like it though!
I also think this will help with restoring last values for each entity
I would like to translate your component version into my language (PT-BR). I've managed to translate almost everything, these words were missing:
File: init.py
lib = body_metrics.bodyMetrics(weight, height, age, gender, impedance)
bodyscale = ['Obeso', 'Sobrepeso', 'Grosso-conjunto', 'Falta de exercício', 'Equilibrado', 'Musculoso equilibrado', 'Magro', 'Magro equilibrado', 'Magro musculoso']
File: body_scales.py
# Return body type scale
def getBodyTypeScale(self):
return ['Obeso', 'Sobrepeso', 'Grosso-conjunto', 'Falta de exercício', 'Equilibrado', 'Musculoso equilibrado', 'Magro', 'Magro equilibrado', 'Magro musculoso']
Can you help me change these lines? I am not a developer and I am having difficulties.
The release notes for 1.1.5 https://github.com/dckiller51/bodymiscale#v115 state:
"Convert weight from lbs to kgs"
Where and what? The output, the input?
Pretty major change and probably a breaking change.
Note the Docs do not state the weight measurement system in use (has to be guessed).
Hello! Thank you for your work on the integration, it is great.
I have a suggestion how to improve the integration even more. This is about multiuser support. For example, the users could be distinguished by the measured weight.
You could configure it like this for example:
bodymiscale:
model_miscale: "181B"
sensors:
weight: sensor.weight_aurelien
impedance: sensor.impedance_aurelien
users:
- name: "Username 1"
height: 176
born: "1990-04-10"
gender: "male"
weight_low: 70
weight_heigh: 100
- name: "Username 2"
height: 170
born: "1990-01-12"
gender: "female"
weight_low: 0
weight_heigh: 70
Each user would then get his own entity. For this to be possible, the values would probably also have to be persisted in core.restore_state.
I tried to follow the instructions but maybe something is escaping my eyes
In configuration.yaml i put what you wrote : bodymiscale: !include components/bodymiscale.yaml - that is invalid for a instalation through HACS. I modified to bodymiscale: !include custom_components/bodymiscale.yaml - which was accepted by HA.
I put directly into custom_components file bodymiscale.yaml in which i put the required data:
adrian:
sensors:
weight: sensor.adrian_w
impedance: sensor.adrian_i
height: 1xx
born: "xxxxx"
gender: "male"
model_miscale: "181B"
wife:
sensors:
weight: sensor.wife_w
impedance: sensor.wife_i
height: 1xx
born: "xxxxxx"
gender: "female"
model_miscale: "181B"
After restart i have the following errors:
The following integrations and platforms could not be set up:
bodymiscale
Please check your config and logs.
Logger: homeassistant.setup
Source: custom_components/bodymiscale/init.py:280
First occurred: 11:30:32 PM (1 occurrences)
Last logged: 11:30:32 PM
Error during setup of component bodymiscale
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
result = await task
File "/config/custom_components/bodymiscale/init.py", line 114, in async_setup
await component.async_add_entities(entities)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 315, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 506, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 322, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/config/custom_components/bodymiscale/init.py", line 280, in state_attributes
ATTR_WEIGHT: "{:.2f} kg".format(weight),
TypeError: unsupported format string passed to NoneType.format
Logger: homeassistant.helpers.event
Source: custom_components/bodymiscale/init.py:228
First occurred: 11:30:41 PM (5 occurrences)
Last logged: 11:30:43 PM
Error while processing state changed for sensor.adrian_w
Error while processing state changed for sensor.adrian_i
Error while processing state changed for sensor.wife_w
Error while processing state changed for sensor.wife_i
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 257, in _async_state_change_dispatcher
hass.async_run_hass_job(job, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 435, in async_run_hass_job
hassjob.target(*args)
File "/config/custom_components/bodymiscale/init.py", line 168, in _state_changed_event
self.state_changed(event.data.get("entity_id"), event.data.get("new_state"))
File "/config/custom_components/bodymiscale/init.py", line 191, in state_changed
self._update_state()
File "/config/custom_components/bodymiscale/init.py", line 204, in _update_state
result.append(self._check_max(sensor_name, value, params))
File "/config/custom_components/bodymiscale/init.py", line 228, in _check_max
if value > max_value:
TypeError: '>' not supported between instances of 'str' and 'float'
This is more a question.
is it possible to expose some of the attributes as sensors? the idea is to plan them
i really do not know where the formulae come from for this but the numbers are different between xiaomi app and what is computed in python for me for example app gives 13 and the ha component 17.
this is odd since all the rest are more or less the same
I can not pick my birthdate because I was born before 1970... Date picker does not go further back then 01-01-1970?
Originally posted by @lazodar in #76 (comment)
In the readme you show that this repository is in the hacs default list via the badge "hacs:default".
But in fact this repository is not in the default list and must be added via the custom url.
I think it would be easier if you add it to the default list.
When you repository is part of the default list, a new user must only search for the name and doesn't need to add the custom url.
What do you think?
P.S. adding to the default list can only be done by the owner or a big contributor
Dear Developer,
After update to latest version, new weight sensor is updating for all “accounts” in integration. I have 3 person in there, and if I update weight for one of them, rest 2 updates same way with same weight. Have to roll back to version before 2.1.1.
BRGDS
Alex
Okay, you had developed it further regarding scale number and background image or so, but here is bug I explain in point 2.
I guess this will be a shorter list of what is left to be done
OLD: Search for STATUS WAAGE and replace that whole line by what I had written in the list
"show_state": "Status anzeigen (Symbole links oben)"
I added the description to make clear what it is for "(icon/s upper left)"
ATTENTION: If you agree that you will end up with max 1 symbol shown at a time for the scale states then you have to take the following line cause that would mean a singular icon and therefore "Symbol" instead of Plural "Symbole" right now where you show scale and warning sign together. If you will endup with 1 sign at a time then this would be the right line:
"show_state": "Status anzeigen (Symbol links oben)"
OLD: Please do a search and replace for "Nicht verfügbar" by "nicht verfügbar" cause that appears quite often.
OLD: search for "kein" or "none" and replace the word "kein" bei "keine" caue no and none are different, same for kein / keine
OLD: Search for "Körpger..." and delete that "g" which is a typo.
NEW: Now search for "Körperwert und" and replace "Körperwert" by the infiltrated german word "Power Button"
OLD: Try to add your "Body Mi Scale Card" to the "add card dialog" cause it is missing even though not important right now, but looks a lot better for sure
OLD: just a kind reminder that you wanted to adjust the kg decimals to just 2 for both / all weights cause currently they are different from 0 to 2 and that does not look very well.
OLD: metabolism figure should be formated with a dot for the usual 1.000 + kcal cause it looks a lot nicer and is not a year.
Finally try to make the folloing fit in 2 lines as the pic i created shows and please replace "Button" by "Power Button"
If possible do the same for the warning error in case we get 2 messages that do not fit in 1 line cause they are so much easier to read and understand then a broken line.
Final point I hope: the details shown by a press of the power button should only display what can be available on that particular model. i do not need a 181B series of labels where the data are described as not available. Hide the unavailable pieces if possible.
So far, so good - except I can not check those values I do not have so maybe you can send me a screenshot when you use that development template and get the german UI. I mean just the body details you can show by the power button.
I just checked it and not a lot has changed or maybe I got the wrong file or do I have to completely reboot the pi 4?
all the "Nicht verfügbar" still there instead of "nicht ..." and "kein" in the top or status area instead of "keine" in the sense of "no warning messages" . So I assume my update by copy the raw from github into the js file did not really work out with just a docker stop homeassistant and docker restart homeassistant.
Ok, that was an easy on for me and I hope for you too cause it is only about 7 terms with minor changes.
ATTENTION:
#1 I simply translated and did not look for the key question if it might fit or not cause that has to be done in the next dev version but I guess you can see in most cases german words or terms are longer measured by letters.
#2 You should change a variable or label name I guess cause yours is wrong and might cause other issues.
"Lack-exerscise": the last should be "exercise" without that "s" before the "cise"
#3 tiny topic: search for Geschlecht and then you should find "männl" which needs to be "männl." - the dot is missing which allows us to shorten it from mänlich to männl. but only with a dot at the end.
Terms to exchange have NO LEADING'#'
# "Skinny": "schlank"
# "Balanced-skinny": "ausgeglichen schlank"
# "Skinny-muscular": "muskulös schlank"
# "Balanced": "ausgewogen"
# "Balanced-muscular": "ausgewogen muskulös"
"Lack-exerscise": "Bewegungsmangel"
# "Thick-set": "stämmig"
# "Obese": "fettleibig"
"Overweight": "Übergewicht"
# "Underweight": "Untergewicht"
"Normal or Healthy Weight": "Normal - gesundes Gewicht"
"Slight overweight": "leichtes Übergewicht"
"Moderate obesity": "moderate Fettleibigkeit"
"Severe obesity": "schwere Fettleibigkeit"
"Massive obesity": "massive Fettleibigkeit"
Meanwhile I came across a few points that do not really work out regarding translation.
To avoid unnecessary double work you can search for the word 'IMPROVED'
ATTENTION: above that IMPROVED you will find a changed line / term cause I had found typos and other smaller points or shortened terms like 'stoffwechselbedingtes Körperalter' in the hope that it fits in 1 line - with 2 lines it did not look good.
FINAL 3 POINTs
the label "BMI-Label" of the lower / hidden section with the details is NOT covered at all in the translation file you had sent to me and also not its values as can be seen in this example screenshot "Leichtes Übergewicht" which has to be "leichtes" cause I was wondering why I had written with a capital letter.
And there is another phrase missing in that file cause I am wondering myself about the spelling of those translations and why I had done it that way. So I do a search through the translation file for "Nicht verfügbar" with a capital "N" in the beginning. It is not in that file. So there might be more words missing a translation. here the final 3 tasks to not forget.
#1 Please change the term "BMI-Label" in the german version into "BMI Klassifikation"
#2 Also change at least its value "Leichtes" into "leichtes" and send me the other german values to crosscheck those too
#3 Finally do a search and replace for "Nicht verfügbar" with "nicht verfügbar".
First task: please change and release the current one in 2 major points cause they disturb germans for sure cause now it shows 'average 200 cm' due to translation error and 'Nice: male' cause gender has been mis translated.
Please read my translation comments directly below the german line term just to think about if maybe some english terms should be adopted or expanded too.
Then THANKS A LOT for the body-miscale-dev.js piece you created for me cause that way I can play around without damaging anything except my own config.
To get your translation file back you simply have to delete all the empty lines and those that begin with #
As said on the home assistant forum here is a long version of my thoughts to explain why some points felt a bit misleading / to short in english.
Regarding organisational structure of my comments. For a better comparison I first had added the english original quote as a comment and sometimes also the first Body Scale App results to get a history what I changed from where to what.
The first translations you had send as german version are partly false, partly not understandable or misleading, but 60% were good, but as you had explained later that those german terms were from the app.
Therefore I hope you take the time to read these comments cause some might usefull to adopt to the english version too and most likely french, but it will of cause be a struggle regarding space if you focus on Smartphone developement.
{
"common": {
"name": "BodyMiScale Karte",
# First question or point: I changed to upper letter whereever needed like in name. BodyMiScale is far better cause you can idenitfy its meaning a lot easier then an endless row of letters. I translate everything into german where younger people are used or more familiar with the english card which translated means Karte like a card in a card game. BodyMiScale itself is a productname so I do not tranlate scale into "Waage"
"description": "Die BodyMiScale Karte kann Ihnen hren gewichtsmäßigen Körperstatus anzeigen.",
# IMPROVED "description": "Mit der BodyMiScale Karte können Sie Ihren gewichtsmäßigen Körperstatus anzeigen lassen.",
# name:"Bodymiscale Card",description:"The bodymiscale card allows you to display your body score."
# here i added body status but "weightwise" which are just weight related data not body status regarding blood pressure.
"not_available": "BodyMiScale ist momentan nicht verfügbar",
#if you meant to say that the scale is not available I would call it "Ihre BodyMiScale Waage ist momentan nicht verfügbar" or if you meant the service itself then I would call it "Der BodyMiScale Dienst ist momentant nicht verfügbar" and I added "actually not available" "momentan nicht verfügbar"
"toggle_power": "Weitere Details wie BMI kCal anzeigen / ausblenden"
# Punktzahl is a kind of score you achieved in an examin or decathlon competition. I guess you mean "showing further details"
},
"state": {
"ok": "Messung: OK",
# IMPROVED "ok": "OK",
"problem": "Problem",
"none": "keine",
# IMPROVED "none": "kein",
# none does not mean no, so I guess "kein" Problem would make more sense "none": "Nein",
"weight unavailable": "Gewichts Messung nicht verfügbar",
# we would say that the weight measurement is not available , not just weight only
"impedance unavailable": "Bioelektrische Impedanz Messung (Körperzusammensetzung) nicht verfügbar",
# to be honest I die not know what that means in the context of weight, I only knew it from springs and physics. And I guess millions of germans do not know that by just that single latinword Impedanz therefore if someone wants to know more about that he has to search for "Bioelektrische Impedanz (Körperzusammensetzung) Messung" or bioelectrical impedance measurement (body composition) as a kind of body analysis
"weight unavailable, impedance unavailable": "Gewichts und bioelektrische Impedanz Messung (Körperzusammensetzung) nicht verfügbar."
},
"attributes": {
"weight: ": "Gewicht: ",
"impedance: ": "Zusammensetzung: ",
"height: ": "Körpergröße",
# IMPROVED "height: ": "Körpgergröße",
# you had here "Schnitt" which means average so most likely a copy paste error
"age: ": "Alter: ",
"gender: ": "Geschlecht: "
# you had here "Nett" which means nice ... but it should be Geschlecht
},
"attributes_value": {
"male": "männl.",
# you had here "Mann" which is a noun but male is an adjective and therefore I guess you meant the gender as adjective and not a question of "are you a man or woman question". I have shortened it from männlich to make it fit.
"female": "weibl.",
# you had "Frauen" = women, where it should be a single woman or "Frau", but as adjective "weiblich", shortened to weibl."
"unavailable kg": "Gewichtsmessung momentan nicht verfügbar",
# you had here "nicht verfügbar" which would mean not available but I guess it is about "weight measurement is not available".
"unavailable ohm": "Bio Impedanzmessung momentan nicht verfügbar"
# attention: here is a bug in the english word if it meant ohm, the measurement of resistance of electrical conductors. I guess you mean "Bio Impedance measurement is currently unavailable"
},
"body": {
"water": "Wasser",
"visceral_fat": "Bauchfett",
"body_fat": "Körperfett",
"bmi": "BMI",
"muscle_mass": "Muskelmasse",
"protein": "Protein",
"basal_metabolism": "Grundumsatz",
"bone_mass": "Knochenmasse",
"metabolic_age": "stoffwechselbedingtes Alter",
# IMPROVED "metabolic_age": "stoffwechselbedingtes Körperalter",
# too complex to translate but it means "metabolic related body age"
"ideal": "Idealgewicht",
# I guess this means "ideal weight" if I remember right and therefore we have term, a compound word as usual: Idealgewicht
"body_type": "Körperbau"
# the former translation "Körpertyp" is not from a native speaker ... it means how the body is build or body build.
},
"body_value": {
"Skinny": "schlank",
# I replaced all those skinny = dünn by "schlank" cause that is the typical description, a compliment where "dünn" could mean a critique
"Balanced-skinny": "ausgeglichen schlank",
"Skinny-muscular": "muskulös schlank",
"Balanced": "ausgewogen",
"Balanced-muscular": "ausgewogen muskulös",
"Lack-exerscise": "Bewegungsmangel",
"Thick-set": "stämmig",
"Obese": "fettleibig",
"Overweight": "übergewichtig"
},
"unit": {
" years": " Jahre"
# is the leading space intentionally there or just a typo ?
},
"error": {
"missing_entity": "Bitte definieren Sie einen Waagen-Namen Sensor in der Konfiguration.",
# I added some words cause define an entity or Entität sounds weird for germans that mostly do not know what an Entität is. So I called it "please define a scale-name sensor in the configuration."
# "missing_entity": "Please define an entity.",
#
"missing_enttity_bodymiscale": "Bitte definieren Sie den Waagen Sensor in der Konfiguration.",
# I added some words cause define an entity or Entität sounds weird for germans that mostly do not know what an Entität is. So I called it "please define the scale sensor in the configuration."
# "missing_enttity_bodymiscale": "Please define a bodymiscale entity.",
"missing_model": "Bitte definieren Sie ein gültiges Modell der Waage wie miscale, 181D, 181B in der Konfiguration."
# ATTENTION: this one is complex cause there has been an error, but here first of all your german and english one and then my explanation.
# "missing_model": "Bitte definieren Sie ein gültiges Maßstabsmodell."
# "missing_model": "Please define a valid scale model."
# I simply have no clue cause the german model is modell RC related like a scale plane model in 1:10 of a Mirage fighter cause the chinese have mistranslated the device scale into the attribute scale like. I think this english sentence means that you have to choose the right scale in terms of right model like 181D
# my translation means: please define only a valid model of the supported scales like miscale, 181D, 181B in the configuration"
},
"editor": {
"entity": "Auswahl der Waage / Person erforderlich"
# UPDATE: "entity": "Waage / Sensor erforderlich",
# I guess it means a sensor is neccessary
# "entity": "Entity (erforderlich)",
"show_name": "Namen anzeigen",
# UPDATE "show_name": "Name anzeigen",
"show_name_aria_label_on": "Namensanzeige einschalten",
"show_name_aria_label_off": "Namesanzeige ausschalten",
"show_state": "Status anzeigen (Symbole links oben)",
# I added the description to make clear what it is for "(icons upper left)"
"show_state_aria_label_on": "Statusanzeige einschalten",
"show_state_aria_label_off": "Statusanzeige ausschalten",
"show_attributes": "Basis Daten einblenden (rechts oben)",
# I changed this cause the Attribut term does not fit at all. I called it "show basic data (upper right)"
"show_attributes_aria_label_on": "Basis Daten einblenden (rechts oben) einschalten",
"show_attributes_aria_label_off": "Basis Daten einblenden (rechts oben) ausschalten",
# I have not seen where these labels are used so hope that fits
"show_body": "Körperwertanzeige anbieten (untere Hälfte)",
# I call this an offer to display body status details cause you have to press the button to see any change. They are not instantly there. I also added where that change will be happening (lower half)
# it was "show_body": "Körperwert anzeigen" and does not reflect what will happen cause instantly nothing will change except the toggle switch will work from there on,
"show_body_aria_label_on": "Körperwertanzeige einschalten",
"show_body_aria_label_off": "Körperwertanzeige ausschalten",
"show_buttons": "Schaltfläche anzeigen",
# I do not now know what this is for but I guess it is the button to change a person in a multipurpose environment.
"show_buttons_aria_label_on": "Schaltfläche anzeigen einschalten",
"show_buttons_aria_label_off": "Schaltfläche anzeigen ausschalten",
"show_toolbar": "Symbolleiste (Körperwert und Schaltfläche) anzeigen",
# I added that the toolbar consists out of (body aria and buttons
"show_toolbar_aria_label_on": "Symbolleiste anzeigen einschalten",
"show_toolbar_aria_label_off": "Symbolleiste anzeigen ausschalten",
"code_only_note": "Bitte beachten: Die Aktionen und Auswertungsoptionen sind nur im Code Editor verfügbar."
"code_only_note": "Note: Setting actions and stats options are available exclusively using Code Editor."
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.