Code linting

This commit is contained in:
2021-04-29 10:18:23 +00:00
parent c1a000abb3
commit 862b93a175
15 changed files with 337 additions and 305 deletions

View File

@@ -1,4 +1,3 @@
import logging
from datetime import datetime
from homeassistant.const import STATE_UNAVAILABLE, STATE_ON, STATE_OFF
@@ -6,7 +5,8 @@ from homeassistant.components.light import LightEntity, SUPPORT_BRIGHTNESS
from .helpers import setup_platform, BrowserModEntity
PLATFORM = 'light'
PLATFORM = "light"
async def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
return setup_platform(hass, config, async_add_devices, PLATFORM, BrowserModLight)
@@ -31,31 +31,31 @@ class BrowserModLight(LightEntity, BrowserModEntity):
def state(self):
if not self.connection.connection:
return STATE_UNAVAILABLE
if self.data.get('blackout', False):
if self.data.get("blackout", False):
return STATE_OFF
return STATE_ON
@property
def is_on(self):
return not self.data.get('blackout', False)
return not self.data.get("blackout", False)
@property
def device_state_attributes(self):
return {
"type": "browser_mod",
"deviceID": self.deviceID,
"last_seen": self.last_seen,
}
"type": "browser_mod",
"deviceID": self.deviceID,
"last_seen": self.last_seen,
}
@property
def supported_features(self):
if self.data.get('brightness', False):
if self.data.get("brightness", False):
return SUPPORT_BRIGHTNESS
return 0
@property
def brightness(self):
return self.data.get('brightness', None)
return self.data.get("brightness", None)
def turn_on(self, **kwargs):
self.connection.send("no-blackout", **kwargs)