Skip to content

Commit

Permalink
Add computed total DC power sensor for sg04lp3
Browse files Browse the repository at this point in the history
Signed-off-by: Krzysztof Białek <[email protected]>
  • Loading branch information
kbialek committed Jan 5, 2025
1 parent 5cca6e1 commit 81b8d79
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/metric_group_deye_sg01hp3.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
|PV2 Power|`dc/pv2/power`|W|673|2a1|U_WORD|10|
|PV3 Power|`dc/pv3/power`|W|674|2a2|U_WORD|10|
|PV4 Power|`dc/pv4/power`|W|675|2a3|U_WORD|10|
|DC Total Power|`dc/total_power`|W|672,673,674,675|2a0,2a1,2a2,2a3|U_WORD|10|
|PV1 Voltage|`dc/pv1/voltage`|V|676|2a4|U_WORD|0.1|
|PV1 Current|`dc/pv1/current`|A|677|2a5|U_WORD|0.1|
|PV2 Voltage|`dc/pv2/voltage`|V|678|2a6|U_WORD|0.1|
Expand Down Expand Up @@ -38,3 +37,4 @@
|Inverter L3 Power|`ac/l3/power`|W|635|27b|S_WORD|1|
|DC Temperature|`radiator_temp`|°C|540|21c|S_WORD|0.1|
|AC Temperature|`ac/temperature`|°C|541|21d|S_WORD|0.1|
|DC Total Power|`dc/total_power`|W|computed|computed|n/a|1|
1 change: 1 addition & 0 deletions docs/metric_group_deye_sg04lp3.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
|Inverter L3 Power|`ac/l3/power`|W|635|27b|S_WORD|1|
|DC Temperature|`radiator_temp`|°C|540|21c|S_WORD|0.1|
|AC Temperature|`ac/temperature`|°C|541|21d|S_WORD|0.1|
|DC Total Power|`dc/total_power`|W|computed|computed|n/a|1|
2 changes: 2 additions & 0 deletions src/deye_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
)

from deye_sensors_deye_sg04lp3 import deye_sg04lp3_sensors, deye_sg04lp3_register_ranges
from deye_sensors_deye_sg04lp3_computed import deye_sg04lp3_computed_sensors
from deye_sensors_deye_sg01hp3 import deye_sg01hp3_sensors, deye_sg01hp3_register_ranges
from deye_sensors_igen_dtsd422 import igen_dtsd422_sensors, igen_dtsd422_register_ranges
from deye_sensors_deye_hybrid import deye_hybrid_sensors, deye_hybrid_register_ranges
Expand Down Expand Up @@ -263,6 +264,7 @@
igbt_temp_sensor,
]
+ deye_sg04lp3_sensors
+ deye_sg04lp3_computed_sensors
+ igen_dtsd422_sensors
+ deye_hybrid_sensors
+ deye_settings_sensors
Expand Down
31 changes: 31 additions & 0 deletions src/deye_sensors_deye_sg04lp3_computed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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.

from deye_sensor import ComputedSumSensor

from deye_sensors_deye_sg04lp3 import deye_sg04lp3_solar_672, deye_sg04lp3_solar_673

deye_sg04lp3_total_dc_power_sensor = ComputedSumSensor(
"DC Total Power",
[deye_sg04lp3_solar_672, deye_sg04lp3_solar_673],
mqtt_topic_suffix="dc/total_power",
unit="W",
groups=["deye_sg04lp3"],
)


deye_sg04lp3_computed_sensors = [deye_sg04lp3_total_dc_power_sensor]

0 comments on commit 81b8d79

Please sign in to comment.