Skip to content

Commit

Permalink
Remove duplicated attribute request from ZHA
Browse files Browse the repository at this point in the history
The on_off attribute is on the REPORT_CONFIG, so
super().async_initialize already requests it from the device.
No need to request it twice.
  • Loading branch information
abmantis committed Oct 7, 2020
1 parent ee91436 commit 85e541b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions homeassistant/components/zha/core/channels/general.py
Expand Up @@ -3,11 +3,10 @@
import logging
from typing import Any, List, Optional

import zigpy.exceptions
import zigpy.zcl.clusters.general as general

from homeassistant.core import callback
from homeassistant.helpers.event import async_call_later
import zigpy.exceptions
import zigpy.zcl.clusters.general as general

from .. import registries, typing as zha_typing
from ..const import (
Expand Down Expand Up @@ -294,10 +293,10 @@ def attribute_updated(self, attrid, value):

async def async_initialize(self, from_cache):
"""Initialize channel."""
state = await self.get_attribute_value(self.ON_OFF, from_cache=from_cache)
await super().async_initialize(from_cache)
state = await self.get_attribute_value(self.ON_OFF, from_cache=True)
if state is not None:
self._state = bool(state)
await super().async_initialize(from_cache)

async def async_update(self):
"""Initialize channel."""
Expand Down

0 comments on commit 85e541b

Please sign in to comment.