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

Migrate to native unit of measurement #550

Merged
merged 2 commits into from
Sep 7, 2021

Conversation

tetienne
Copy link
Collaborator

@tetienne tetienne commented Sep 4, 2021

@github-actions github-actions bot added the bug Something isn't working label Sep 4, 2021
@tetienne tetienne changed the title Fix/sensor/native-unit-of-measurement Migrate to native unit of measurement Sep 4, 2021
Copy link
Owner

@iMicknl iMicknl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! However, should you not make changes here as well:

def state(self):
"""Return the value of the sensor."""
state = self.device.states.get(self.entity_description.key)
if not state:
return None
# Transform the value with a lambda function
if hasattr(self.entity_description, "value"):
return self.entity_description.value(state.value)
return state.value

@tetienne
Copy link
Collaborator Author

tetienne commented Sep 5, 2021

Good question. I will check.

@tetienne tetienne force-pushed the fix/sensor/native-unit-of-measurement branch from c9fdb5c to 982bd91 Compare September 6, 2021 19:40
@tetienne
Copy link
Collaborator Author

tetienne commented Sep 6, 2021

@iMicknl Ready to be merged.

@iMicknl iMicknl merged commit 524d492 into master Sep 7, 2021
@iMicknl iMicknl deleted the fix/sensor/native-unit-of-measurement branch September 7, 2021 08:17
@dhover
Copy link

dhover commented Sep 7, 2021

I've upgraded to 2.7.1 but I still get the error:

Logger: homeassistant.components.sensor
Source: components/sensor/init.py:151
Integration: Sensor (documentation, issues)
First occurred: 1:36:56 PM (1 occurrences)
Last logged: 1:36:56 PM

custom_components.tahoma.sensor is setting 'unit_of_measurement' on an instance of SensorEntityDescription, this is not valid and will be unsupported from Home Assistant 2021.11. Please report it to the custom component author.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HA warning: unit_of_measurement
3 participants