Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect configuration #2

Closed
farao780 opened this issue Feb 10, 2021 · 16 comments
Closed

Incorrect configuration #2

farao780 opened this issue Feb 10, 2021 · 16 comments

Comments

@farao780
Copy link

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'

@dckiller51
Copy link
Owner

Architecture must be:

configuration.yaml
bodymiscale: !include components/bodymiscale.yaml

adrian:
  sensors:
    weight: sensor.adrian_w
    impedance: sensor.adrian_i
  height: 1xx
  born: "xxxx-xx-xx"
  gender: "male"
  model_miscale: "181B"
wife:
  sensors:
    weight: sensor.wife_w
    impedance: sensor.wife_i
  height: 1xx
  born: "xxxx-xx-xx"
  gender: "female"
  model_miscale: "181B"

Create the file bodymiscale.yaml in folder components

In folder custom_components there is the download of hacs to know
folder = bodymiscale with files

folder \translations
init.py
body_metrics.py
body_scales.py
body_score.py
const.py
group.py
manifest.json
strings.json

You will even get an error but don't worry about it. Normally the bodymiscale.adrian and bodymiscale.wife should be present

@farao780
Copy link
Author

tried, but same errors
configuration.yaml:
bodymiscale: !include components/bodymiscale.yaml

in components/bodymiscale.yaml i have:

adrian:
sensors:
weight: sensor.adrian_w
impedance: sensor.adrian_i
height: 1xx
born: "xxxx-xx-xx"
gender: "male"
model_miscale: "181B"
wife:
sensors:
weight: sensor.wife_w
impedance: sensor.wife_i
height: 1xx
born: "xxxx-xx-xx"
gender: "female"
model_miscale: "181B"

in custom_components there is no init.py....is init.py

2021-02-11 08_29_24-Microsoft Store

@dckiller51
Copy link
Owner

dckiller51 commented Feb 11, 2021

My screen

bodymiscale.yaml

file1

folder bodymiscale in custom_components

file

@farao780
Copy link
Author

so we have the same thing, but works differently

@farao780
Copy link
Author

The weight and impedance sensors are working fine (they were updated with my morning scaling)

2021-02-11 10_10_51-Overview - Home Assistant

@dckiller51
Copy link
Owner

dckiller51 commented Feb 11, 2021

Commenter #bodymiscale: !include components/bodymiscale.yaml in confirguration.yaml

try in configuration.yaml

bodymiscale:
  adrian:
    sensors:
      weight: sensor.adrian_w
      impedance: sensor.adrian_i
    height: 1xx
    born: "xxxx-xx-xx"
    gender: "male"
    model_miscale: "181B"
  wife:
    sensors:
      weight: sensor.wife_w
      impedance: sensor.wife_i
    height: 1xx
    born: "xxxx-xx-xx"
    gender: "female"
    model_miscale: "181B"

@farao780
Copy link
Author

unfortunately same thing
errlog.txt

@dckiller51
Copy link
Owner

malheureusement même chose
errlog.txt

try name esphome name: Weight Adrian

@dckiller51
Copy link
Owner

dckiller51 commented Feb 11, 2021

My component is created as even despite this error in my journal

Traceback (most recent call last):
  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__

Sans titre

@farao780
Copy link
Author

farao780 commented Feb 11, 2021

esp name of sensor?

ok. i will try for the moment i have:

  • platform: template
    name: Adrian_w
    id: weight_user1
    unit_of_measurement: 'kg'
    icon: mdi:weight-kilogram
    accuracy_decimals: 2
  • platform: template
    name: Adrian_i
    id: impedance_user1
    unit_of_measurement: 'ohm'
    icon: mdi:omega

and my esphome project name is xiaomi_miscale
esp

due to not having vpn access to home lan i will try compiling tonight

@dckiller51
Copy link
Owner

Check as even if the bodymiscal device is created in the development tools

@farao780
Copy link
Author

well...nice surprise: i have all calculations

2021-02-11 11_34_17-Inbox - adrian stanciu@phoenix-it ro - Outlook

@dckiller51
Copy link
Owner

Nice. Yes the error I cannot remove it. I am not a programmer. Complicate for me, I hope a qualified person will find out later.

@dckiller51
Copy link
Owner

dckiller51 commented Feb 11, 2021

Next step for me is to create a map. Here is a first draft

Sans titre1

Sans titre

@farao780
Copy link
Author

farao780 commented Feb 11, 2021

u created template sensors or use a custom card to display entity attributes?

cards:
  - cards:
      - elements:
          - entity: bodymiscale.aurelien
            attribute: weight
            style:
              color: 'rgb(3, 222, 244)'
              left: 42%
              opacity: 1
              top: 15%
              transform: 'scale(2,2)'
            type: state-label
          - entity: input_boolean.bodyscale_aurelien_info_toggle
            image: /local/bodyscale/info-off.png
            state_filter:
              'off': brightness(100%) saturate(1)
              'on': brightness(90%) saturate(1)
            state_image:
              'on': /local/bodyscale/information.png
            style:
              bottom: 5%
              left: 20%
              transform: 'translate(240%, 25%) scale(0.7, 0.7)'
            tap_action:
              action: toggle
            title: Information
            type: image
        image: /local/bodyscale/device_scale.webp
        type: picture-elements
      - card:
          entities:
            - entities:
                - attribute: Water
                  entity: bodymiscale.aurelien
                  image: /local/bodyscale/water.webp
                  name: Eau
                  type: attribute
                - attribute: Visceral fat
                  entity: bodymiscale.aurelien
                  image: /local/bodyscale/viscera.webp
                  name: Graisse viscérale
                  type: attribute
                - attribute: Body fat
                  entity: bodymiscale.aurelien
                  icon: 'mdi:water'
                  name: Graisse corporelle
                  type: attribute
                - attribute: BMI
                  entity: bodymiscale.aurelien
                  icon: 'mdi:water'
                  name: IMC
                  type: attribute
                - attribute: Muscle mass
                  entity: bodymiscale.aurelien
                  image: /local/bodyscale/muscle.webp
                  name: Muscle
                  type: attribute
                - attribute: Protein
                  entity: bodymiscale.aurelien
                  icon: 'mdi:water'
                  name: Protéine
                  type: attribute
                - attribute: Basal metabolism
                  entity: bodymiscale.aurelien
                  icon: 'mdi:water'
                  name: Métabolisme de base
                  type: attribute
                - attribute: Bone mass
                  entity: bodymiscale.aurelien
                  icon: 'mdi:water'
                  name: Masse osseuse
                  type: attribute
                - attribute: Metabolic age
                  entity: bodymiscale.aurelien
                  icon: 'mdi:water'
                  name: Age corporel
                  type: attribute
                - attribute: Ideal
                  entity: bodymiscale.aurelien
                  icon: 'mdi:water'
                  name: Poids idéal
                  type: attribute
              head: bodymiscale.aurelien
              type: 'custom:fold-entity-row'
          show_header_toggle: false
          title: Information
          type: entities
        conditions:
          - entity: input_boolean.bodyscale_aurelien_info_toggle
            state: 'on'
        type: conditional
    type: vertical-stack
type: vertical-stack

https://www.swisstransfer.com/d/d86fbe7c-762a-43d9-815a-069689a17fa9

@farao780
Copy link
Author

merci pour votre patience et votre gentillesse. J'espère qu'un programmeur résoudra les erreurs et sera une intégration réussie à 100%

This was referenced Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants