Rename of the zwave hass.data constants (#7768)

* Rename of the zwave hass.data constants

* Remove zwave since it is already implied
This commit is contained in:
Adam Mills authored and Paulus Schoutsen committed 2017-05-25 21:11:02 -07:00
1 parent 3a843e1817
commit 65c3201fa6
9 files changed
+47 -48

No files matched your search

+1 -1
View File
@@ -41,7 +41,7 @@ class ZwaveRollershutter(zwave.ZWaveDeviceEntity, CoverDevice):
"""Initialize the Z-Wave rollershutter."""
ZWaveDeviceEntity.__init__(self, values, DOMAIN)
# pylint: disable=no-member
self._network = hass.data[zwave.ZWAVE_NETWORK]
self._network = hass.data[zwave.const.DATA_NETWORK]
self._open_id = None
self._close_id = None
self._current_position = None
+1 -1
View File
@@ -128,7 +128,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
descriptions = load_yaml_config_file(
path.join(path.dirname(__file__), 'services.yaml'))
network = hass.data[zwave.ZWAVE_NETWORK]
network = hass.data[zwave.const.DATA_NETWORK]
def set_usercode(service):
"""Set the usercode to index X on the lock."""
+6 -8
View File
@@ -30,7 +30,7 @@ from homeassistant.components.frontend import register_built_in_panel
from . import api
from . import const
from .const import DOMAIN
from .const import DOMAIN, DATA_DEVICES, DATA_NETWORK
from .node_entity import ZWaveBaseEntity, ZWaveNodeEntity
from . import workaround
from .discovery_schemas import DISCOVERY_SCHEMAS
@@ -67,10 +67,8 @@ DEFAULT_CONF_INVERT_OPENCLOSE_BUTTONS = False
DEFAULT_CONF_REFRESH_VALUE = False
DEFAULT_CONF_REFRESH_DELAY = 5
DATA_ZWAVE_DICT = 'zwave_devices'
OZW_LOG_FILENAME = 'OZW_Log.txt'
URL_API_OZW_LOG = '/api/zwave/ozwlog'
ZWAVE_NETWORK = 'zwave_network'
RENAME_NODE_SCHEMA = vol.Schema({
vol.Required(const.ATTR_NODE_ID): vol.Coerce(int),
@@ -210,10 +208,10 @@ def get_config_value(node, value_index, tries=5):
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the Z-Wave platform (generic part)."""
if discovery_info is None or ZWAVE_NETWORK not in hass.data:
if discovery_info is None or DATA_NETWORK not in hass.data:
return False
device = hass.data[DATA_ZWAVE_DICT].pop(
device = hass.data[DATA_DEVICES].pop(
discovery_info[const.DISCOVERY_DEVICE], None)
if device is None:
return False
@@ -258,8 +256,8 @@ def setup(hass, config):
options.lock()
network = hass.data[ZWAVE_NETWORK] = ZWaveNetwork(options, autostart=False)
hass.data[DATA_ZWAVE_DICT] = {}
network = hass.data[DATA_NETWORK] = ZWaveNetwork(options, autostart=False)
hass.data[DATA_DEVICES] = {}
if use_debug: # pragma: no cover
def log_all(signal, value=None):
@@ -783,7 +781,7 @@ class ZWaveDeviceEntityValues():
@asyncio.coroutine
def discover_device(component, device, dict_id):
"""Put device in a dictionary and call discovery on it."""
self._hass.data[DATA_ZWAVE_DICT][dict_id] = device
self._hass.data[DATA_DEVICES][dict_id] = device
yield from discovery.async_load_platform(
self._hass, component, DOMAIN,
{const.DISCOVERY_DEVICE: dict_id}, self._zwave_config)
+3 -5
View File
@@ -8,8 +8,6 @@ from . import const
_LOGGER = logging.getLogger(__name__)
ZWAVE_NETWORK = 'zwave_network'
class ZWaveNodeGroupView(HomeAssistantView):
"""View to return the nodes group configuration."""
@@ -22,7 +20,7 @@ class ZWaveNodeGroupView(HomeAssistantView):
"""Retrieve groups of node."""
nodeid = int(node_id)
hass = request.app['hass']
network = hass.data.get(ZWAVE_NETWORK)
network = hass.data.get(const.DATA_NETWORK)
node = network.nodes.get(nodeid)
if node is None:
return self.json_message('Node not found', HTTP_NOT_FOUND)
@@ -48,7 +46,7 @@ class ZWaveNodeConfigView(HomeAssistantView):
"""Retrieve configurations of node."""
nodeid = int(node_id)
hass = request.app['hass']
network = hass.data.get(ZWAVE_NETWORK)
network = hass.data.get(const.DATA_NETWORK)
node = network.nodes.get(nodeid)
if node is None:
return self.json_message('Node not found', HTTP_NOT_FOUND)
@@ -77,7 +75,7 @@ class ZWaveUserCodeView(HomeAssistantView):
"""Retrieve usercodes of node."""
nodeid = int(node_id)
hass = request.app['hass']
network = hass.data.get(ZWAVE_NETWORK)
network = hass.data.get(const.DATA_NETWORK)
node = network.nodes.get(nodeid)
if node is None:
return self.json_message('Node not found', HTTP_NOT_FOUND)
+3
View File
@@ -18,6 +18,9 @@ NETWORK_READY_WAIT_SECS = 30
DISCOVERY_DEVICE = 'device'
DATA_DEVICES = 'zwave_devices'
DATA_NETWORK = 'zwave_network'
SERVICE_CHANGE_ASSOCIATION = "change_association"
SERVICE_ADD_NODE = "add_node"
SERVICE_ADD_NODE_SECURE = "add_node_secure"