mirror of
https://github.com/andvikt/mega_hacs.git
synced 2025-12-12 17:44:28 +05:00
fix HA 2025.1 compatibility; cleanup
This commit is contained in:
@@ -3,7 +3,6 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import typing
|
||||
from datetime import timedelta, datetime
|
||||
from functools import partial
|
||||
|
||||
@@ -13,13 +12,9 @@ import time
|
||||
|
||||
from homeassistant.components.light import (
|
||||
PLATFORM_SCHEMA as LIGHT_SCHEMA,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
LightEntity,
|
||||
SUPPORT_TRANSITION,
|
||||
SUPPORT_COLOR,
|
||||
ColorMode,
|
||||
LightEntityFeature,
|
||||
# SUPPORT_WHITE_VALUE
|
||||
LightEntityFeature
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
@@ -124,10 +119,21 @@ async def async_setup_entry(
|
||||
class MegaLight(MegaOutPort, LightEntity):
|
||||
@property
|
||||
def supported_features(self):
|
||||
return (SUPPORT_BRIGHTNESS if self.dimmer else 0) | (
|
||||
SUPPORT_TRANSITION if self.dimmer else 0
|
||||
)
|
||||
return LightEntityFeature.TRANSITION if self.dimmer else LightEntityFeature(0)
|
||||
|
||||
@property
|
||||
def supported_color_modes(self):
|
||||
if self.dimmer:
|
||||
return {ColorMode.BRIGHTNESS}
|
||||
else:
|
||||
return {ColorMode.ONOFF}
|
||||
|
||||
@property
|
||||
def color_mode(self):
|
||||
if self.dimmer:
|
||||
return ColorMode.BRIGHTNESS
|
||||
else:
|
||||
return ColorMode.ONOFF
|
||||
|
||||
class MegaRGBW(LightEntity, BaseMegaEntity):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user