Giter Site home page Giter Site logo

hassio-addons's People

Contributors

codefinder2 avatar fabir-git avatar kaizersoje avatar lolouk44 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hassio-addons's Issues

Supervisor Log warning

Describe the bug
Warning in supervisor log:

21-02-10 08:20:41 WARNING (MainThread) [supervisor.addons.validate] Add-on config 'startup' with 'before' is deprecated. Please report this to the maintainer of Xiaomi Mi Scale
21-02-10 08:20:41 WARNING (MainThread) [supervisor.addons.validate] Add-on config 'devices' use a deprecated format, the new format uses a list of paths only. Please report this to the maintainer of Xiaomi Mi Scale
21-02-10 08:20:41 WARNING (MainThread) [supervisor.addons.validate] Add-on config 'startup' with 'before' is deprecated. Please report this to the maintainer of Dropbox Sync
21-02-10 08:20:42 WARNING (MainThread) [supervisor.addons.validate] Add-on config 'startup' with 'before' is deprecated. Please report this to the maintainer of Xiaomi Mi Scale

Desktop/Server (please complete the following information):
HomeAssistant core-2021.2.2
supervisor-2021.02.6

Having problem to add the sensor

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale 2

When I'm try to add the sensor to ESPHome, I cannot compile it.

Body Composition Scale 2 (XMTZC05HM) - Wrong results for Visceral Fat and Body Fat

Select Add-On (place a lowercase x for the relevant add-on)

  • [ x] Mi Body Composition Scale 2 (XMTZC05HM)

Describe the bug

Wrong results for Visceral Fat and Body Fat
I have a Mi Body Composition Scale 2 (XMTZC05HM) and get wrong results when calculating, especially for Visceral Fat and Body Fat. If I query these values from other scales, then they are correct.

What can be the reason? Is it the scales or the application cannot be used for the Mi Body Composition Scale 2 (XMTZC05HM)?

To Reproduce
Running python 3.8 on a raspberry pi

Expected behaviour
Maybe based on the Mi Body Composition Scale 2 ??

Screenshots
NOP

Scale (please complete the following information):

  • Mi Body Composition Scale 2
  • Model XMTZC05HM
  • Manufacturerdata: "57015ccad34cee74"

Device running Home Assistant (please complete the following information):
Raspberry PI

Additional context

## Person 1:
{
    "Weight": "72.50",
    "BMI": "22.88",
    "Basal Metabolism": "1248.68",
    "Visceral Fat": "15.37", <-----  ! ERROR
    "Lean Body Mass": "57.20",
    "Body Fat": "23.76", <-----  ! ERROR
    "Water": "52.30",
    "Bone Mass": "2.87",
    "Muscle Mass": "52.40",
    "Protein": "19.98",
    "Body Type": "Balanced",
    "Metabolic Age": "41",
    "TimeStamp": "2020-09-03 11:59"
}

## Person 2:
{
    "Weight": "51.05",
    "BMI": "18.09",
    "Basal Metabolism": "930.34",
    "Visceral Fat": "1.00", <-----  ! ERROR
    "Lean Body Mass": "47.17",
    "Body Fat": "23.36", <-----  ! ERROR
    "Water": "52.57",
    "Bone Mass": "2.09",
    "Muscle Mass": "37.04",
    "Protein": "19.98",
    "Body Type": "Balanced-skinny",
    "Metabolic Age": "27",
    "TimeStamp": "2020-09-03 11:59"
}

Person 1: Height 178, Age 64.7, miimpedance: 502

Xiaomi_Scale.py mi.app Medisana TargetScale
Weight 72.50 72.50 72.50
BMI 22.88 22.60 22.80
Basal Metabolism 1.248.68 1.222.00 1569.00
Visceral Fat 15.37 14.00 6.10
Lean Body Mass 57.20 -- --
Body Fat 23.76 21.50 13.10
Water 52.30 53.80 55.40
Bone Mass 2.87 2.80 3.60
Muscle Mass 52.40 52.20 44.20
Protein 19.98 20.60 --
Body Type Balanced Balanced --
Metabolic Age 41 39 --

Person 2: Heigt 168, Age 62.71, miimpedance: 523

Xiaomi_Scale.py mi.app Medisana TargetScale
Weight 51.05 51.05 51.20
BMI 18.09 18.00 18.5
Basal Metabolism 930.34 934.00 1260.00
Visceral Fat 1.00 3.00 3.00
Lean Body Mass 47.17 -- --
Body Fat 23.36 19.03 14.60
Water 52.57 55.30 56.90
Bone Mass 2.87 2.00 2.65
Muscle Mass 37.04 39.00 32.56
Protein 19.98 20.60 --
Body Type Balanced-skinny Balanced-skinny --
Metabolic Age 27 26 --

Some other values also deviate, but this is not so critical.

What can I do so that the values are evaluated in a similar way to other scales?

Connection refused with 1883 and 1884 disabled

Select Add-On (place a lowercase x for the relevant add-on)

  • [ x] Xiaomi Mi Scale

