mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Add icon translations to Trafikverket Ferry (#112321)
* Add icon translations to Trafikverket Ferry * Add icon translations to Trafikverket Ferry
This commit is contained in:
parent
6e99ca0d8a
commit
d9e9b55a4b
24
homeassistant/components/trafikverket_ferry/icons.json
Normal file
24
homeassistant/components/trafikverket_ferry/icons.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"departure_time": {
|
||||
"default": "mdi:clock"
|
||||
},
|
||||
"departure_from": {
|
||||
"default": "mdi:ferry"
|
||||
},
|
||||
"departure_to": {
|
||||
"default": "mdi:ferry"
|
||||
},
|
||||
"departure_modified": {
|
||||
"default": "mdi:clock"
|
||||
},
|
||||
"departure_time_next": {
|
||||
"default": "mdi:clock"
|
||||
},
|
||||
"departure_time_next_next": {
|
||||
"default": "mdi:clock"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -28,7 +28,6 @@ ATTR_TO = "to_harbour"
|
||||
ATTR_MODIFIED_TIME = "modified_time"
|
||||
ATTR_OTHER_INFO = "other_info"
|
||||
|
||||
ICON = "mdi:ferry"
|
||||
SCAN_INTERVAL = timedelta(minutes=5)
|
||||
|
||||
|
||||
@ -51,7 +50,6 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
||||
TrafikverketSensorEntityDescription(
|
||||
key="departure_time",
|
||||
translation_key="departure_time",
|
||||
icon="mdi:clock",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
value_fn=lambda data: as_utc(data["departure_time"]),
|
||||
info_fn=lambda data: cast(list[str], data["departure_information"]),
|
||||
@ -59,21 +57,18 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
||||
TrafikverketSensorEntityDescription(
|
||||
key="departure_from",
|
||||
translation_key="departure_from",
|
||||
icon="mdi:ferry",
|
||||
value_fn=lambda data: cast(str, data["departure_from"]),
|
||||
info_fn=lambda data: cast(list[str], data["departure_information"]),
|
||||
),
|
||||
TrafikverketSensorEntityDescription(
|
||||
key="departure_to",
|
||||
translation_key="departure_to",
|
||||
icon="mdi:ferry",
|
||||
value_fn=lambda data: cast(str, data["departure_to"]),
|
||||
info_fn=lambda data: cast(list[str], data["departure_information"]),
|
||||
),
|
||||
TrafikverketSensorEntityDescription(
|
||||
key="departure_modified",
|
||||
translation_key="departure_modified",
|
||||
icon="mdi:clock",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
value_fn=lambda data: as_utc(data["departure_modified"]),
|
||||
info_fn=lambda data: cast(list[str], data["departure_information"]),
|
||||
@ -82,7 +77,6 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
||||
TrafikverketSensorEntityDescription(
|
||||
key="departure_time_next",
|
||||
translation_key="departure_time_next",
|
||||
icon="mdi:clock",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
value_fn=lambda data: as_utc(data["departure_time_next"]),
|
||||
info_fn=None,
|
||||
@ -91,7 +85,6 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
||||
TrafikverketSensorEntityDescription(
|
||||
key="departure_time_next_next",
|
||||
translation_key="departure_time_next_next",
|
||||
icon="mdi:clock",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
value_fn=lambda data: as_utc(data["departure_time_next_next"]),
|
||||
info_fn=None,
|
||||
|
@ -27,9 +27,7 @@ async def test_sensor(
|
||||
assert state1.state == "Harbor 1"
|
||||
assert state2.state == "Harbor 2"
|
||||
assert state3.state == str(dt_util.now().year + 1) + "-05-01T12:00:00+00:00"
|
||||
assert state1.attributes["icon"] == "mdi:ferry"
|
||||
assert state1.attributes["other_information"] == [""]
|
||||
assert state2.attributes["icon"] == "mdi:ferry"
|
||||
|
||||
monkeypatch.setattr(get_ferries[0], "other_information", ["Nothing exiting"])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user