What @baz123 said. You only need to take care of the server, use the same credentials with the add-on / script and use the same credentials with HA
5 years later after starting this thread :
The easiest and most solid way to integrate the Miscale is ESPHome to me. I have setup a complete Bluetooth Low Energy Hub collecting several BLE sensors on a single low cost and low energy ESP32 device. I have also written a documentation (in german) about the necessary configuration and the calculation of the BMI directly on the ESP32. In case it is helpful to you throw this URL in the translator of your choice:
I have EN local on my Home Assistant server. But how I can manually set other language in Lovelace card with [bodymiscale] intagrtion?
For those of you looking to set this up, I just created a step-by-step guide for adding my Mi Body Composition 2 to Home Assistant via ESPHome. I was able to get the MQTT route working correctly as well, but I didn’t document that part.
Anyway, here it is if anyone is still interested: https://smarthomepursuits.com/how-to-add-smart-scale-home-assistant/
Dear All,
Not really related to this thread, but can someone help me with the conditions? Must be something wrong with it and I cannot figure out.
My purpose is to specify who’s standing on the scale
- alias: 'Weight'
trigger:
- entity_id: binary_sensor.ble_weight_removed_mi_scale
platform: state
to: 'on'
condition:
condition: and
conditions:
- condition: template
value_template: "{{ state('sensor.ble_weight_mi_scale') < 61.5 }}"
- condition: template
value_template: "{{ state('sensor.ble_weight_mi_scale') > 58.5 }}"
action:
- service: media_player.volume_set
data_template:
entity_id: media_player.googlehome5624
volume_level: 0.7
- service: tts.google_translate_say
entity_id: media_player.googlehome5624
data_template:
message: >
Your weight is {{states ('sensor.ble_weight_mi_scale') }} kg
Thank you all
A few pointers for you:
- it should be
states('sensor.ble_weight_mi_scale')
notstate('sensor.ble_weight_mi_scale')
(see the missing ‘s’?) - conditions are “and” by default, so you can simplify them.
- you’re most likely comparing a string to a number, add
| int
after your state
Your condition block would look like this:
condition:
- condition: template
value_template: "{{ states('sensor.ble_weight_mi_scale') | int < 61.5 }}"
- condition: template
value_template: "{{ states('sensor.ble_weight_mi_scale') | int > 58.5 }}"
Or even simpler:
condition:
- condition: template
value_template: "{{ states('sensor.ble_weight_mi_scale') | int > 58.5 and states('sensor.ble_weight_mi_scale') | int < 61.5}}"
Dear lolouk44,
Oh my stupidness
I tried and tried but could not figured out what happened.
Thanks a lot!
Happens to the best of us
Don’t forget the template editor, it will give you lots of helpful hints
Thank you a lot
I never used template editor before for don’t know about it😀.
As per your suggestion, I knew it already and gave it a try
HA changed recently the definition of the manually configured MQTT sensors
Please advise how should I change my actual configuration:
sensor:
- platform: mqtt
name: “MiScale Weight”
state_topic: “miscale/weight/kg”
unit_of_measurement: “kg” - platform: mqtt
name: “MiScale Impedance”
state_topic: “miscale/impedance”
unit_of_measurement: “Ω” - platform: mqtt
name: “MiScale Datetime”
state_topic: “miscale/midatetime”
unit_of_measurement: “Datetime” - platform: mqtt
name: “Cinematics Weight”
state_topic: “miscale/cinematics/weight”
value_template: “{{ value_json[‘weight’] }}”
unit_of_measurement: “kg”
json_attributes_topic: “miscale/cinematics/weight”
icon: mdi:scale-bathroom - platform: mqtt
name: “Cinematics BMI”
state_topic: “miscale/cinematics/weight”
value_template: “{{ value_json[‘bmi’] }}”
icon: mdi:human-pregnant
unit_of_measurement: “kg/m2”
I’ve managed with this configuration:
I’ll update the doc (haven’t worked on the repo in a while)
I’m also working on updating the add-on since HA deprecated bluepy
great, ive noticed that mine no longer gets data from the scale since the latest version that brought bluetooth proxy, i dont have any proxies but something must have changed
HA stopped supporting the bluepy library. I’ve been working at using the bleak library instead. I’m close to publishing something in the next few days
Great to see your being so active with the updates. Implemented and tested them, but cant get it to work anymore. Has anyone tested it over the use of bluetooth proxy on an ESP32?
Just posting an update that a new version is available supporting bleak.
Thanks to all early updaters for your help in troubleshooting
Also interested in getting it working using bluetooth proxy on an esp32!
I use HA, Passive BLE monitor and BodyMiScale integrations. I have followed the example you provided, but HA informs me that there’s an error in the configuration:
Invalid config for [bodymiscale]: expected a dictionary for dictionary value @ data['bodymiscale']. Got [OrderedDict([('platform', 'template'), ('sensors', OrderedDict([('weight_name_user1', OrderedDict([('friendly name', 'Waga P'), ('value_template', '{% set weight = states(\'sensor.ble_weight_waga\') | float(0) %}\n {% if 74 <= weight <= 90 %}\n {{ states("sensor.ble_weight_waga") }}\n {% else %}\n {{ states("sensor.weight_name_user1") }}\n{% endif %}'), ('unit_of_measurement', 'kg'), ('icon_template', 'mdi:weight-kilogram')]))]))]), OrderedDict([('platform', 'template'), ('.... (See /config/configuration.yaml, line 12).
The configuration itself is as follows:
- platform: template
sensors:
weight_name_user1:
friendly name: "Waga P"
value_template: >-
{% set weight = states('sensor.ble_weight_waga') | float(0) %}
{% if 74 <= weight <= 90 %}
{{ states("sensor.ble_weight_waga") }}
{% else %}
{{ states("sensor.weight_name_user1") }}
{% endif %}
unit_of_measurement: 'kg'
icon_template: mdi:weight-kilogram
- platform: template
sensors:
weight_name_user2:
friendly name: "Waga E"
value_template: >-
{% set weight = states('sensor.ble_weight_waga') | float(0) %}
{% if 40 <= weight <= 55 %}
{{ states("sensor.ble_weight_waga") }}
{% else %}
{{ states("sensor.weight_name_user2") }}
{% endif %}
unit_of_measurement: 'kg'
icon_template: mdi:weight-kilogram
- platform: template
sensors:
impedance_name_user1:
friendly name: "Impedancja P"
value_template: >-
{% set weight = states('sensor.ble_weight_waga') | float(0) %}
{% if 74 <= weight <= 90 %}
{{ states("sensor.ble_impedance_waga") }}
{% else %}
{{ states("sensor.weight_name_user1") }}
{% endif %}
unit_of_measurement: 'kg'
icon_template: mdi:weight-kilogram
- platform: template
sensors:
weight_name_user2:
friendly name: "Impedancja E"
value_template: >-
{% set weight = states('sensor.ble_weight_waga') | float(0) %}
{% if 40 <= weight <= 55 %}
{{ states("sensor.ble_impedance_waga") }}
{% else %}
{{ states("sensor.weight_name_user2") }}
{% endif %}
unit_of_measurement: 'kg'
icon_template: mdi:weight-kilogram
What I have missed or did wrong?
Can we identify users with NFC Tag? This means a person first scans the tag before weighing his or her weight.
Have you seen the addon for MiScale yet?
Runs fantastic and also saves the values.
With all other integrations etc. I had after each restart an “unknown” but the addon runs bomb!