Use NAME from component instead of DOMAIN

This commit is contained in:
ludeeus 2019-01-14 14:59:28 +01:00
parent d4821f086f
commit 0abb64267d
2 changed files with 4 additions and 4 deletions

View file

@ -8,7 +8,7 @@ import logging
from datetime import timedelta from datetime import timedelta
from homeassistant.components.device_tracker import DeviceScanner from homeassistant.components.device_tracker import DeviceScanner
from homeassistant.components.googlehome import CLIENT, DOMAIN, NAME from homeassistant.components.googlehome import CLIENT, NAME
from homeassistant.helpers.event import async_track_time_interval from homeassistant.helpers.event import async_track_time_interval
from homeassistant.util import slugify from homeassistant.util import slugify
@ -41,7 +41,7 @@ class GoogleHomeDeviceScanner(DeviceScanner):
async def async_init(self): async def async_init(self):
"""Further initialize connection to Google Home.""" """Further initialize connection to Google Home."""
await self.client.update_data(self.host) await self.client.update_data(self.host)
data = self.hass.data[DOMAIN][self.host] data = self.hass.data[NAME][self.host]
info = data.get('info', {}) info = data.get('info', {})
connected = bool(info) connected = bool(info)
if connected: if connected:
@ -55,7 +55,7 @@ class GoogleHomeDeviceScanner(DeviceScanner):
"""Ensure the information from Google Home is up to date.""" """Ensure the information from Google Home is up to date."""
_LOGGER.debug('Checking Devices on %s', self.host) _LOGGER.debug('Checking Devices on %s', self.host)
await self.client.update_data(self.host) await self.client.update_data(self.host)
data = self.hass.data[DOMAIN][self.host] data = self.hass.data[NAME][self.host]
info = data.get('info') info = data.get('info')
bluetooth = data.get('bluetooth') bluetooth = data.get('bluetooth')
if info is None or bluetooth is None: if info is None or bluetooth is None:

View file

@ -20,7 +20,7 @@ REQUIREMENTS = ['googledevices==1.0.2']
DOMAIN = 'googlehome' DOMAIN = 'googlehome'
CLIENT = 'googlehome_client' CLIENT = 'googlehome_client'
NAME = 'GoogleHome' NAME = DOMAIN
CONF_DEVICE_TYPES = 'device_types' CONF_DEVICE_TYPES = 'device_types'
CONF_RSSI_THRESHOLD = 'rssi_threshold' CONF_RSSI_THRESHOLD = 'rssi_threshold'