"""Quirk for LUMI lumi.sensor_ht.agl02."""

from zigpy.profiles import zha
from zigpy.zcl.clusters.general import Basic, Identify, Ota, PowerConfiguration
from zigpy.zcl.clusters.measurement import (
    PressureMeasurement,
    RelativeHumidity,
    TemperatureMeasurement,
)
from zigpy.zdo.types import NodeDescriptor

from zhaquirks import Bus
from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    NODE_DESCRIPTOR,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)
from zhaquirks.xiaomi import (
    PressureMeasurementCluster,
    RelativeHumidityCluster,
    TemperatureMeasurementCluster,
    XiaomiAqaraE1Cluster,
    XiaomiCustomDevice,
    XiaomiPowerConfiguration,
)


class LumiSensorHtAgl02(XiaomiCustomDevice):
    """Lumi lumi.sensor_ht.agl02 custom device implementation."""

    def __init__(self, *args, **kwargs):
        """Init."""
        self.temperature_bus = Bus()
        self.humidity_bus = Bus()
        self.pressure_bus = Bus()
        super().__init__(*args, **kwargs)

    signature = {
        MODELS_INFO: [("LUMI", "lumi.sensor_ht.agl02")],
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    PowerConfiguration.cluster_id,
                    Identify.cluster_id,
                    TemperatureMeasurement.cluster_id,
                    PressureMeasurement.cluster_id,
                    RelativeHumidity.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                ],
            }
        },
    }

    replacement = {
        NODE_DESCRIPTOR: NodeDescriptor(
            0x02, 0x40, 0x80, 0x115F, 0x7F, 0x0064, 0x2C00, 0x0064, 0x00
        ),
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    XiaomiPowerConfiguration,
                    Identify.cluster_id,
                    TemperatureMeasurementCluster,
                    PressureMeasurementCluster,
                    RelativeHumidityCluster,
                    XiaomiAqaraE1Cluster,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                ],
            }
        },
    }

c8d082cdb13a49233c71b95588a815f47e254b1b
<mask token>


class LumiSensorHtAgl02(XiaomiCustomDevice):
    <mask token>

    def __init__(self, *args, **kwargs):
        """Init."""
        self.temperature_bus = Bus()
        self.humidity_bus = Bus()
        self.pressure_bus = Bus()
        super().__init__(*args, **kwargs)
    <mask token>
    <mask token>

<mask token>


class LumiSensorHtAgl02(XiaomiCustomDevice):
    <mask token>

    def __init__(self, *args, **kwargs):
        """Init."""
        self.temperature_bus = Bus()
        self.humidity_bus = Bus()
        self.pressure_bus = Bus()
        super().__init__(*args, **kwargs)
    signature = {MODELS_INFO: [('LUMI', 'lumi.sensor_ht.agl02')], ENDPOINTS:
        {(1): {PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.
        TEMPERATURE_SENSOR, INPUT_CLUSTERS: [Basic.cluster_id,
        PowerConfiguration.cluster_id, Identify.cluster_id,
        TemperatureMeasurement.cluster_id, PressureMeasurement.cluster_id,
        RelativeHumidity.cluster_id], OUTPUT_CLUSTERS: [Ota.cluster_id]}}}
    replacement = {NODE_DESCRIPTOR: NodeDescriptor(2, 64, 128, 4447, 127, 
        100, 11264, 100, 0), ENDPOINTS: {(1): {PROFILE_ID: zha.PROFILE_ID,
        DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR, INPUT_CLUSTERS: [
        Basic.cluster_id, XiaomiPowerConfiguration, Identify.cluster_id,
        TemperatureMeasurementCluster, PressureMeasurementCluster,
        RelativeHumidityCluster, XiaomiAqaraE1Cluster], OUTPUT_CLUSTERS: [
        Ota.cluster_id]}}}

<mask token>


class LumiSensorHtAgl02(XiaomiCustomDevice):
    """Lumi lumi.sensor_ht.agl02 custom device implementation."""

    def __init__(self, *args, **kwargs):
        """Init."""
        self.temperature_bus = Bus()
        self.humidity_bus = Bus()
        self.pressure_bus = Bus()
        super().__init__(*args, **kwargs)
    signature = {MODELS_INFO: [('LUMI', 'lumi.sensor_ht.agl02')], ENDPOINTS:
        {(1): {PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.
        TEMPERATURE_SENSOR, INPUT_CLUSTERS: [Basic.cluster_id,
        PowerConfiguration.cluster_id, Identify.cluster_id,
        TemperatureMeasurement.cluster_id, PressureMeasurement.cluster_id,
        RelativeHumidity.cluster_id], OUTPUT_CLUSTERS: [Ota.cluster_id]}}}
    replacement = {NODE_DESCRIPTOR: NodeDescriptor(2, 64, 128, 4447, 127, 
        100, 11264, 100, 0), ENDPOINTS: {(1): {PROFILE_ID: zha.PROFILE_ID,
        DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR, INPUT_CLUSTERS: [
        Basic.cluster_id, XiaomiPowerConfiguration, Identify.cluster_id,
        TemperatureMeasurementCluster, PressureMeasurementCluster,
        RelativeHumidityCluster, XiaomiAqaraE1Cluster], OUTPUT_CLUSTERS: [
        Ota.cluster_id]}}}