Describe the bug
Unable to connect if default mqtt port 1883 is disabled

To Reproduce
Set the configuration with non default mqtt ports to use SSL encryption.

Expected behaviour
Connect to mqtt with SSL on mqtt secure port

Screenshots
--- - Starting Xiaomi mi Scale...
---- Loading Config From Add-On Options...
--- - Config Loaded...
Traceback (most recent call last):
File "/opt/miscale/Xiaomi_Scale.py", line 270, in
main()
File "/opt/miscale/Xiaomi_Scale.py", line 236, in main
discovery()
File "/opt/miscale/Xiaomi_Scale.py", line 123, in discovery
publish.single(
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/publish.py", line 227, in single
multiple([msg], hostname, port, client_id, keepalive, will, auth, tls,
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/publish.py", line 163, in multiple
client.connect(hostname, port, keepalive)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 937, in connect
return self.reconnect()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1071, in reconnect
sock = self._create_socket_connection()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3522, in _create_socket_connection
return socket.create_connection(addr, source_address=source, timeout=self._keepalive)
File "/usr/local/lib/python3.8/socket.py", line 808, in create_connection
raise err
File "/usr/local/lib/python3.8/socket.py", line 796, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Scale (please complete the following information):

  • Name mi scale
  • Model # 2

Device running Home Assistant (please complete the following information):

  • Device used to run the Script/Container [e.g. Raspberry Pi, NUC]
  • Bluetooth device used [e.g. Built-in, USB Dongle]
    hassio on raspberry pi4 8gb builtin bluetooth
    Additional context
    on default port is working fine

Unit of Measure in exported entity not correct

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
A clear and concise description of what the bug is.
My scale is set to lbs. And the reading is properly done in lbs but the entity's unit_of_measurement is hardcoded to kg.

To Reproduce
Steps to reproduce the behaviour, including error message if any.
Set a scale to lbs and link to this plugin

Expected behaviour
A clear and concise description of what you expected to happen.
Expected unit_of_measure to be lbs

Screenshots
Screen Shot 2020-10-31 at 3 56 53 PM

Scale (please complete the following information):
My Body Composition Scale
Firmware: 0.3.2

Device running Home Assistant (please complete the following information):
Rapsberri Pi 4 (built in bluetooth)

Additional context

This is where kg gets hardcoded...

def discovery():
    for MQTTUser in (USER1_NAME,USER2_NAME,USER3_NAME):
        message = '{"name": "' + MQTTUser + ' Weight",'
        message+= '"state_topic": "miscale/' + MQTTUser + '/weight","value_template": "{{ value_json.weight }}","unit_of_measurement": "kg",'
        message+= '"json_attributes_topic": "miscale/' + MQTTUser + '/weight","icon": "mdi:scale-bathroom"}'
        publish.single(
                        MQTT_DISCOVERY_PREFIX + '/sensor/' + MQTT_PREFIX + '/' + MQTTUser + '/config',
                        message,
                        retain=True,
                        hostname=MQTT_HOST,
                        port=MQTT_PORT,
                        auth={'username':MQTT_USERNAME, 'password':MQTT_PASSWORD}

Config always uses kg even if display is in lbs

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
In the config, you always need to use KG even if the Display and MQTT output is in lbs
This isn't a big deal - but it isn't documented

To Reproduce

  1. Set MiScale to lbs
  2. Take Measurement

The MQTT output will be the following only if the config is set using KG
{"weight":171.50,"weight_unit":"lbs","bmi":24.55,"basal_metabolism":1527.84,"visceral_fat":14.65,"timestamp":"2021-05-06 10:19:52.539306"}

Config

  • NAME: Rob
    SEX: male
    GT: 70
    LT: 99
    HEIGHT: 178
    DOB: '19xx-xx-xx'

If the config is done using the values from lbs - no MQTT message will be output.

Expected behaviour

  • Amend the documentation
  • OR have the config apply regardless of KG or LBS

Screenshots
N/A

Scale (please complete the following information):

  • Name
  • Model XMTZC01HM

Device running Home Assistant (please complete the following information):

  • Odroid N2+
  • BT Dongle

Additional context
N/A

Bad names for MQTT variables.

Will need to change variable names otherwise Home Assistant does not write data to them.
Basal Metabolism -> Basal_Metabolism
Visceral_Fat -> Visceral_Fat

0.2.7 manifest not found: manifest unknown

Select Add-On (place a lowercase x for the relevant add-on)

  • [x ] Xiaomi Mi Scale

Describe the bug
On update/install getting an error: Can't install lolouk44/xiaomi-mi-scale-ha-add-on:0.2.7: 404 Client Error for http+docker://localhost/v1.41/images/create?tag=0.2.7&fromImage=lolouk44%2Fxiaomi-mi-scale-ha-add-on: Not Found ("manifest for lolouk44/xiaomi-mi-scale-ha-add-on:0.2.7 not found: manifest unknown: manifest unknown")

BLE

This only seems to use Bluetooth controllers directly connected to the machine running the HA server.
Can it be set up to use the Xiaomi Gateway to read the Bluetooth data coming from the scales? I mean it's even physically connected to the HA server but for some reason there doesn't seem to be any way of making it choose the Gateway as the default bluetooth controller so it can't read the data from the scales. Feel like a schmuck buying into their ecosystem thinking it would be less work setting it all up, only to find out there's no actual way of reading the scales data via their bluetooth controller...

sensor states stay 'unknown'

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
Can't get any data values. I don't see anything via MQTT Explorer, either. Not sure if my Pi4 is even connecting to my scale via btle or not. Also, when I try to put my bt mac address in single quotes and hit save, it removes the single quotes.

To Reproduce
rpi4 with hassio and a bluetooth dongle, installed addon, configured and added sensor data and configured addon. restarted HAS.

Expected behaviour
no data in sensors, they state unknown

Screenshots
If applicable, add screenshots to help explain your problem.

Scale (please complete the following information):

  • mi scale
  • v2

Device running Home Assistant (please complete the following information):

  • pi4 with Mosquitto
  • usb

Additional context

# configuration.yaml
sensor:

  - platform: mqtt
    name: "My Weight"
    state_topic: "miscale/Jimmy/weight"
    value_template: "{{ value_json['weight'] }}"
    unit_of_measurement: "Lbs"
    json_attributes_topic: "miscale/Jimmy/weight"
    icon: mdi:scale-bathroom

  - platform: mqtt
    name: "My BMI"
    state_topic: "miscale/Jimmy/weight"
    value_template: "{{ value_json['bmi'] }}"
    icon: mdi:human-pregnant
    unit_of_measurement: "kg/m2"

addon config:

HCI_DEV: hci0
BLUEPY_PASSIVE_SCAN: false
MISCALE_MAC: 5C:CA:D3:EF:11:4B
MQTT_PREFIX: miscale
MQTT_HOST: 127.0.0.1
MQTT_USERNAME: mqtt
MQTT_PASSWORD: password
MQTT_PORT: 1883
TIME_INTERVAL: 30
MQTT_DISCOVERY: true
MQTT_DISCOVERY_PREFIX: homeassistant
USERS:
  - NAME: Jimmy
    SEX: male
    GT: 120
    LT: 150
    HEIGHT: 128
    DOB: '1901-01-01'

addon log:

-------------------------------------
2021-08-19 04:26:41 - Starting Xiaomi mi Scale...
2021-08-19 04:26:41 - Loading Config From Add-On Options...
2021-08-19 04:26:41 - Config Loaded...
2021-08-19 04:26:41 - Discovery Completed...

Bluetooth connection error: Failed to execute management command 'scanend' (code: 11, error: Rejected)

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
the log shows this most times
Bluetooth connection error: Failed to execute management command 'scanend' (code: 11, error: Rejected)
the odd occasion it downloads data (1 out of 5)

To Reproduce
let the add on do its thing

Expected behaviour
sync data

Screenshots
image

Scale (please complete the following information):
Mi Body Composition Scale 2 | XMTZC05HM

Device running Home Assistant (please complete the following information):
Raspberry pi 3 with built in Bluetooth

Additional context
Add any other context about the problem here.

illegal discovery topic

Select Add-On (place a lowercase x for the relevant add-on)

  • [x ] Xiaomi Mi Scale

Describe the bug
I have use diacritic in configuration. Which lead to error. The error still persists although i have changed name from "Tomáš" to "Tomas" in configuration.
Where is possible to repair it?

Logger: homeassistant.components.mqtt.discovery
Source: components/mqtt/discovery.py:104
Integration: MQTT (documentation, issues)
First occurred: 14:22:33 (1 occurrences)
Last logged: 14:22:33

Received message on illegal discovery topic 'homeassistant/sensor/miscale/Tomáš/config'

External bluetooth support

Select Add-On (place a lowercase x for the relevant add-on)

  • [x ] Xiaomi Mi Scale

Is your feature request related to a problem? Please describe.
I use an ESP32 to read the data from the scale. It returns the weight, and the impedance as a sensor.
Is it possible to use this sensor data as an alternative source ?

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

ESP32 board with OpenMQTTGateway

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Is your feature request related to a problem? Please describe.
I have an ESP32 board with OpenMQTTGateway configured and working correctly. I would like to know if it is possible not to use HCI_DEV, but ESP32 with its add-on.

Describe the solution you'd like
Have another version of the add-on for use with an ESP32 board and OpenMQTTGateway. I have a scale topic at OpenMQTTGateway: home/OpenMQTTGateway_ESP32_BLE/BTtoMQTT/5CCRD372A23R.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Config Page fills optional Parameters with defaults

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
When removing a parameter like "USER3_SEX" and clicking "save", the parameter reappears when reentering the config page. The parameter gets filled with its default.

Expected behaviour
The optional parameter should be removeable instead of readding it with its default value.

Incorrect timestamp format for Home Assistant

Select Add-On (place a lowercase x for the relevant add-on)

  • [ x ] Xiaomi Mi Scale

Describe the bug
the timestamp is not timezoned, so home assistant cannot convert it

To Reproduce
xiaomi mi scale v0.2.7
mqtt 6.0.1
xiaomi composition scale 2
Home assistant 2022.2.0

Expected behaviour
a correct timestamp

Screenshots

Scale (please complete the following information):

  • Name : Mi Body Composition Scale 2
  • Model : XMTZC05HM

Device running Home Assistant (please complete the following information):
-virtual machine

  • usb dongle

Additional context

my sensor configuration :

- platform: mqtt
  name: "Max Derniere pesee"
  state_topic: "miscale/Max/weight"
  value_template: "{{ value_json['timestamp'] }}"
  device_class: timestamp
  icon: mdi:calendar-clock

the logs :

Exception in message_received when handling msg on 'miscale/Max/weight':
'{"weight":109.50,"weight_unit":"kg","bmi":32.34,"basal_metabolism":2038.10,"visceral_fat":27.91,"lean_body_mass":72.78,"body_fat":34.26,"water":46.94,"bone_mass":3.67,"muscle_mass":68.31,"protein":15.45,"body_type":"Thick-set","metabolic_age":56,"timestamp":"2022-01-04 21:39:00.655824"}'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 37, in wrapper msg_callback(msg)
File "/usr/src/homeassistant/homeassistant/components/mqtt/sensor.py", line 280, in message_received self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 530, in async_write_ha_state self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 563, in _async_write_ha_state state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 536, in _stringify_state if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 419, in state raise ValueError( ValueError: Invalid datetime: sensor.max_derniere_pesee provides state '2022-01-04 21:39:00.655824', which is missing timezone information

and

Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:419
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 3:06:59 PM (6 occurrences)
Last logged: 3:07:00 PM

Error adding entities for domain sensor with platform mqtt
Error while setting up mqtt platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 614, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 773, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 530, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 563, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 536, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 419, in state
    raise ValueError(
ValueError: Invalid datetime: sensor.max_derniere_pesee provides state '2022-01-04 21:39:00.655824', which is missing timezone information

Missing Data

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
Only a part of the data is transmitted to Home Assistant.

To Reproduce
I am not able to switch between transmitting all and the partial data, so I don't know what causes it.

Expected behaviour
The usual data is transmitted, which is also listed in the addon description.

Screenshots

Publishing data to topic miscale/Name/weight: 
{
  "weight": 73.0,
  "weight_unit": "kg",
  "bmi": 22,
  "basal_metabolism": 1600.0,
  "visceral_fat": 8.0,
  "timestamp": "2021-12-03 00:00:00.0"
}

I edited the data a bit, but that's what is received.

Scale (please complete the following information):

  • Name Composition Scale 2
  • Model <not sure, but I will look it up later>

Device running Home Assistant (please complete the following information):

  • Device used to run the Script/Container: Raspberry Pi 4B
  • Bluetooth device used: Built-in

Additional context

Garmin connect upload

Hi, thanks for the perfect working solution. Can you help me finish what I started?
Goal: not just get only MQTT, but also have the ability to upload values to Garmin connect.
Reference: https://github.com/RobertWojtowicz/miscale2garmin has a very similar code with only several changes. We could add this as a feature to your repo.

Two ways I could reach the needed result:

  1. Ask you to post impedance raw to MQTT topic. Then I would be running Robert's script locally reading from MQTT and posting to Garmin from cronned Linux script. Cons is that every calculation done in this integration would be redone once again.
  2. Add Garmin posting of results to your repo. Here's what I see viable to do (but totally lack python skills to debug and do it correctly):
    2.1 To configuration file: Add a boolean, SENDTOGARMIN: false (to control whether this will get executed or not)
    2.2 To configuration file: Add a string to USERS, GARMINCONNECTPASSWORD: "..." for each user to be available to send to his own account.
    2.3 Add a file, which seems to do the raw Garmin export: https://github.com/RobertWojtowicz/miscale2garmin/blob/master/bodycomposition
    2.4 After MQTT send, add a code similar to:

Calculate metrics and send to garmin connect

if selected_user is not None and SENDTOGARMIN is true and GARMINCONNECTPASSWORD is not empty:
lib = Xiaomi_Scale_Body_Metrics.bodyMetrics(weight, selected_user.height, selected_user.age, selected_user.sex, int(miimpedance))
bone_percentage = (lib.getBoneMass() / weight) * 100
muscle_percentage = (lib.getMuscleMass() / weight) * 100
message = (path) + '/bodycomposition upload '
message += '--bone ' + "{:.2f}".format(bone_percentage) + ' '
message += '--calories ' + "{:.2f}".format(lib.getBMR()) + ' '
message += '--bmi ' + "{:.2f}".format(lib.getBMI()) + ' '
message += '--email ' + selected_user.email + ' '
message += '--fat ' + "{:.2f}".format(lib.getFatPercentage()) + ' '
message += '--hydration ' + "{:.2f}".format(lib.getWaterPercentage()) + ' '
message += '--metabolic-age ' + "{:.0f}".format(lib.getMetabolicAge()) + ' '
message += '--muscle ' + "{:.2f}".format(muscle_percentage) + ' '
message += '--password ' + selected_user.password + ' '
message += '--physique-rating ' + "{:.2f}".format(lib.getBodyType()) + ' '
message += '--unix-timestamp ' + mitdatetime + ' '
message += '--visceral-fat ' + "{:.2f}".format(lib.getVisceralFat()) + ' '
message += '--weight ' + "{:.2f}".format(weight) + ' '
os.system(message)
print("Processed file: " + (mitdatetime) + ".tlog")
I assume the changes are minimal and I would be glad to do the testing if you would be willing to help :)

Please let me know if it's something that could be done.

Crash while reading the configuration file.

Hello again! Just updated to the last version.

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
Xiaomi Mi Scale crashes while reading the config file with this error:

-------------------------------------
2020-09-09 09:42:40 - Starting Xiaomi mi Scale...
2020-09-09 09:42:40 - Loading Config From Add-On Options...
2020-09-09 09:42:40 - Config Loaded...
Traceback (most recent call last):
  File "/opt/miscale/Xiaomi_Scale.py", line 344, in <module>
    main()
  File "/opt/miscale/Xiaomi_Scale.py", line 312, in main
    if MQTT_DISCOVERY.lower() in ['true', '1', 'y', 'yes']:
AttributeError: 'bool' object has no attribute 'lower'

To Reproduce
Update to the last version and try to start the add-on.

Expected behaviour
I would expect it to load the configuration file without crashing. Also, seeing that you are treating the MQTT_DISCOVERY paramater as string I tried to put that parameter in the config file between quotation marks, but didn't help. It was like this:

MQTT_DISCOVERY: true

And tried like this:

MQTT_DISCOVERY: 'true'

None of them worked

Scale (please complete the following information):

  • Name Mi Body Composition Scale
  • Model XMTZC02HM

Device running Home Assistant (please complete the following information):

  • Raspberry pi 4 B 4GB
  • Built-in

problem while upgrading 0.2.4 -> 0.2.5 and while installing 0.2.5 alone

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
I use Home Assistant supervised, saw today that there's an updatefor Xiaomi Mi Scale add-on from 0.2.4 to 0.2.5. tried to upgrade and this error occurs:

Can't install lolouk44/xiaomi-mi-scale-ha-add-on:0.2.5: 404 Client Error for
http+docker://localhost/v1.41/images/create?tag=0.2.5&fromImage=lolouk44%2Fxiaomi-mi-scale-ha-add-on:
Not Found ("manifest for lolouk44/xiaomi-mi-scale-ha-add-on:0.2.5 not found: manifest unknown: manifest unknown")

then tried to uninstall 0.2.4 and make a clean install of 0.2.5 - the same error occurs.
tried to re-add repository and make a clean install - the same error occurs.

To Reproduce

  1. click on "install" on 0.2.5 version or "update" on 0.2.4 version

Expected behaviour
correct update of the addon to latest version

Screenshots
image

Scale (please complete the following information):

  • Name Xiaomi Mi Body Composition Scale 2
  • Model # XMTZC02HM

Device running Home Assistant (please complete the following information):

  • HP t620 thinclient
  • usb dongle

Additional context
n/a

Can't add a sensor

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
When I'm trying to add a sensor an error is displayed

To Reproduce
end of the stream or a document separator is expected at line 2, column 1: - platform: mqtt ^
Cannot read property 'setConfig' of undefined

Scale (please complete the following information):

  • Model Mi Body Composition Scale 2

Device running Home Assistant (please complete the following information):

  • Device used to run the Script/Container: Raspberry Pi 4/Hassio

New version is broken

Select Add-On (place a lowercase x for the relevant add-on)

  • [x ] Xiaomi Mi Scale

Describe the bug

Does not start, in log:

[FATAL tini (6)] exec /entrypoint.sh failed: Permission denied

unable to add to HACS

hi,
I am trying to add the repo to has but unfortunately I get this message! is their any work around?
gr. Madir
Screenshot 2020-10-01 at 23 56 00

Configuration env. variables can't be comment out or deleted - No MQTT default connection possible

Select Add-On (place a lowercase x for the relevant add-on)

  • [x ] Xiaomi Mi Scale

Describe the bug
As the Add-On installation guide describes, not required configuration environment variables should be comment out. E.g. "MQTT_USERNAME: user", "MQTT_PASSWORD: passwd" (when using default/not auth. mqtt broker on HA) or the "USER3_[....]" variables when only running a 2-Person-Configuration. In the current Add-On version commenting out such env. lines and saving these changes with the HA GUI under "Supervisor > Xiaomi Mi Scale > Configuration" will recreate the lines instead of accepting comment out/deleted values.
This leads to connection faults when using the default settings for HA MQTT broker without user and pass.

To Reproduce

  1. Open "Configuration" tab in HA "Supervisor > Xiaomi Mi Scale > Configuration"
  2. a. Change line "MQTT_USERNAME: user" to "#MQTT_USERNAME: user"
  3. b. Or delete the line "MQTT_USERNAME: user"
  4. Save the changes (Restarting the Add-On doesn't matter)
  5. Switch to tab "Info" (Or an other view - We want to reload the "Configuration" tab)
  6. Switch back to tab "Configuration" ("Supervisor > Xiaomi Mi Scale > Configuration")
  7. a. See the comment out line is fallen back to "MQTT_USERNAME: user"
  8. b. See the deleted line is fallen back to and added "MQTT_USERNAME: user"

MQTT Log:

1606558445: New connection from x.x.x.x on port 1883.
[ERROR] Auth error with user
1606558446: Socket error on client <unknown>, disconnecting.

Additional Context

  • Changing env. variables without deleting or commenting out is working and also persistent when reloading the "Configuration" tab.
  • Besides deleting or commenting out - As workaround inserting null-values (like ~, null, false, '', 0) results in errors thrown by the configuration parser. Failed to save addon configuration, not a valid value for dictionary value @ data['options']. Got {'HCI_DEV': 'hci0', 'MISCALE_MAC': ...}
  • Same bug occurs when editing the configurations directly by sudo vi /usr/share/hassio/addons/data/79ff755f_xiaomi_mi_scale/options.json. After restarting the addon, the variables are added back again with the default values in options.json Any direct changes in the volume's options.json are synced back by Hassio after addon restart?

Device running Home Assistant (please complete the following information):
System Health

Home Assistant Core Integration
version: 0.118.4
installation_type: Home Assistant Supervised
dev: false
hassio: true
docker: true
virtualenv: false
python_version: 3.8.6
os_name: Linux
os_version: 5.4.77-v7l+
arch: armv7l

Hass.io
host_os: Raspbian GNU/Linux 10 (buster)
update_channel: stable
supervisor_version: 2020.11.0
docker_version: 19.03.13
installed_addons: Xiaomi Mi Scale (0.1.16), Mosquitto broker (5.1)

Possibility to import old history stored in the scale.

First, thanks very much for your add-on, it works wonders! Now to the template:

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Is your feature request related to a problem? Please describe.
Not really a problem. The other day a read that the Xiaomi Mi Body Composition Scale, stored all the measurements made inside the scale. I was able to check this by using the app Open Scale. It downloaded months worth of measurements.

Describe the solution you'd like
It would be great being able to download all this data and include it in home assistant so I don't have to check old data in the xiaomi app.

Describe alternatives you've considered
Maybe just a way to upload this information as CSV or somethingn like that, there are ways to download the old values as CSVs.

Additional context
Using HA 114.4 with xiaomi mi scale 0.1.7 in a Pi4, everything working like a charm. Also, I don't know if there is another way of doing that, I just thought that it would be a nice feature.

cant update or install anymore

updating or removing then installing now gives this new error from latest version of hassio 2021.5.1

404 Client Error for http+docker://localhost/v1.41/images/create?tag=0.2.2&fromImage=lolouk44%2Fxiaomi-mi-scale-ha-add-on: Not Found ("manifest for lolouk44/xiaomi-mi-scale-ha-add-on:0.2.2 not found: manifest unknown: manifest unknown")

it has internet, i can add the repo - i removed and re-added.
installed and removed a couple of others to see if they were ok, they were

Log:
21-05-10 12:20:31 INFO (SyncWorker_0) [supervisor.docker.interface] Updating image lolouk44/xiaomi-mi-scale-ha-add-on:0.2.0 to lolouk44/xiaomi-mi-scale-ha-add-on:0.2.2
21-05-10 12:20:31 INFO (SyncWorker_0) [supervisor.docker.interface] Downloading docker image lolouk44/xiaomi-mi-scale-ha-add-on with tag 0.2.2.
21-05-10 12:20:33 ERROR (SyncWorker_0) [supervisor.docker.interface] Can't install lolouk44/xiaomi-mi-scale-ha-add-on:0.2.2 -> 404 Client Error for http+docker://localhost/v1.41/images/create?tag=0.2.2&fromImage=lolouk44%2Fxiaomi-mi-scale-ha-add-on: Not Found ("manifest for lolouk44/xiaomi-mi-scale-ha-add-on:0.2.2 not found: manifest unknown: manifest unknown").

Errors in log

Hi!
I have errors in log:
Снимок экрана 2020-08-26 в 11 45 38
Add-on doesn't work.

Actual Home Assistant with Supervisor
rpi3 B+
Bluetooth device used: Built-in

Thanks!

Non-HASSIO usage instructions / release artifact

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale 2

Is your feature request related to a problem? Please describe.
I'm using python-based HA. I'm not sure how to use your addon - i've extracted repo into custom_components and changed configuration - but HA sensors are not updated and there is nothing in MQTT.

Describe the solution you'd like
Please do actions release or graft some instruction on how to use with HA.

Describe alternatives you've considered
None at the moment.

Additional context
Add any other context or screenshots about the feature request here.

is there any possible use this for Home Assistant not HassIO?

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Json parse error

I have bug:

Unable to parse JSON Kamil: '{"name": "Kamil Weight","state_topic": "miscale/Kamil/weight","value_template": "{{ value_json.weight }}""json_attributes_topic": "miscale/Kamil/weight","icon": "mdi:scale-bathroom"}'
Unable to parse JSON Monika: '{"name": "Monika Weight","state_topic": "miscale/Monika/weight","value_template": "{{ value_json.weight }}""json_attributes_topic": "miscale/Monika/weight","icon": "mdi:scale-bathroom"}'
Unable to parse JSON Maja: '{"name": "Maja Weight","state_topic": "miscale/Maja/weight","value_template": "{{ value_json.weight }}""json_attributes_topic": "miscale/Maja/weight","icon": "mdi:scale-bathroom"}'

because in file Xiaomi_Scale.py a comma is missing:

original

        message+= '"state_topic": "' + MQTT_PREFIX + '/' + MQTTUser + '/weight","value_template": "{{ value_json.weight }}"'
        message+= '"json_attributes_topic": "miscale/' + MQTTUser + '/weight","icon": "mdi:scale-bathroom"}'

need:

        message+= '"state_topic": "' + MQTT_PREFIX + '/' + MQTTUser + '/weight","value_template": "{{ value_json.weight }}"'
        message+= ',"json_attributes_topic": "miscale/' + MQTTUser + '/weight","icon": "mdi:scale-bathroom"}'

Due to this error, the entities do not show up

Can I see history of measurements?

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Is your feature request related to a problem? Please describe.
I see only the last weight with all the attributes comparing with previous.

Describe the solution you'd like
How can I see my weight in longterm. Some chart or table

Describe alternatives you've considered

Additional context

Error while running the script: unconverted data remains: 3

Hello,

Thanks for good job!

Select Add-On (place a lowercase x for the relevant add-on)

Describe the bug
I have a errors in log
image
and it do not work.

Once it seems that has read my last measuremt under the name of Jo, when i have not corrected my config
image
But then, do not work.

Scale (please complete the following information):

  • Mi Body Composition Scale | XMTZC02HM

Device running Home Assistant (please complete the following information):

  • Actual Home Assistant with Supervisor
  • Device used to run the Script/Container Rrpi4 Docker
  • Bluetooth device used: Built-in

Thanks a lot!

Invalid Add-on repository!

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
I am trying to add the add-on through the Add-ons Store, by the option Manage add-on repositories, but when trying, it generates the following message "Invalid Add-on repository!"

To Reproduce
I am trying to add the add-on through the Add-ons Store, by the option Manage add-on repositories, but when trying, it generates the following message "Invalid Add-on repository!"

Expected behaviour
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Scale (please complete the following information):

  • Name Xiaomi Mi Scale 2
  • Model #XMTZC05HM

Device running Home Assistant (please complete the following information):

  • Device used to run the Script/Container [NUC]
  • Bluetooth device used [e.g. Built-in
    Captura de tela 2021-05-18 233321
    ]

Additional context
Add any other context about the problem here.

Addon not starting up!

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
Addon not starting, with the error

File "/opt/miscale/Xiaomi_Scale.py", line 196
   message+= '"state_topic": "' + MQTT_PREFIX + '/' + MQTTUser + '/weight","value_template": "{{ value_json['weight'] }}",'
                                                                                                             ^
SyntaxError: invalid syntax

To Reproduce

After updating the configuration file, that error is all I get

Scale (please complete the following information):

  • Xiaomi Mi Scale Body Composition 2

Device running Home Assistant (please complete the following information):

  • HassOS

Sensor "no data" 0.112

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale 2

Describe the bug
I get updates in addons log, but sensor is "no data"

To Reproduce
I installed plugin from repo(using easy way as addon)
Set up my config

HCI_DEV: hci0
MISCALE_MAC: 'C8:47:8C:A0:XX:XX'
MQTT_PREFIX: miScale
MQTT_HOST: 192.168.1.2
MQTT_USERNAME: mqtt
MQTT_PASSWORD: mqtt
MQTT_PORT: 1883
TIME_INTERVAL: 30
MQTT_DISCOVERY: true
MQTT_DISCOVERY_PREFIX: homeassistant
USER1_GT: 80
USER1_SEX: male
USER1_NAME: Ilya
USER1_HEIGHT: 175
USER1_DOB: '1990-08-02'
USER2_LT: 79
USER2_SEX: female
USER2_NAME: Anastasiia
USER2_HEIGHT: 165
USER2_DOB: '1990-10-03'
USER3_SEX: male
USER3_NAME: emptyuser
USER3_HEIGHT: 150
USER3_DOB: '1990-01-01'

Get a log


2020-07-06 19:59:21 - Starting Xiaomi mi Scale...
2020-07-06 19:59:21 - Loading Config From Add-On Options...
2020-07-06 19:59:21 - Config Loaded...
2020-07-06 19:59:22 - Discovery Completed...
2020-07-06 20:07:34 - Publishing data to topic miScale/Ilya/weight: {"Weight":"104.60","BMI":"34.16","Basal Metabolism":"2042.15","Visceral Fat":"27.03","TimeStamp":"2020-07-06-20:07:34"}
2020-07-06 20:07:34 - Data Published ...

In mqtt explorer also get updates
Then make sensors

  • platform: mqtt
    name: "Илья Вес"
    state_topic: "miscale/Ilya/weight"
    value_template: "{{ value_json['Weight'] }}"
    unit_of_measurement: "kg"
    json_attributes_topic: "miScale/Ilya/weight"
    icon: mdi:scale-bathroom

  • platform: mqtt
    name: "Настя Вес"
    state_topic: "miScale/Anastasiia/weight"
    value_template: "{{ value_json['Weight'] }}"
    unit_of_measurement: "kg"
    json_attributes_topic: "miScale/Anastasiia/weight"
    icon: mdi:scale-bathroom

After restart in object explorer find new sensors, but they have no data

Expected behaviour
Get data

Screenshots
image
image

Scale (please complete the following information):

  • Model # Xiaomi Mi Scale 2

Device running Home Assistant (please complete the following information):

  • Device used to run the Script/Container [e.g. Raspberry Pi, NUC] Synology
  • Bluetooth device used [e.g. Built-in, USB Dongle] Orico Bluetooth 4 dongle
    home assistant version 0.112.2

Mqtt gets disconnected almost instantly after connected

When i startup the addon, it successfully connects to my mosquitto mqtt addon.
But i disconnects again super fast. I got data from my Mi scale on first setup a few times but without changing anything, it now does not work anymore.
Is that a known Bug or can i somehow fix that?

Thanks in advance!

Mosquitto Log:

1630609524: New connection from 172.30.32.1 on port 1883.
1630609524: New client connected from 172.30.32.1 as auto-********* (p2, c1, k60, u'mi****').
1630609524: Client auto-********* disconnected.

Multi-language information

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Hi!
I was wandering if is possible to translate all the description from the balance (eg. basal metabolism, visceral fat, lean body mass...).
I can help with italian if you want...

Thank you!

Missing device tracker

I think you should add to configuration , the bluetooth_le tracker

device_tracker:

  • platform: bluetooth_le_tracker

Best Regards,

Zero weight sensor in HA

Select Add-On (place a lowercase x for the relevant add-on)

  • Mi Smart Scale 2

Describe the bug
i get in log


-------------------------------------
2020-11-25 14:59:18 - Starting Xiaomi mi Scale...
2020-11-25 14:59:18 - Loading Config From Add-On Options...
2020-11-25 14:59:18 - Config Loaded...
2020-11-25 14:59:18 - Discovery Completed...
2020-11-25 15:10:59 - Publishing data to topic miscale/Ilya/weight: {"weight":103.90,"weight_unit":"kg","bmi":33.93,"basal_metabolism":2028.22,"visceral_fat":26.74,"timestamp":"2020-11-25 15:10:59.084743"}
2020-11-25 15:10:59 - Data Published ...

i see new info in mqtt explorer
image

but in ha sensors are empty
image

Device running Home Assistant (please complete the following information):

  • Device used to run the Script/Container [e.g. Raspberry Pi, NUC] Synology nas + docker ha
  • Bluetooth device used [e.g. Built-in, USB Dongle] USB Dongle

Additional context
HA 0.118.3
MQTT Discovery is enabled
Mosquitto broker 5.1

Unable to remove user entity

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
I pasted the demo settings into the yaml. Later I deleted the demo users, unfortunately I'm unable to get rid of them as they still appear as entities and they cannot be deleted.

To Reproduce
When I click on them I get this message:
This entity ("sensor.mary_weight") does not have a unique ID, therefore its settings cannot be managed from the user interface. See documentation for more details.

Expected behaviour
Wish I was able to delete unnecessary users

Screenshots
screenshots .

Scale (please complete the following information):

  • Name miscale 2 body composition
  • Model XMTZC05HM

Device running Home Assistant (please complete the following information):

  • Device used to run the Script/Container [Raspberry Pi, on HA OS]
  • Bluetooth device used [ Built-in]

Additional context

Bug with connection

Select Add-On (place a lowercase x for the relevant add-on)

  • [ x] Xiaomi Mi Scale

Describe the bug
Bluetooth connection error: Failed to execute management command 'scanend' (code: 13, error: Invalid Parameters)

To Reproduce
Not possible

Expected behaviour
Get all data from Mi scale

Screenshots
no

Scale (please complete the following information):

  • Name Mi scale
  • Model 2

Device running Home Assistant (please complete the following information):

  • NUC
  • USB Dongle

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.