commit
0871d6c9c6
9 changed files with 45 additions and 26 deletions
|
@ -8,7 +8,7 @@ trigger:
|
|||
pr: none
|
||||
variables:
|
||||
- name: versionBuilder
|
||||
value: '4.2'
|
||||
value: '4.5'
|
||||
- group: docker
|
||||
- group: github
|
||||
- group: twine
|
||||
|
|
|
@ -37,7 +37,7 @@ class GoogleConfig(AbstractConfig):
|
|||
@property
|
||||
def entity_config(self):
|
||||
"""Return entity config."""
|
||||
return self._config.get(CONF_ENTITY_CONFIG, {})
|
||||
return self._config.get(CONF_ENTITY_CONFIG) or {}
|
||||
|
||||
@property
|
||||
def secure_devices_pin(self):
|
||||
|
|
|
@ -294,7 +294,6 @@ class Life360Scanner:
|
|||
member_id = member['id']
|
||||
if member_id in members_updated:
|
||||
continue
|
||||
members_updated.append(member_id)
|
||||
err_key = 'Member data'
|
||||
try:
|
||||
first = member.get('firstName')
|
||||
|
@ -318,6 +317,7 @@ class Life360Scanner:
|
|||
self._ok(err_key)
|
||||
|
||||
if include_member and sharing:
|
||||
members_updated.append(member_id)
|
||||
self._update_member(member, dev_id)
|
||||
|
||||
def _update_life360(self, now=None):
|
||||
|
|
|
@ -99,6 +99,12 @@ MODULE_TYPE_RAIN = 'NAModule3'
|
|||
MODULE_TYPE_INDOOR = 'NAModule4'
|
||||
|
||||
|
||||
NETATMO_DEVICE_TYPES = {
|
||||
'WeatherStationData': 'weather station',
|
||||
'HomeCoachData': 'home coach'
|
||||
}
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the available Netatmo weather sensors."""
|
||||
dev = []
|
||||
|
@ -132,7 +138,14 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
|
||||
import pyatmo
|
||||
for data_class in [pyatmo.WeatherStationData, pyatmo.HomeCoachData]:
|
||||
data = NetatmoData(auth, data_class, config.get(CONF_STATION))
|
||||
try:
|
||||
data = NetatmoData(auth, data_class, config.get(CONF_STATION))
|
||||
except pyatmo.NoDevice:
|
||||
_LOGGER.warning(
|
||||
"No %s devices found",
|
||||
NETATMO_DEVICE_TYPES[data_class.__name__]
|
||||
)
|
||||
continue
|
||||
# Test if manually configured
|
||||
if CONF_MODULES in config:
|
||||
module_items = config[CONF_MODULES].items()
|
||||
|
@ -157,18 +170,11 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
def find_devices(data):
|
||||
"""Find all devices."""
|
||||
dev = []
|
||||
not_handled = []
|
||||
for module_name in data.get_module_names():
|
||||
if (module_name not in data.get_module_names()
|
||||
and module_name not in not_handled):
|
||||
not_handled.append(not_handled)
|
||||
continue
|
||||
module_names = data.get_module_names()
|
||||
for module_name in module_names:
|
||||
for condition in data.station_data.monitoredConditions(module_name):
|
||||
dev.append(NetatmoSensor(
|
||||
data, module_name, condition.lower(), data.station))
|
||||
|
||||
for module_name in not_handled:
|
||||
_LOGGER.error('Module name: "%s" not found', module_name)
|
||||
return dev
|
||||
|
||||
|
||||
|
@ -187,12 +193,11 @@ class NetatmoSensor(Entity):
|
|||
self._device_class = SENSOR_TYPES[self.type][3]
|
||||
self._icon = SENSOR_TYPES[self.type][2]
|
||||
self._unit_of_measurement = SENSOR_TYPES[self.type][1]
|
||||
self._module_type = self.netatmo_data. \
|
||||
station_data.moduleByName(module=module_name)['type']
|
||||
module_id = self.netatmo_data. \
|
||||
station_data.moduleByName(station=self.station_name,
|
||||
module=module_name)['_id']
|
||||
self._unique_id = '{}-{}'.format(module_id, self.type)
|
||||
module = self.netatmo_data.station_data.moduleByName(
|
||||
station=self.station_name, module=module_name
|
||||
)
|
||||
self._module_type = module['type']
|
||||
self._unique_id = '{}-{}'.format(module['_id'], self.type)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -515,15 +520,14 @@ class NetatmoData:
|
|||
self.auth = auth
|
||||
self.data_class = data_class
|
||||
self.data = {}
|
||||
self.station_data = None
|
||||
self.station_data = self.data_class(self.auth)
|
||||
self.station = station
|
||||
self._next_update = time()
|
||||
self._update_in_progress = threading.Lock()
|
||||
|
||||
def get_module_names(self):
|
||||
"""Return all module available on the API as a list."""
|
||||
self.update()
|
||||
return self.data.keys()
|
||||
return self.station_data.modulesNamesList()
|
||||
|
||||
def update(self):
|
||||
"""Call the Netatmo API to update the data.
|
||||
|
|
|
@ -79,9 +79,14 @@ async def async_setup(hass, config):
|
|||
async def turn_off_service(service):
|
||||
"""Cancel a script."""
|
||||
# Stopping a script is ok to be done in parallel
|
||||
scripts = await component.async_extract_from_service(service)
|
||||
|
||||
if not scripts:
|
||||
return
|
||||
|
||||
await asyncio.wait([
|
||||
script.async_turn_off() for script
|
||||
in await component.async_extract_from_service(service)
|
||||
in scripts
|
||||
])
|
||||
|
||||
async def toggle_service(service):
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"documentation": "https://www.home-assistant.io/components/zha",
|
||||
"requirements": [
|
||||
"bellows-homeassistant==0.8.2",
|
||||
"zha-quirks==0.0.15",
|
||||
"zha-quirks==0.0.17",
|
||||
"zigpy-deconz==0.1.6",
|
||||
"zigpy-homeassistant==0.6.1",
|
||||
"zigpy-xbee-homeassistant==0.3.0"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"""Constants used by Home Assistant components."""
|
||||
MAJOR_VERSION = 0
|
||||
MINOR_VERSION = 95
|
||||
PATCH_VERSION = '1'
|
||||
PATCH_VERSION = '2'
|
||||
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
|
||||
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
|
||||
REQUIRED_PYTHON_VER = (3, 5, 3)
|
||||
|
|
|
@ -1917,7 +1917,7 @@ zengge==0.2
|
|||
zeroconf==0.23.0
|
||||
|
||||
# homeassistant.components.zha
|
||||
zha-quirks==0.0.15
|
||||
zha-quirks==0.0.17
|
||||
|
||||
# homeassistant.components.zhong_hong
|
||||
zhong_hong_hvac==1.0.9
|
||||
|
|
|
@ -322,3 +322,13 @@ async def test_logging_script_error(hass, caplog):
|
|||
assert err.value.domain == 'non'
|
||||
assert err.value.service == 'existing'
|
||||
assert 'Error executing script' in caplog.text
|
||||
|
||||
|
||||
async def test_turning_no_scripts_off(hass):
|
||||
"""Test it is possible to turn two scripts off."""
|
||||
assert await async_setup_component(hass, 'script', {})
|
||||
|
||||
# Testing it doesn't raise
|
||||
await hass.services.async_call(
|
||||
DOMAIN, SERVICE_TURN_OFF, {'entity_id': []}, blocking=True
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue