prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Xiaomi Mijia Light Sensor (GZCGQ01LM) in ZHA not detecting battery level anymore (it did in previous versions lower than 2020.12.7)
  Hai The original call is from ( lustreking aka Steve Small) , I (yfands) can confirm Steve's findings indeed no battery level.
  Steve posted his issue [here ](https://community.home-assistant.io/t/xiaomi-mijia-zha-not-detecting-battery-level/257827)but no answer there, so iam trying it here. In his original call there are 2 pictures one when all was well and the second picture after the update to 2020.12.7, the one that is not working any more, the difference is the class the device was assigned to.
  
  The Problem
  A while ago I got a Xiaomi Mijia Light Sensor (GZCGQ01LM), and it worked well for me, so I eventually ordered 2 more. Before I got them, I updated to the current version of HA (2020.12.7), as well as migrated HA to a new RPi.
  
  When I tried to add them, ZHA found the illuminance entity, but not the battery entity, which my previous sensor had.
  
  In ZHA I see the new sensors listed as Xiaomi, while the previous sensor’s manufacturer was listed as lumi. The model for both is lumi.sen_ill.mgl01
  
  Under the zigbee info for the new ones it says “Power Source: Mains” which is obviously incorrect!
  Here are the zigbee details of the good and bad ones, (see his original link).. The configuration below is from me (yfands), so to be short in ZHA found the illuminance entity, but not the battery entity anymore!
  
  ## System Health
  
  version | 2020.12.2
  -- | --
  installation_type | Home Assistant OS
  dev | false
  hassio | true
  docker | true
  virtualenv | false
  python_version | 3.8.6
  os_name | Linux
  os_version | 5.4.79-v8
  arch | aarch64
  timezone | Europe/Amsterdam
  
  <details><summary>Home Assistant Community Store</summary>
  
  GitHub API | ok
  -- | --
  Github API Calls Remaining | 4646
  Installed Version | 1.9.0
  Stage | running
  Available Repositories | 711
  Installed Repositories | 29
  
  </details>
  
  <details><summary>Home Assistant Cloud</summary>
  
  logged_in | false
  -- | --
  can_reach_cert_server | ok
  can_reach_cloud_auth | ok
  can_reach_cloud | ok
  
  </details>
  
  <details><summary>Home Assistant Supervisor</summary>
  
  host_os | Home Assistant OS 5.9
  -- | --
  update_channel | stable
  supervisor_version | 2020.12.7
  docker_version | 19.03.13
  disk_total | 27.2 GB
  disk_used | 5.5 GB
  healthy | true
  supported | true
  board | rpi4-64
  supervisor_api | ok
  version_api | ok
  installed_addons | File editor (5.2.0), Samba share (9.3.0), Terminal & SSH (8.10.0), Mosquitto broker (5.1), Node-RED (7.2.11)
  
  </details>
  
  <details><summary>Lovelace</summary>
  
  dashboards | 1
  -- | --
  mode | storage
  views | 10
  resources | 20
  
  </details>
  
  
  </issue>
  <code>
  [start of zhaquirks/xiaomi/aqara/illumination.py]
  1 """Quirk for lumi.sen_ill.mgl01 illumination sensor."""
  2 import logging
  3 
  4 from zigpy.profiles import zha
  5 from zigpy.zcl.clusters.general import Basic, Identify
  6 from zigpy.zcl.clusters.measurement import IlluminanceMeasurement
  7 from zigpy.zdo.types import NodeDescriptor
  8 
  9 from .. import LUMI, BasicCluster, XiaomiCustomDevice
  10 from ... import PowerConfigurationCluster
  11 from ...const import (
  12     DEVICE_TYPE,
  13     ENDPOINTS,
  14     INPUT_CLUSTERS,
  15     MODELS_INFO,
  16     NODE_DESCRIPTOR,
  17     OUTPUT_CLUSTERS,
  18     PROFILE_ID,
  19 )
  20 
  21 _LOGGER = logging.getLogger(__name__)
  22 
  23 
  24 class Illumination(XiaomiCustomDevice):
  25     """Aqara LUMI lumi.sen_ill.mgl01."""
  26 
  27     signature = {
  28         # <SimpleDescriptor endpoint=1 profile=260 device_type=262
  29         # device_version=1
  30         # input_clusters=[0, 1024, 3, 1]
  31         # output_clusters=[3]>
  32         MODELS_INFO: [(LUMI, "lumi.sen_ill.mgl01")],
  33         ENDPOINTS: {
  34             1: {
  35                 PROFILE_ID: zha.PROFILE_ID,
  36                 DEVICE_TYPE: zha.DeviceType.LIGHT_SENSOR,
  37                 INPUT_CLUSTERS: [
  38                     Basic.cluster_id,
  39                     Identify.cluster_id,
  40                     IlluminanceMeasurement.cluster_id,
  41                     PowerConfigurationCluster.cluster_id,
  42                 ],
  43                 OUTPUT_CLUSTERS: [Identify.cluster_id],
  44             }
  45         },
  46     }
  47 
  48     replacement = {
  49         NODE_DESCRIPTOR: NodeDescriptor(
  50             0x02, 0x40, 0x80, 0x115F, 0x7F, 0x0064, 0x2C00, 0x0064, 0x00
  51         ),
  52         ENDPOINTS: {
  53             1: {
  54                 PROFILE_ID: zha.PROFILE_ID,
  55                 DEVICE_TYPE: zha.DeviceType.LIGHT_SENSOR,
  56                 INPUT_CLUSTERS: [
  57                     BasicCluster,
  58                     Identify.cluster_id,
  59                     IlluminanceMeasurement.cluster_id,
  60                     PowerConfigurationCluster,
  61                 ],
  62                 OUTPUT_CLUSTERS: [Identify.cluster_id],
  63             }
  64         },
  65     }
  66
  [end of zhaquirks/xiaomi/aqara/illumination.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/zhaquirks/xiaomi/aqara/illumination.py b/zhaquirks/xiaomi/aqara/illumination.py
  --- a/zhaquirks/xiaomi/aqara/illumination.py
  +++ b/zhaquirks/xiaomi/aqara/illumination.py
  @@ -29,7 +29,7 @@
           # device_version=1
           # input_clusters=[0, 1024, 3, 1]
           # output_clusters=[3]>
  -        MODELS_INFO: [(LUMI, "lumi.sen_ill.mgl01")],
  +        MODELS_INFO: [(LUMI, "lumi.sen_ill.mgl01"), ("XIAOMI", "lumi.sen_ill.mgl01")],
           ENDPOINTS: {
               1: {
                   PROFILE_ID: zha.PROFILE_ID,
  
verification_info: {"golden_diff": "diff --git a/zhaquirks/xiaomi/aqara/illumination.py b/zhaquirks/xiaomi/aqara/illumination.py\n--- a/zhaquirks/xiaomi/aqara/illumination.py\n+++ b/zhaquirks/xiaomi/aqara/illumination.py\n@@ -29,7 +29,7 @@\n         # device_version=1\n         # input_clusters=[0, 1024, 3, 1]\n         # output_clusters=[3]>\n-        MODELS_INFO: [(LUMI, \"lumi.sen_ill.mgl01\")],\n+        MODELS_INFO: [(LUMI, \"lumi.sen_ill.mgl01\"), (\"XIAOMI\", \"lumi.sen_ill.mgl01\")],\n         ENDPOINTS: {\n             1: {\n                 PROFILE_ID: zha.PROFILE_ID,\n", "issue": "Xiaomi Mijia Light Sensor (GZCGQ01LM) in ZHA not detecting battery level anymore (it did in previous versions lower than 2020.12.7)\nHai The original call is from ( lustreking aka Steve Small) , I (yfands) can confirm Steve's findings indeed no battery level.\r\nSteve posted his issue [here ](https://community.home-assistant.io/t/xiaomi-mijia-zha-not-detecting-battery-level/257827)but no answer there, so iam trying it here. In his original call there are 2 pictures one when all was well and the second picture after the update to 2020.12.7, the one that is not working any more, the difference is the class the device was assigned to.\r\n\r\nThe Problem\r\nA while ago I got a Xiaomi Mijia Light Sensor (GZCGQ01LM), and it worked well for me, so I eventually ordered 2 more. Before I got them, I updated to the current version of HA (2020.12.7), as well as migrated HA to a new RPi.\r\n\r\nWhen I tried to add them, ZHA found the illuminance entity, but not the battery entity, which my previous sensor had.\r\n\r\nIn ZHA I see the new sensors listed as Xiaomi, while the previous sensor\u2019s manufacturer was listed as lumi. The model for both is lumi.sen_ill.mgl01\r\n\r\nUnder the zigbee info for the new ones it says \u201cPower Source: Mains\u201d which is obviously incorrect!\r\nHere are the zigbee details of the good and bad ones, (see his original link).. The configuration below is from me (yfands), so to be short in ZHA found the illuminance entity, but not the battery entity anymore!\r\n\r\n## System Health\r\n\r\nversion | 2020.12.2\r\n-- | --\r\ninstallation_type | Home Assistant OS\r\ndev | false\r\nhassio | true\r\ndocker | true\r\nvirtualenv | false\r\npython_version | 3.8.6\r\nos_name | Linux\r\nos_version | 5.4.79-v8\r\narch | aarch64\r\ntimezone | Europe/Amsterdam\r\n\r\n<details><summary>Home Assistant Community Store</summary>\r\n\r\nGitHub API | ok\r\n-- | --\r\nGithub API Calls Remaining | 4646\r\nInstalled Version | 1.9.0\r\nStage | running\r\nAvailable Repositories | 711\r\nInstalled Repositories | 29\r\n\r\n</details>\r\n\r\n<details><summary>Home Assistant Cloud</summary>\r\n\r\nlogged_in | false\r\n-- | --\r\ncan_reach_cert_server | ok\r\ncan_reach_cloud_auth | ok\r\ncan_reach_cloud | ok\r\n\r\n</details>\r\n\r\n<details><summary>Home Assistant Supervisor</summary>\r\n\r\nhost_os | Home Assistant OS 5.9\r\n-- | --\r\nupdate_channel | stable\r\nsupervisor_version | 2020.12.7\r\ndocker_version | 19.03.13\r\ndisk_total | 27.2 GB\r\ndisk_used | 5.5 GB\r\nhealthy | true\r\nsupported | true\r\nboard | rpi4-64\r\nsupervisor_api | ok\r\nversion_api | ok\r\ninstalled_addons | File editor (5.2.0), Samba share (9.3.0), Terminal & SSH (8.10.0), Mosquitto broker (5.1), Node-RED (7.2.11)\r\n\r\n</details>\r\n\r\n<details><summary>Lovelace</summary>\r\n\r\ndashboards | 1\r\n-- | --\r\nmode | storage\r\nviews | 10\r\nresources | 20\r\n\r\n</details>\r\n\n", "before_files": [{"content": "\"\"\"Quirk for lumi.sen_ill.mgl01 illumination sensor.\"\"\"\nimport logging\n\nfrom zigpy.profiles import zha\nfrom zigpy.zcl.clusters.general import Basic, Identify\nfrom zigpy.zcl.clusters.measurement import IlluminanceMeasurement\nfrom zigpy.zdo.types import NodeDescriptor\n\nfrom .. import LUMI, BasicCluster, XiaomiCustomDevice\nfrom ... import PowerConfigurationCluster\nfrom ...const import (\n    DEVICE_TYPE,\n    ENDPOINTS,\n    INPUT_CLUSTERS,\n    MODELS_INFO,\n    NODE_DESCRIPTOR,\n    OUTPUT_CLUSTERS,\n    PROFILE_ID,\n)\n\n_LOGGER = logging.getLogger(__name__)\n\n\nclass Illumination(XiaomiCustomDevice):\n    \"\"\"Aqara LUMI lumi.sen_ill.mgl01.\"\"\"\n\n    signature = {\n        # <SimpleDescriptor endpoint=1 profile=260 device_type=262\n        # device_version=1\n        # input_clusters=[0, 1024, 3, 1]\n        # output_clusters=[3]>\n        MODELS_INFO: [(LUMI, \"lumi.sen_ill.mgl01\")],\n        ENDPOINTS: {\n            1: {\n                PROFILE_ID: zha.PROFILE_ID,\n                DEVICE_TYPE: zha.DeviceType.LIGHT_SENSOR,\n                INPUT_CLUSTERS: [\n                    Basic.cluster_id,\n                    Identify.cluster_id,\n                    IlluminanceMeasurement.cluster_id,\n                    PowerConfigurationCluster.cluster_id,\n                ],\n                OUTPUT_CLUSTERS: [Identify.cluster_id],\n            }\n        },\n    }\n\n    replacement = {\n        NODE_DESCRIPTOR: NodeDescriptor(\n            0x02, 0x40, 0x80, 0x115F, 0x7F, 0x0064, 0x2C00, 0x0064, 0x00\n        ),\n        ENDPOINTS: {\n            1: {\n                PROFILE_ID: zha.PROFILE_ID,\n                DEVICE_TYPE: zha.DeviceType.LIGHT_SENSOR,\n                INPUT_CLUSTERS: [\n                    BasicCluster,\n                    Identify.cluster_id,\n                    IlluminanceMeasurement.cluster_id,\n                    PowerConfigurationCluster,\n                ],\n                OUTPUT_CLUSTERS: [Identify.cluster_id],\n            }\n        },\n    }\n", "path": "zhaquirks/xiaomi/aqara/illumination.py"}]}