Use mysensors child description as entity name (#60420)

* using description for instance name if not empty

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
bcelary 2021-11-27 01:07:30 +01:00 committed by GitHub
parent 5a72c9f7c3
commit ec7b1e574f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -131,6 +131,10 @@ class MySensorsDevice:
@property
def name(self) -> str:
"""Return the name of this entity."""
child = self._child
if child.description:
return str(child.description)
return f"{self.node_name} {self.child_id}"
@property