Fix incorrect RainMachine service helper (#58633)

This commit is contained in:
Aaron Bach 2021-10-28 14:29:25 -06:00 committed by GitHub
parent 37a07acce0
commit 2b7fe06b16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -127,9 +127,11 @@ def async_get_controller_for_service_call(
device_registry = dr.async_get(hass)
if device_entry := device_registry.async_get(device_id):
for entry_id in device_entry.config_entries:
if controller := hass.data[DOMAIN][entry_id][DATA_CONTROLLER]:
return cast(Controller, controller)
for entry in hass.config_entries.async_entries(DOMAIN):
if entry.entry_id in device_entry.config_entries:
return cast(
Controller, hass.data[DOMAIN][entry.entry_id][DATA_CONTROLLER]
)
raise ValueError(f"No controller for device ID: {device_id}")