Adjust type hints in greewave (#77492)

This commit is contained in:
epenet 2022-08-30 21:06:31 +02:00 committed by GitHub
parent 809aa6b30f
commit 67db380253
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,29 +72,14 @@ class GreenwaveLight(LightEntity):
def __init__(self, light, host, token, gatewaydata):
"""Initialize a Greenwave Reality Light."""
self._did = int(light["did"])
self._name = light["name"]
self._attr_name = light["name"]
self._state = int(light["state"])
self._brightness = greenwave.hass_brightness(light)
self._attr_brightness = greenwave.hass_brightness(light)
self._host = host
self._online = greenwave.check_online(light)
self._attr_available = greenwave.check_online(light)
self._token = token
self._gatewaydata = gatewaydata
@property
def available(self):
"""Return True if entity is available."""
return self._online
@property
def name(self):
"""Return the display name of this light."""
return self._name
@property
def brightness(self):
"""Return the brightness of the light."""
return self._brightness
@property
def is_on(self):
"""Return true if light is on."""
@ -116,9 +101,9 @@ class GreenwaveLight(LightEntity):
bulbs = self._gatewaydata.greenwave
self._state = int(bulbs[self._did]["state"])
self._brightness = greenwave.hass_brightness(bulbs[self._did])
self._online = greenwave.check_online(bulbs[self._did])
self._name = bulbs[self._did]["name"]
self._attr_brightness = greenwave.hass_brightness(bulbs[self._did])
self._attr_available = greenwave.check_online(bulbs[self._did])
self._attr_name = bulbs[self._did]["name"]
class GatewayData: