From 8254188c09e790801c48756baab11f8f2b77fa37 Mon Sep 17 00:00:00 2001 From: Darren Jones <1425808+ddaddy@users.noreply.github.com> Date: Sun, 27 Oct 2024 11:38:26 +0100 Subject: [PATCH 1/2] Append model to entities if display name is empty --- custom_components/tesla_custom/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/tesla_custom/base.py b/custom_components/tesla_custom/base.py index cd03b92..e7f3bf4 100644 --- a/custom_components/tesla_custom/base.py +++ b/custom_components/tesla_custom/base.py @@ -46,7 +46,7 @@ def __init__( display_name = car.display_name vehicle_name = ( display_name - if display_name is not None and display_name != vin[-6:] + if display_name is not None and display_name != vin[-6:] and display_name != "" else f"Tesla Model {str(vin[3]).upper()}" ) self._attr_device_info = DeviceInfo( From 5c0856f0231c393868b7b679e06d1d662f6e63f2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 27 Oct 2024 10:40:26 +0000 Subject: [PATCH 2/2] style: auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- custom_components/tesla_custom/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/tesla_custom/base.py b/custom_components/tesla_custom/base.py index e7f3bf4..db087a3 100644 --- a/custom_components/tesla_custom/base.py +++ b/custom_components/tesla_custom/base.py @@ -46,7 +46,9 @@ def __init__( display_name = car.display_name vehicle_name = ( display_name - if display_name is not None and display_name != vin[-6:] and display_name != "" + if display_name is not None + and display_name != vin[-6:] + and display_name != "" else f"Tesla Model {str(vin[3]).upper()}" ) self._attr_device_info = DeviceInfo(