Skip to content

Commit

Permalink
Fix no-member warning (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
KapJI authored Mar 11, 2021
1 parent b6e15ca commit 1ca1815
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 54 deletions.
35 changes: 10 additions & 25 deletions custom_components/google_home/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@


class GoogleHomeDeviceEntity(CoordinatorEntity):
def __init__(self, coordinator, config_entry):
def __init__(self, coordinator, device_name):
super().__init__(coordinator)
self.config_entry = config_entry
self.device_name = device_name

@property
def device_info(self):
Expand All @@ -45,21 +45,16 @@ def icon(self):
"""Return the icon of the sensor."""
return ICON_TOKEN

@property
def state(self):
"""Return the state of the sensor."""
return self._state

@property
def device_class(self):
"""Return de device class of the sensor."""
return "google_home__custom_device_class"


class GoogleHomeAlarmEntity(CoordinatorEntity):
def __init__(self, coordinator, config_entry):
def __init__(self, coordinator, device_name):
super().__init__(coordinator)
self.config_entry = config_entry
self.device_name = device_name

@property
def device_info(self):
Expand All @@ -85,16 +80,11 @@ def icon(self):
"""Icon to use in the frontend, if any."""
return ICON_ALARMS

@property
def state(self):
"""Return the state of the sensor."""
return self._state


class GoogleHomeNextAlarmEntity(CoordinatorEntity):
def __init__(self, coordinator, config_entry):
def __init__(self, coordinator, device_name):
super().__init__(coordinator)
self.config_entry = config_entry
self.device_name = device_name

@property
def device_info(self):
Expand Down Expand Up @@ -122,9 +112,9 @@ def icon(self):


class GoogleHomeTimersEntity(CoordinatorEntity):
def __init__(self, coordinator, config_entry):
def __init__(self, coordinator, device_name):
super().__init__(coordinator)
self.config_entry = config_entry
self.device_name = device_name

@property
def name(self):
Expand All @@ -150,16 +140,11 @@ def icon(self):
"""Icon to use in the frontend, if any."""
return ICON_TIMERS

@property
def state(self):
"""Return the state of the sensor."""
return self._state


class GoogleHomeNextTimerEntity(CoordinatorEntity):
def __init__(self, coordinator, config_entry):
def __init__(self, coordinator, device_name):
super().__init__(coordinator)
self.config_entry = config_entry
self.device_name = device_name

@property
def device_info(self):
Expand Down
30 changes: 2 additions & 28 deletions custom_components/google_home/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ async def async_setup_entry(hass, entry, async_add_devices):
sensors.append(
GoogleHomeDeviceSensor(
coordinator,
entry,
device.name,
device.auth_token,
)
Expand All @@ -32,22 +31,18 @@ async def async_setup_entry(hass, entry, async_add_devices):
sensors += [
GoogleHomeAlarmSensor(
coordinator,
entry,
device.name,
),
GoogleHomeNextAlarmSensor(
coordinator,
entry,
device.name,
),
GoogleHomeTimerSensor(
coordinator,
entry,
device.name,
),
GoogleHomeNextTimerSensor(
coordinator,
entry,
device.name,
),
]
Expand Down Expand Up @@ -76,10 +71,9 @@ def as_dict(obj_list):
class GoogleHomeDeviceSensor(GoogleHomeSensorMixin, GoogleHomeDeviceEntity):
"""GoogleHome Device Sensor class."""

def __init__(self, coordinator, entry, device_name, auth_token):
def __init__(self, coordinator, device_name, auth_token):
"""Initialize the sensor."""
super().__init__(coordinator, entry)
self.device_name = device_name
super().__init__(coordinator, device_name)
self.auth_token = auth_token

@property
Expand Down Expand Up @@ -119,11 +113,6 @@ def get_device_attributes(device):
class GoogleHomeAlarmSensor(GoogleHomeSensorMixin, GoogleHomeAlarmEntity):
"""Representation of a Sensor."""

def __init__(self, coordinator, entry, device_name):
"""Initialize the sensor."""
super().__init__(coordinator, entry)
self.device_name = device_name

@property
def state(self):
alarms = self._get_alarms_data()
Expand All @@ -147,11 +136,6 @@ def _get_alarms_data(self):
class GoogleHomeNextAlarmSensor(GoogleHomeSensorMixin, GoogleHomeNextAlarmEntity):
"""Representation of a Sensor."""

def __init__(self, coordinator, entry, device_name):
"""Initialize the sensor."""
super().__init__(coordinator, entry)
self.device_name = device_name

@property
def state(self):
alarm = self._get_next_alarm()
Expand Down Expand Up @@ -179,11 +163,6 @@ def _get_next_alarm(self):
class GoogleHomeTimerSensor(GoogleHomeSensorMixin, GoogleHomeTimersEntity):
"""Representation of a Sensor."""

def __init__(self, coordinator, entry, device_name):
"""Initialize the sensor."""
super().__init__(coordinator, entry)
self.device_name = device_name

@property
def state(self):
timers = self._get_timers_data()
Expand All @@ -206,11 +185,6 @@ def _get_timers_data(self):
class GoogleHomeNextTimerSensor(GoogleHomeSensorMixin, GoogleHomeNextTimerEntity):
"""Representation of a Sensor."""

def __init__(self, coordinator, entry, device_name):
"""Initialize the sensor."""
super().__init__(coordinator, entry)
self.device_name = device_name

@property
def state(self):
timer = self._get_next_timer()
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ disable = [
"missing-class-docstring",
"missing-function-docstring",
"missing-module-docstring",
"no-member",
"too-few-public-methods",
"too-many-arguments",
"too-many-instance-attributes",
Expand Down

0 comments on commit 1ca1815

Please sign in to comment.