From 0f16761a9f3360d0caa4d510eaf849f2ce139583 Mon Sep 17 00:00:00 2001 From: dontinelli <73341522+dontinelli@users.noreply.github.com> Date: Wed, 26 Aug 2026 18:04:47 +0000 Subject: [PATCH 1/4] Add new sensor --- homeassistant/components/fyta/sensor.py | 7 +++++++ homeassistant/components/fyta/strings.json | 3 +++ .../plugins/pylint_home_assistant/generated/mdi_icons.py | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/fyta/sensor.py b/homeassistant/components/fyta/sensor.py index 0af8b0702cf96d..443827fb8f0a67 100644 --- a/homeassistant/components/fyta/sensor.py +++ b/homeassistant/components/fyta/sensor.py @@ -132,6 +132,13 @@ class FytaMeasurementSensorEntityDescription(FytaSensorEntityDescription): entity_category=EntityCategory.DIAGNOSTIC, value_fn=lambda plant: plant.battery_level, ), + FytaSensorEntityDescription( + key="last_sensor_update", + translation_key="last_sensor_update", + device_class=SensorDeviceClass.DATE, + entity_category=EntityCategory.DIAGNOSTIC, + value_fn=lambda plant: plant.last_updated, + ), ] MEASUREMENT_SENSORS: Final[list[FytaMeasurementSensorEntityDescription]] = [ diff --git a/homeassistant/components/fyta/strings.json b/homeassistant/components/fyta/strings.json index d8209a6107ffdd..ee14f76511432f 100644 --- a/homeassistant/components/fyta/strings.json +++ b/homeassistant/components/fyta/strings.json @@ -73,6 +73,9 @@ "last_fertilised": { "name": "Last fertilized" }, + "last_sensor_update": { + "name": "Last sensor update" + }, "light": { "name": "Light", "state_attributes": { diff --git a/pylint/plugins/pylint_home_assistant/generated/mdi_icons.py b/pylint/plugins/pylint_home_assistant/generated/mdi_icons.py index 086ec55cbf46af..caf6065965c94b 100644 --- a/pylint/plugins/pylint_home_assistant/generated/mdi_icons.py +++ b/pylint/plugins/pylint_home_assistant/generated/mdi_icons.py @@ -5,7 +5,7 @@ from typing import Final -FRONTEND_VERSION: Final[str] = "20260729.3" +FRONTEND_VERSION: Final[str] = "20260729.5" MDI_ICONS: Final[set[str]] = { "ab-testing", From 68428a0afd79c5af49ddc8048756aa16288d1c8f Mon Sep 17 00:00:00 2001 From: dontinelli <73341522+dontinelli@users.noreply.github.com> Date: Wed, 26 Aug 2026 20:28:10 +0200 Subject: [PATCH 2/4] Fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- homeassistant/components/fyta/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/fyta/sensor.py b/homeassistant/components/fyta/sensor.py index 443827fb8f0a67..21e2353ab06b34 100644 --- a/homeassistant/components/fyta/sensor.py +++ b/homeassistant/components/fyta/sensor.py @@ -133,7 +133,7 @@ class FytaMeasurementSensorEntityDescription(FytaSensorEntityDescription): value_fn=lambda plant: plant.battery_level, ), FytaSensorEntityDescription( - key="last_sensor_update", + key="last_updated", translation_key="last_sensor_update", device_class=SensorDeviceClass.DATE, entity_category=EntityCategory.DIAGNOSTIC, From 020b0aa38b8e05948c48c5cd86c5a3c71c262400 Mon Sep 17 00:00:00 2001 From: dontinelli <73341522+dontinelli@users.noreply.github.com> Date: Wed, 26 Aug 2026 18:55:23 +0000 Subject: [PATCH 3/4] Update snapshots --- .../fyta/snapshots/test_sensor.ambr | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/tests/components/fyta/snapshots/test_sensor.ambr b/tests/components/fyta/snapshots/test_sensor.ambr index 845760a49bf96f..63f9c5c691b9a2 100644 --- a/tests/components/fyta/snapshots/test_sensor.ambr +++ b/tests/components/fyta/snapshots/test_sensor.ambr @@ -105,6 +105,57 @@ 'state': 'unknown', }) # --- +# name: test_all_entities[sensor.gummibaum_last_sensor_update-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.gummibaum_last_sensor_update', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Last sensor update', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Last sensor update', + 'platform': 'fyta', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'last_sensor_update', + 'unique_id': 'ce5f5431554d101905d31797e1232da8-0-last_updated', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[sensor.gummibaum_last_sensor_update-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'date', + : 'Gummibaum Last sensor update', + }), + 'context': , + 'entity_id': 'sensor.gummibaum_last_sensor_update', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '2023-01-10T10:10:00', + }) +# --- # name: test_all_entities[sensor.gummibaum_light-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ @@ -1011,6 +1062,57 @@ 'state': 'unknown', }) # --- +# name: test_all_entities[sensor.kakaobaum_last_sensor_update-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.kakaobaum_last_sensor_update', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Last sensor update', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Last sensor update', + 'platform': 'fyta', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'last_sensor_update', + 'unique_id': 'ce5f5431554d101905d31797e1232da8-1-last_updated', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[sensor.kakaobaum_last_sensor_update-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'date', + : 'Kakaobaum Last sensor update', + }), + 'context': , + 'entity_id': 'sensor.kakaobaum_last_sensor_update', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '2023-01-02T10:10:00', + }) +# --- # name: test_all_entities[sensor.kakaobaum_light-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ From edf170fb0c14cb7e73f0864267a8e8b7411a8980 Mon Sep 17 00:00:00 2001 From: dontinelli <73341522+dontinelli@users.noreply.github.com> Date: Wed, 26 Aug 2026 19:09:05 +0000 Subject: [PATCH 4/4] Change device class to timestamp --- homeassistant/components/fyta/sensor.py | 7 +++++-- tests/components/fyta/snapshots/test_sensor.ambr | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/fyta/sensor.py b/homeassistant/components/fyta/sensor.py index 21e2353ab06b34..151a207b10943e 100644 --- a/homeassistant/components/fyta/sensor.py +++ b/homeassistant/components/fyta/sensor.py @@ -22,6 +22,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from homeassistant.helpers.typing import StateType +from homeassistant.util import dt as dt_util from .const import ( CONF_MAX_ACCEPTABLE, @@ -135,9 +136,11 @@ class FytaMeasurementSensorEntityDescription(FytaSensorEntityDescription): FytaSensorEntityDescription( key="last_updated", translation_key="last_sensor_update", - device_class=SensorDeviceClass.DATE, + device_class=SensorDeviceClass.TIMESTAMP, entity_category=EntityCategory.DIAGNOSTIC, - value_fn=lambda plant: plant.last_updated, + value_fn=lambda plant: ( + dt_util.as_local(plant.last_updated) if plant.last_updated else None + ), ), ] diff --git a/tests/components/fyta/snapshots/test_sensor.ambr b/tests/components/fyta/snapshots/test_sensor.ambr index 63f9c5c691b9a2..5af9b435a37155 100644 --- a/tests/components/fyta/snapshots/test_sensor.ambr +++ b/tests/components/fyta/snapshots/test_sensor.ambr @@ -130,7 +130,7 @@ 'object_id_base': 'Last sensor update', 'options': dict({ }), - 'original_device_class': , + 'original_device_class': , 'original_icon': None, 'original_name': 'Last sensor update', 'platform': 'fyta', @@ -145,7 +145,7 @@ # name: test_all_entities[sensor.gummibaum_last_sensor_update-state] StateSnapshot({ 'attributes': ReadOnlyDict({ - : 'date', + : 'timestamp', : 'Gummibaum Last sensor update', }), 'context': , @@ -153,7 +153,7 @@ 'last_changed': , 'last_reported': , 'last_updated': , - 'state': '2023-01-10T10:10:00', + 'state': '2023-01-10T18:10:00+00:00', }) # --- # name: test_all_entities[sensor.gummibaum_light-entry] @@ -1087,7 +1087,7 @@ 'object_id_base': 'Last sensor update', 'options': dict({ }), - 'original_device_class': , + 'original_device_class': , 'original_icon': None, 'original_name': 'Last sensor update', 'platform': 'fyta', @@ -1102,7 +1102,7 @@ # name: test_all_entities[sensor.kakaobaum_last_sensor_update-state] StateSnapshot({ 'attributes': ReadOnlyDict({ - : 'date', + : 'timestamp', : 'Kakaobaum Last sensor update', }), 'context': , @@ -1110,7 +1110,7 @@ 'last_changed': , 'last_reported': , 'last_updated': , - 'state': '2023-01-02T10:10:00', + 'state': '2023-01-02T18:10:00+00:00', }) # --- # name: test_all_entities[sensor.kakaobaum_light-entry]