<mask token>
from zigpy.profiles import zha
from zigpy.zcl.clusters.general import Basic, Identify, Ota, PowerConfiguration
from zigpy.zcl.clusters.measurement import PressureMeasurement, RelativeHumidity, TemperatureMeasurement
from zigpy.zdo.types import NodeDescriptor
from zhaquirks import Bus
from zhaquirks.const import DEVICE_TYPE, ENDPOINTS, INPUT_CLUSTERS, MODELS_INFO, NODE_DESCRIPTOR, OUTPUT_CLUSTERS, PROFILE_ID
from zhaquirks.xiaomi import PressureMeasurementCluster, RelativeHumidityCluster, TemperatureMeasurementCluster, XiaomiAqaraE1Cluster, XiaomiCustomDevice, XiaomiPowerConfiguration


class LumiSensorHtAgl02(XiaomiCustomDevice):
    """Lumi lumi.sensor_ht.agl02 custom device implementation."""

    def __init__(self, *args, **kwargs):
        """Init."""
        self.temperature_bus = Bus()
        self.humidity_bus = Bus()
        self.pressure_bus = Bus()
        super().__init__(*args, **kwargs)
    signature = {MODELS_INFO: [('LUMI', 'lumi.sensor_ht.agl02')], ENDPOINTS:
        {(1): {PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.
        TEMPERATURE_SENSOR, INPUT_CLUSTERS: [Basic.cluster_id,
        PowerConfiguration.cluster_id, Identify.cluster_id,
        TemperatureMeasurement.cluster_id, PressureMeasurement.cluster_id,
        RelativeHumidity.cluster_id], OUTPUT_CLUSTERS: [Ota.cluster_id]}}}
    replacement = {NODE_DESCRIPTOR: NodeDescriptor(2, 64, 128, 4447, 127, 
        100, 11264, 100, 0), ENDPOINTS: {(1): {PROFILE_ID: zha.PROFILE_ID,
        DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR, INPUT_CLUSTERS: [
        Basic.cluster_id, XiaomiPowerConfiguration, Identify.cluster_id,
        TemperatureMeasurementCluster, PressureMeasurementCluster,
        RelativeHumidityCluster, XiaomiAqaraE1Cluster], OUTPUT_CLUSTERS: [
        Ota.cluster_id]}}}

"""Quirk for LUMI lumi.sensor_ht.agl02."""

from zigpy.profiles import zha
from zigpy.zcl.clusters.general import Basic, Identify, Ota, PowerConfiguration
from zigpy.zcl.clusters.measurement import (
    PressureMeasurement,
    RelativeHumidity,
    TemperatureMeasurement,
)
from zigpy.zdo.types import NodeDescriptor

from zhaquirks import Bus
from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    NODE_DESCRIPTOR,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)
from zhaquirks.xiaomi import (
    PressureMeasurementCluster,
    RelativeHumidityCluster,
    TemperatureMeasurementCluster,
    XiaomiAqaraE1Cluster,
    XiaomiCustomDevice,
    XiaomiPowerConfiguration,
)


class LumiSensorHtAgl02(XiaomiCustomDevice):
    """Lumi lumi.sensor_ht.agl02 custom device implementation."""

    def __init__(self, *args, **kwargs):
        """Init."""
        self.temperature_bus = Bus()
        self.humidity_bus = Bus()
        self.pressure_bus = Bus()
        super().__init__(*args, **kwargs)

    signature = {
        MODELS_INFO: [("LUMI", "lumi.sensor_ht.agl02")],
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    PowerConfiguration.cluster_id,
                    Identify.cluster_id,
                    TemperatureMeasurement.cluster_id,
                    PressureMeasurement.cluster_id,
                    RelativeHumidity.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                ],
            }
        },
    }

    replacement = {
        NODE_DESCRIPTOR: NodeDescriptor(
            0x02, 0x40, 0x80, 0x115F, 0x7F, 0x0064, 0x2C00, 0x0064, 0x00
        ),
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    XiaomiPowerConfiguration,
                    Identify.cluster_id,
                    TemperatureMeasurementCluster,
                    PressureMeasurementCluster,
                    RelativeHumidityCluster,
                    XiaomiAqaraE1Cluster,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                ],
            }
        },
    }
