Remove global variable from zigbee (#33750)

* Remove global variable from zigbee

* Pass device instead of hass into the constructor
This commit is contained in:
springstan authored and GitHub committed 2020-04-07 17:41:23 +02:00
1 parent 894aac1b45
commit 325e5416ef
5 files changed
+64 -77

No files matched your search

+3 -2
View File
@@ -3,7 +3,7 @@ import voluptuous as vol
from homeassistant.components.switch import SwitchDevice
from . import PLATFORM_SCHEMA, ZigBeeDigitalOut, ZigBeeDigitalOutConfig
from . import DOMAIN, PLATFORM_SCHEMA, ZigBeeDigitalOut, ZigBeeDigitalOutConfig
CONF_ON_STATE = "on_state"
@@ -16,7 +16,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Optional(CONF_ON_STATE): vol.In(ST
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Zigbee switch platform."""
add_entities([ZigBeeSwitch(hass, ZigBeeDigitalOutConfig(config))])
zigbee_device = hass.data[DOMAIN]
add_entities([ZigBeeSwitch(ZigBeeDigitalOutConfig(config), zigbee_device)])
class ZigBeeSwitch(ZigBeeDigitalOut, SwitchDevice):