# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

# This file is autogenerated

# flake8: noqa

from deye_sensor import (
    SingleRegisterSensor,
    ComputedPowerSensor,
    DoubleRegisterSensor,
    ComputedSumSensor,
    SensorRegisterRange,
)

deye_sg03lp1_solar_186 = SingleRegisterSensor(
    "PV1 Power", 186, 1, mqtt_topic_suffix="dc/pv1/power", unit="W", signed=False, groups=["deye_sg03lp1"]
)

deye_sg03lp1_solar_187 = SingleRegisterSensor(
    "PV2 Power", 187, 1, mqtt_topic_suffix="dc/pv2/power", unit="W", signed=False, groups=["deye_sg03lp1"]
)

deye_sg03lp1_solar_109 = SingleRegisterSensor(
    "PV1 Voltage", 109, 0.1, mqtt_topic_suffix="dc/pv1/voltage", unit="V", signed=False, groups=["deye_sg03lp1"]
)

deye_sg03lp1_solar_111 = SingleRegisterSensor(
    "PV2 Voltage", 111, 0.1, mqtt_topic_suffix="dc/pv2/voltage", unit="V", signed=False, groups=["deye_sg03lp1"]
)

deye_sg03lp1_solar_110 = SingleRegisterSensor(
    "PV1 Current", 110, 0.1, mqtt_topic_suffix="dc/pv1/current", unit="A", signed=False, groups=["deye_sg03lp1"]
)

deye_sg03lp1_solar_112 = SingleRegisterSensor(
    "PV2 Current", 112, 0.1, mqtt_topic_suffix="dc/pv2/current", unit="A", signed=False, groups=["deye_sg03lp1"]
)

deye_sg03lp1_solar_108 = SingleRegisterSensor(
    "Daily Production", 108, 0.1, mqtt_topic_suffix="day_energy", unit="kWh", signed=False, groups=["deye_sg03lp1"]
)

deye_sg03lp1_solar_96 = DoubleRegisterSensor(
    "Total Production", 96, 0.1, mqtt_topic_suffix="total_energy", unit="kWh", signed=False, groups=["deye_sg03lp1"]
)

deye_sg03lp1_solar_166 = SingleRegisterSensor(
    "Micro-inverter Power",
    166,
    1,
    mqtt_topic_suffix="micro_inverter_power",
    unit="W",
    signed=False,
    groups=["deye_sg03lp1"],
)

deye_sg03lp1_grid_169 = SingleRegisterSensor(
    "Total Grid Power", 169, 1, mqtt_topic_suffix="ac/total_grid_power", unit="W", signed=True, groups=["deye_sg03lp1"]
)

deye_sg03lp1_grid_150 = SingleRegisterSensor(
    "Grid Voltage L1", 150, 0.1, mqtt_topic_suffix="ac/l1/voltage", unit="V", signed=False, groups=["deye_sg03lp1"]
)

deye_sg03lp1_grid_151 = SingleRegisterSensor(
    "Grid Voltage L2", 151, 0.1, mqtt_topic_suffix="ac/l2/voltage", unit="V", signed=False, groups=["deye_sg03lp1"]
)

deye_sg03lp1_grid_167 = SingleRegisterSensor(
    "Internal CT L1 Power",
    167,
    1,
    mqtt_topic_suffix="ac/l1/ct/internal",
    unit="W",
    signed=True,
    groups=["deye_sg03lp1"],
)

deye_sg03lp1_grid_168 = SingleRegisterSensor(
    "Internal CT L2 Power",
    168,
    1,
    mqtt_topic_suffix="ac/l2/ct/internal",
    unit="W",
    signed=True,
    groups=["deye_sg03lp1"],
)

deye_sg03lp1_grid_170 = SingleRegisterSensor(
    "External CT L1 Power",
    170,
    1,
    mqtt_topic_suffix="ac/l1/ct/external",
    unit="W",
    signed=True,
    groups=["deye_sg03lp1"],
)

deye_sg03lp1_grid_171 = SingleRegisterSensor(
    "External CT L2 Power",
    171,
    1,
    mqtt_topic_suffix="ac/l2/ct/external",
    unit="W",
    signed=True,
    groups=["deye_sg03lp1"],
)

deye_sg03lp1_grid_76 = SingleRegisterSensor(
    "Daily Energy Bought",
    76,
    0.1,
    mqtt_topic_suffix="ac/daily_energy_bought",
    unit="kWh",
    signed=False,
    groups=["deye_sg03lp1"],
)

