Skip to content

Commit

Permalink
Add icon translations to Melnor (home-assistant#111906)
Browse files Browse the repository at this point in the history
* Use default icon for Melnor

* Use default icon for Melnor
  • Loading branch information
joostlek authored Mar 3, 2024
1 parent ec1400d commit 3c960b7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
23 changes: 23 additions & 0 deletions homeassistant/components/melnor/icons.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"entity": {
"number": {
"manual_minutes": {
"default": "mdi:timer-cog-outline"
},
"frequency_interval_hours": {
"default": "mdi:calendar-refresh-outline"
},
"frequency_duration_minutes": {
"default": "mdi:timer-outline"
}
},
"switch": {
"manual": {
"default": "mdi:sprinkler"
},
"frequency": {
"default": "mdi:calendar-sync-outline"
}
}
}
}
3 changes: 0 additions & 3 deletions homeassistant/components/melnor/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class MelnorZoneNumberEntityDescription(
entity_category=EntityCategory.CONFIG,
native_max_value=360,
native_min_value=1,
icon="mdi:timer-cog-outline",
key="manual_minutes",
translation_key="manual_minutes",
native_unit_of_measurement=UnitOfTime.MINUTES,
Expand All @@ -57,7 +56,6 @@ class MelnorZoneNumberEntityDescription(
entity_category=EntityCategory.CONFIG,
native_max_value=168,
native_min_value=1,
icon="mdi:calendar-refresh-outline",
key="frequency_interval_hours",
translation_key="frequency_interval_hours",
native_unit_of_measurement=UnitOfTime.HOURS,
Expand All @@ -68,7 +66,6 @@ class MelnorZoneNumberEntityDescription(
entity_category=EntityCategory.CONFIG,
native_max_value=360,
native_min_value=1,
icon="mdi:timer-outline",
key="frequency_duration_minutes",
translation_key="frequency_duration_minutes",
native_unit_of_measurement=UnitOfTime.MINUTES,
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/melnor/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,14 @@ class MelnorSwitchEntityDescription(
ZONE_ENTITY_DESCRIPTIONS = [
MelnorSwitchEntityDescription(
device_class=SwitchDeviceClass.SWITCH,
icon="mdi:sprinkler",
key="manual",
translation_key="manual",
name=None,
on_off_fn=lambda valve, bool: valve.set_is_watering(bool),
state_fn=lambda valve: valve.is_watering,
),
MelnorSwitchEntityDescription(
device_class=SwitchDeviceClass.SWITCH,
icon="mdi:calendar-sync-outline",
key="frequency",
translation_key="frequency",
on_off_fn=lambda valve, bool: valve.set_frequency_enabled(bool),
Expand Down
3 changes: 0 additions & 3 deletions tests/components/melnor/test_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ async def test_manual_watering_minutes(hass: HomeAssistant) -> None:
assert number.attributes["max"] == 360
assert number.attributes["min"] == 1
assert number.attributes["step"] == 1.0
assert number.attributes["icon"] == "mdi:timer-cog-outline"

assert device.zone1.manual_watering_minutes == 0

Expand Down Expand Up @@ -65,7 +64,6 @@ async def test_frequency_interval_hours(hass: HomeAssistant) -> None:
assert number.attributes["max"] == 168
assert number.attributes["min"] == 1
assert number.attributes["step"] == 1.0
assert number.attributes["icon"] == "mdi:calendar-refresh-outline"

assert device.zone1.frequency.interval_hours == 0

Expand Down Expand Up @@ -101,7 +99,6 @@ async def test_frequency_duration_minutes(hass: HomeAssistant) -> None:
assert number.attributes["max"] == 360
assert number.attributes["min"] == 1
assert number.attributes["step"] == 1.0
assert number.attributes["icon"] == "mdi:timer-outline"

assert device.zone1.frequency.duration_minutes == 0

Expand Down
1 change: 0 additions & 1 deletion tests/components/melnor/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ async def test_manual_watering_switch_metadata(hass: HomeAssistant) -> None:

assert switch is not None
assert switch.attributes["device_class"] == SwitchDeviceClass.SWITCH
assert switch.attributes["icon"] == "mdi:sprinkler"


async def test_manual_watering_switch_on_off(hass: HomeAssistant) -> None:
Expand Down

0 comments on commit 3c960b7

Please sign in to comment.