Fix Ring wifi sensors (#30735)

* Fix Ring wifi sensors

* Update before adding
This commit is contained in:
Paulus Schoutsen 2020-01-13 09:13:46 -08:00 committed by GitHub
parent f50714d7e9
commit 10e89bbc8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,18 +69,33 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
sensors = []
for device in ring_chimes:
for sensor_type in SENSOR_TYPES:
if "chime" in SENSOR_TYPES[sensor_type][1]:
sensors.append(RingSensor(hass, device, sensor_type))
if "chime" not in SENSOR_TYPES[sensor_type][1]:
continue
if sensor_type in ("wifi_signal_category", "wifi_signal_strength"):
await hass.async_add_executor_job(device.update)
sensors.append(RingSensor(hass, device, sensor_type))
for device in ring_doorbells:
for sensor_type in SENSOR_TYPES:
if "doorbell" in SENSOR_TYPES[sensor_type][1]:
sensors.append(RingSensor(hass, device, sensor_type))
if "doorbell" not in SENSOR_TYPES[sensor_type][1]:
continue
if sensor_type in ("wifi_signal_category", "wifi_signal_strength"):
await hass.async_add_executor_job(device.update)
sensors.append(RingSensor(hass, device, sensor_type))
for device in ring_stickup_cams:
for sensor_type in SENSOR_TYPES:
if "stickup_cams" in SENSOR_TYPES[sensor_type][1]:
sensors.append(RingSensor(hass, device, sensor_type))
if "stickup_cams" not in SENSOR_TYPES[sensor_type][1]:
continue
if sensor_type in ("wifi_signal_category", "wifi_signal_strength"):
await hass.async_add_executor_job(device.update)
sensors.append(RingSensor(hass, device, sensor_type))
async_add_entities(sensors, True)