Skip to content

Commit

Permalink
Update light.py
Browse files Browse the repository at this point in the history
Included proposed changes as described in the HA blog: https://developers.home-assistant.io/blog/2020/05/14/entity-class-names
Light is deprecated and replaced by LightEntity.
No idea if what I did makes sense, but might be a starting point to fix this error
Should fix issue jnimmo#31
  • Loading branch information
filmgarage authored Jun 7, 2020
1 parent 2d449bf commit 3dec59b
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions custom_components/dmx/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,32 @@

from homeassistant.const import (CONF_DEVICES, CONF_HOST, CONF_NAME, CONF_PORT,
CONF_TYPE, STATE_ON, STATE_OFF)
from homeassistant.components.light import (ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
ATTR_TRANSITION,
ATTR_WHITE_VALUE,
ATTR_COLOR_TEMP,
Light,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_WHITE_VALUE,
SUPPORT_TRANSITION,
SUPPORT_COLOR_TEMP)
try:
from homeassistant.components.light import (ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
ATTR_TRANSITION,
ATTR_WHITE_VALUE,
ATTR_COLOR_TEMP,
LightEntity,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_WHITE_VALUE,
SUPPORT_TRANSITION,
SUPPORT_COLOR_TEMP)
except ImportError:
from homeassistant.components.light import (ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
ATTR_TRANSITION,
ATTR_WHITE_VALUE,
ATTR_COLOR_TEMP,
Light as LightEntity,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_WHITE_VALUE,
SUPPORT_TRANSITION,
SUPPORT_COLOR_TEMP)
from homeassistant.util.color import color_rgb_to_rgbw
import homeassistant.helpers.config_validation as cv
import homeassistant.util.color as color_util
Expand Down Expand Up @@ -167,7 +181,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
return True


class DMXLight(Light):
class DMXLight(LightEntity):
"""Representation of a DMX Art-Net light."""

def __init__(self, light, dmx_gateway, send_immediately, default_type):
Expand Down

0 comments on commit 3dec59b

Please sign in to comment.