From 82ea84a2da4022413ee0c05620fa75650a3b8fd3 Mon Sep 17 00:00:00 2001 From: JyunWei-Su <43307755+JyunWei-Su@users.noreply.github.com> Date: Thu, 22 Aug 2024 09:21:10 +0800 Subject: [PATCH] Fix sensor failed when device offline --- custom_components/panasonic_smart_app/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/panasonic_smart_app/sensor.py b/custom_components/panasonic_smart_app/sensor.py index d24db69..3c98f15 100644 --- a/custom_components/panasonic_smart_app/sensor.py +++ b/custom_components/panasonic_smart_app/sensor.py @@ -53,7 +53,7 @@ async def async_setup_entry(hass, entry, async_add_entities) -> bool: for index, device in enumerate(devices): device_type = int(device.get("DeviceType")) - device_status = coordinator.data[index]["status"].keys() + device_status = coordinator.data[index].get("status", {}).keys() _LOGGER.debug(f"Device index #{index} status: {device_status}") sensors.append(