deye_sg03lp1_grid_77 = SingleRegisterSensor(
    "Daily Energy Sold",
    77,
    0.1,
    mqtt_topic_suffix="ac/daily_energy_sold",
    unit="kWh",
    signed=False,
    groups=["deye_sg03lp1"],
)

deye_sg03lp1_grid_78 = SingleRegisterSensor(
    "Total Energy Bought",
    78,
    0.1,
    mqtt_topic_suffix="ac/total_energy_bought",
    unit="kWh",
    signed=False,
    groups=["deye_sg03lp1"],
)

deye_sg03lp1_grid_79 = SingleRegisterSensor(
    "Grid Frequecy",
    79,
    0.01,
    mqtt_topic_suffix="ac/grid_frequency",
    unit="Hz",
    signed=False,
    groups=["deye_sg03lp1"],
)

deye_sg03lp1_grid_81 = DoubleRegisterSensor(
    "Total Energy Sold",
    81,
    0.1,
    mqtt_topic_suffix="ac/total_energy_sold",
    unit="kWh",
    signed=False,
    groups=["deye_sg03lp1"],
)

deye_sg03lp1_inverter_175 = SingleRegisterSensor(
    "Total Power", 175, 1, mqtt_topic_suffix="ac/total_power", unit="W", signed=True, groups=["deye_sg03lp1"]
)

deye_sg03lp1_inverter_164 = SingleRegisterSensor(
    "Current L1", 164, 0.01, mqtt_topic_suffix="ac/l1/current", unit="A", signed=True, groups=["deye_sg03lp1"]
)

deye_sg03lp1_inverter_165 = SingleRegisterSensor(
    "Current L2", 165, 0.01, mqtt_topic_suffix="ac/l2/current", unit="A", signed=True, groups=["deye_sg03lp1"]
)

deye_sg03lp1_inverter_173 = SingleRegisterSensor(
    "Inverter L1 Power", 173, 1, mqtt_topic_suffix="ac/l1/power", unit="W", signed=True, groups=["deye_sg03lp1"]
)

deye_sg03lp1_inverter_174 = SingleRegisterSensor(
    "Inverter L2 Power", 174, 1, mqtt_topic_suffix="ac/l2/power", unit="W", signed=True, groups=["deye_sg03lp1"]
)

deye_sg03lp1_inverter_192 = SingleRegisterSensor(
    "Load Frequency", 192, 0.01, mqtt_topic_suffix="ac/frequency", unit="Hz", signed=False, groups=["deye_sg03lp1"]
)

deye_sg03lp1_inverter_90 = SingleRegisterSensor(
    "DC Temperature",
    90,
    0.1,
    offset=-100.0,
    mqtt_topic_suffix="radiator_temp",
    unit="°C",
    signed=True,
    groups=["deye_sg03lp1"],
)

deye_sg03lp1_inverter_91 = SingleRegisterSensor(
    "AC Temperature",
    91,
    0.1,
    offset=-100.0,
    mqtt_topic_suffix="ac/temperature",
    unit="°C",
    signed=True,
    groups=["deye_sg03lp1"],
)

deye_sg03lp1_sensors = [
    deye_sg03lp1_solar_186,
    deye_sg03lp1_solar_187,
    deye_sg03lp1_solar_109,
    deye_sg03lp1_solar_111,
    deye_sg03lp1_solar_110,
    deye_sg03lp1_solar_112,
    deye_sg03lp1_solar_108,
    deye_sg03lp1_solar_96,
    deye_sg03lp1_solar_166,
    deye_sg03lp1_grid_169,
    deye_sg03lp1_grid_150,
    deye_sg03lp1_grid_151,
    deye_sg03lp1_grid_167,
    deye_sg03lp1_grid_168,
    deye_sg03lp1_grid_170,
    deye_sg03lp1_grid_171,
    deye_sg03lp1_grid_76,
    deye_sg03lp1_grid_77,
    deye_sg03lp1_grid_78,
    deye_sg03lp1_grid_79,
    deye_sg03lp1_grid_81,
    deye_sg03lp1_inverter_175,
    deye_sg03lp1_inverter_164,
    deye_sg03lp1_inverter_165,
    deye_sg03lp1_inverter_173,
    deye_sg03lp1_inverter_174,
    deye_sg03lp1_inverter_192,
    deye_sg03lp1_inverter_90,
    deye_sg03lp1_inverter_91,
]

deye_sg03lp1_register_ranges = [
    SensorRegisterRange(group="deye_sg03lp1", first_reg_address=3, last_reg_address=112),
    SensorRegisterRange(group="deye_sg03lp1", first_reg_address=150, last_reg_address=249),
]
