Skip to content

Commit

Permalink
Added DEPENDENCIES to light, sensor and switch components. Fix #26
Browse files Browse the repository at this point in the history
  • Loading branch information
ISO-B committed Nov 25, 2018
1 parent 329f19c commit 87ecd46
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion light/zigate.py
Expand Up @@ -13,8 +13,9 @@

import voluptuous as vol

DEPENDENCIES = ['zigate']

from custom_components.zigate.const import *
from pyzigate.zgt_parameters import *

CONF_LIGHT_TYPE = 'light_type'
CONF_FADE_SPEED = 'fade_speed'
Expand Down
6 changes: 5 additions & 1 deletion sensor/zigate.py
Expand Up @@ -12,8 +12,9 @@
import logging
import voluptuous as vol

DEPENDENCIES = ['zigate']

from custom_components.zigate.const import *
from pyzigate.zgt_parameters import *

_LOGGER = logging.getLogger(__name__)

Expand All @@ -38,10 +39,13 @@ def setup_platform(hass, config, add_devices, discovery_info=None):


class ZiGateSensor(Entity):
from pyzigate.zgt_parameters import ZGT_LAST_SEEN
"""Representation of a Zigbee sensor as seen by the Zigate."""

def __init__(self, hass, name, addr, default_attr=ZGT_LAST_SEEN, default_unit=None):
"""Initialize the sensor."""
from pyzigate.zgt_parameters import ZGT_LAST_SEEN

self._name = name
self._addr = addr
self._default_attr = default_attr if default_attr != '' else ZGT_LAST_SEEN
Expand Down
6 changes: 5 additions & 1 deletion switch/zigate.py
Expand Up @@ -9,8 +9,9 @@

import voluptuous as vol

DEPENDENCIES = ['zigate']

from custom_components.zigate.const import *
from pyzigate.zgt_parameters import *

CONF_DEFAULT_ATTR = 'default_state'
CONF_INVERTED = 'inverted'
Expand Down Expand Up @@ -78,6 +79,8 @@ def state_attributes(self):
return self._attributes

def update_attributes(self, property_id, property_data):
from pyzigate.zgt_parameters import ZGT_STATE_OFF, ZGT_EVENT_PRESENCE, ZGT_STATE_ON

self._attributes[property_id] = property_data

if self._inverted is True:
Expand Down Expand Up @@ -128,6 +131,7 @@ def turn_on(self, **kwargs):
self.schedule_update_ha_state()

def turn_off(self, **kwargs):
from pyzigate.zgt_parameters import ZGT_EVENT
"""Turn the device off."""
# Disarm the activated event
if self._default_attr == ZGT_EVENT:
Expand Down

0 comments on commit 87ecd46

Please sign in to comment.