Use string-lights icon for zerproc (#42379)

This commit is contained in:
Emily Mills 2020-10-26 04:04:58 -04:00 committed by GitHub
parent 92b06ed5d4
commit 00df7539cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -1,7 +1,7 @@
"""Zerproc light platform."""
from datetime import timedelta
import logging
from typing import Callable, List
from typing import Callable, List, Optional
import pyzerproc
@ -142,6 +142,11 @@ class ZerprocLight(LightEntity):
"manufacturer": "Zerproc",
}
@property
def icon(self) -> Optional[str]:
"""Return the icon to use in the frontend."""
return "mdi:string-lights"
@property
def supported_features(self):
"""Flag supported features."""

View file

@ -16,6 +16,7 @@ from homeassistant.components.zerproc.light import DOMAIN
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAME,
ATTR_ICON,
ATTR_SUPPORTED_FEATURES,
STATE_OFF,
STATE_ON,
@ -82,6 +83,7 @@ async def test_init(hass):
assert state.attributes == {
ATTR_FRIENDLY_NAME: "LEDBlue-CCDDEEFF",
ATTR_SUPPORTED_FEATURES: SUPPORT_BRIGHTNESS | SUPPORT_COLOR,
ATTR_ICON: "mdi:string-lights",
}
state = hass.states.get("light.ledblue_33445566")
@ -89,6 +91,7 @@ async def test_init(hass):
assert state.attributes == {
ATTR_FRIENDLY_NAME: "LEDBlue-33445566",
ATTR_SUPPORTED_FEATURES: SUPPORT_BRIGHTNESS | SUPPORT_COLOR,
ATTR_ICON: "mdi:string-lights",
ATTR_BRIGHTNESS: 255,
ATTR_HS_COLOR: (221.176, 100.0),
ATTR_RGB_COLOR: (0, 80, 255),
@ -260,6 +263,7 @@ async def test_light_update(hass, mock_light):
assert state.attributes == {
ATTR_FRIENDLY_NAME: "LEDBlue-CCDDEEFF",
ATTR_SUPPORTED_FEATURES: SUPPORT_BRIGHTNESS | SUPPORT_COLOR,
ATTR_ICON: "mdi:string-lights",
}
# Make sure no discovery calls are made while we emulate time passing
@ -277,6 +281,7 @@ async def test_light_update(hass, mock_light):
assert state.attributes == {
ATTR_FRIENDLY_NAME: "LEDBlue-CCDDEEFF",
ATTR_SUPPORTED_FEATURES: SUPPORT_BRIGHTNESS | SUPPORT_COLOR,
ATTR_ICON: "mdi:string-lights",
}
with patch.object(
@ -293,6 +298,7 @@ async def test_light_update(hass, mock_light):
assert state.attributes == {
ATTR_FRIENDLY_NAME: "LEDBlue-CCDDEEFF",
ATTR_SUPPORTED_FEATURES: SUPPORT_BRIGHTNESS | SUPPORT_COLOR,
ATTR_ICON: "mdi:string-lights",
}
with patch.object(
@ -309,6 +315,7 @@ async def test_light_update(hass, mock_light):
assert state.attributes == {
ATTR_FRIENDLY_NAME: "LEDBlue-CCDDEEFF",
ATTR_SUPPORTED_FEATURES: SUPPORT_BRIGHTNESS | SUPPORT_COLOR,
ATTR_ICON: "mdi:string-lights",
ATTR_BRIGHTNESS: 220,
ATTR_HS_COLOR: (261.429, 31.818),
ATTR_RGB_COLOR: (202, 173, 255),