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

Incompatibility after HA Core 2025.1 #40

Open
MauricioXavier13 opened this issue May 16, 2024 · 0 comments
Open

Incompatibility after HA Core 2025.1 #40

MauricioXavier13 opened this issue May 16, 2024 · 0 comments

Comments

@MauricioXavier13
Copy link

MASS_KILOGRAMS was used from google_fit, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfMass.KILOGRAMS instead, please report it to the author of the 'google_fit' custom integration

LENGTH_CENTIMETERS was used from google_fit, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfLength.CENTIMETERS instead, please report it to the author of the 'google_fit' custom integration

LENGTH_KILOMETERS was used from google_fit, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfLength.KILOMETERS instead, please report it to the author of the 'google_fit' custom integration

aidgent added a commit to aidgent/home-assistant-google_fit that referenced this issue May 28, 2024
…ponents/google_fit/sensor.py`.

# Aider chat conversation:

USER: "do what is needed to solve this issue without further instruction. i am counting on you. i trust you. follow the process: 1. start by reviewing the issue below, and think step-by-step to first add the necessary files. 2. make the minimum changes needed to fix the issue. 3. commit the changes. always follow the process. here is the issue you are assigned to solve: ---#top)\n cyberjunky#40\n=================================================\n\n[MauricioXavier13](/MauricioXavier13)\n opened this issue May 16, 2024 · 0 comments\n\nComments\n--------\n\n[![@MauricioXavier13](https://avatars.githubusercontent.com/u/74264882?s=80&u=63770839a2faa0f6ea9b1481fb808ac30f1d7b72&v=4)](/MauricioXavier13)\n\nCopy link\n\n### \n\n**[MauricioXavier13](/MauricioXavier13)** commented [May 16, 2024](#issue-2301342608)\n\n|     |\n| --- |\n| MASS\\_KILOGRAMS was used from google\\_fit, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfMass.KILOGRAMS instead, please report it to the author of the 'google\\_fit' custom integration<br><br>LENGTH\\_CENTIMETERS was used from google\\_fit, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfLength.CENTIMETERS instead, please report it to the author of the 'google\\_fit' custom integration<br><br>LENGTH\\_KILOMETERS was used from google\\_fit, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfLength.KILOMETERS instead, please report it to the author of the 'google\\_fit' custom integration |\n| The text was updated successfully, but these errors were encountered: |\n\n  \n\n\n\n \n\n[](---and here are some additional instructions to follow while fixing the issue: ---https://github.com/cyberjunky/home-assistant-google_fit/issues/40---\n"

ASSISTANT: To address the issue, we need to replace the deprecated constants `MASS_KILOGRAMS`, `LENGTH_CENTIMETERS`, and `LENGTH_KILOMETERS` with `UnitOfMass.KILOGRAMS`, `UnitOfLength.CENTIMETERS`, and `UnitOfLength.KILOMETERS` respectively.

First, we need to identify the files that contain these constants. Based on the provided summaries, it is likely that these constants are used in `custom_components/google_fit/sensor.py`.

Please add `custom_components/google_fit/sensor.py` to the chat so I can proceed with the necessary changes.

USER: I added these files to the chat: custom_components/google_fit/sensor.py

ASSISTANT: To address the issue, we need to:

1. Import `UnitOfMass` and `UnitOfLength` from `homeassistant.const`.
2. Replace the deprecated constants `MASS_KILOGRAMS`, `LENGTH_CENTIMETERS`, and `LENGTH_KILOMETERS` with `UnitOfMass.KILOGRAMS`, `UnitOfLength.CENTIMETERS`, and `UnitOfLength.KILOMETERS` respectively.

Here are the necessary changes:

custom_components/google_fit/sensor.py
```python
<<<<<<< SEARCH
from homeassistant import const
=======
from homeassistant import const
from homeassistant.const import UnitOfMass, UnitOfLength
>>>>>>> REPLACE
```

custom_components/google_fit/sensor.py
```python
<<<<<<< SEARCH
        return const.MASS_KILOGRAMS
=======
        return UnitOfMass.KILOGRAMS
>>>>>>> REPLACE
```

custom_components/google_fit/sensor.py
```python
<<<<<<< SEARCH
        return const.LENGTH_CENTIMETERS
=======
        return UnitOfLength.CENTIMETERS
>>>>>>> REPLACE
```

custom_components/google_fit/sensor.py
```python
<<<<<<< SEARCH
        return const.LENGTH_KILOMETERS
=======
        return UnitOfLength.KILOMETERS
>>>>>>> REPLACE
```
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

1 participant