PV devices added
All checks were successful
ci/woodpecker/tag/build/1 Pipeline was successful
ci/woodpecker/tag/build/3 Pipeline was successful
ci/woodpecker/tag/build/2 Pipeline was successful
ci/woodpecker/tag/build/5 Pipeline was successful
ci/woodpecker/tag/build/4 Pipeline was successful
ci/woodpecker/tag/build/6 Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/build/7 Pipeline was successful
ci/woodpecker/tag/deploy/2 Pipeline was successful
ci/woodpecker/tag/deploy/3 Pipeline was successful
ci/woodpecker/tag/deploy/1 Pipeline was successful
ci/woodpecker/tag/deploy/4 Pipeline was successful
ci/woodpecker/tag/deploy/5 Pipeline was successful
ci/woodpecker/tag/deploy/6 Pipeline was successful
ci/woodpecker/tag/ingress Pipeline was successful
All checks were successful
ci/woodpecker/tag/build/1 Pipeline was successful
ci/woodpecker/tag/build/3 Pipeline was successful
ci/woodpecker/tag/build/2 Pipeline was successful
ci/woodpecker/tag/build/5 Pipeline was successful
ci/woodpecker/tag/build/4 Pipeline was successful
ci/woodpecker/tag/build/6 Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/build/7 Pipeline was successful
ci/woodpecker/tag/deploy/2 Pipeline was successful
ci/woodpecker/tag/deploy/3 Pipeline was successful
ci/woodpecker/tag/deploy/1 Pipeline was successful
ci/woodpecker/tag/deploy/4 Pipeline was successful
ci/woodpecker/tag/deploy/5 Pipeline was successful
ci/woodpecker/tag/deploy/6 Pipeline was successful
ci/woodpecker/tag/ingress Pipeline was successful
This commit is contained in:
80
apps/abstraction/vendors/hottis_pv_modbus.py
vendored
80
apps/abstraction/vendors/hottis_pv_modbus.py
vendored
@@ -79,13 +79,90 @@ def transform_three_phase_powermeter_to_vendor(payload: dict[str, Any]) -> str:
|
|||||||
|
|
||||||
def transform_three_phase_powermeter_to_abstract(payload: str) -> dict[str, Any]:
|
def transform_three_phase_powermeter_to_abstract(payload: str) -> dict[str, Any]:
|
||||||
"""Transform hottis_pv_modbus three_phase_powermeter payload to abstract format.
|
"""Transform hottis_pv_modbus three_phase_powermeter payload to abstract format.
|
||||||
|
|
||||||
|
|
||||||
Transformations:
|
Transformations:
|
||||||
- totalImportEnergy -> energy
|
- totalImportEnergy -> energy
|
||||||
- powerL1/powerL2/powerL3 -> phase1_power/phase2_power/phase3_power
|
- powerL1/powerL2/powerL3 -> phase1_power/phase2_power/phase3_power
|
||||||
- voltageL1/voltageL2/voltageL3 -> phase1_voltage/phase2_voltage/phase3_voltage
|
- voltageL1/voltageL2/voltageL3 -> phase1_voltage/phase2_voltage/phase3_voltage
|
||||||
- currentL1/currentL2/currentL3 -> phase1_current/phase2_current/phase3_current
|
- currentL1/currentL2/currentL3 -> phase1_current/phase2_current/phase3_current
|
||||||
- Sum of powerL1..3 -> total_power
|
- Sum of powerL1..3 -> total_power
|
||||||
|
|
||||||
|
"""
|
||||||
|
data = json.loads(payload)
|
||||||
|
|
||||||
|
def _get_float(key: str, default: float = 0.0) -> float:
|
||||||
|
return float(data.get(key, default))
|
||||||
|
|
||||||
|
|
||||||
|
phase1_power = _get_float("powerL1")
|
||||||
|
phase2_power = _get_float("powerL2")
|
||||||
|
phase3_power = _get_float("powerL3")
|
||||||
|
|
||||||
|
phase1_voltage = _get_float("voltageL1")
|
||||||
|
phase2_voltage = _get_float("voltageL2")
|
||||||
|
phase3_voltage = _get_float("voltageL3")
|
||||||
|
|
||||||
|
phase1_current = _get_float("currentL1")
|
||||||
|
phase2_current = _get_float("currentL2")
|
||||||
|
phase3_current = _get_float("currentL3")
|
||||||
|
|
||||||
|
energy = _get_float("totalImportEnergy")
|
||||||
|
|
||||||
|
return {
|
||||||
|
"energy": energy,
|
||||||
|
"total_power": phase1_power + phase2_power + phase3_power,
|
||||||
|
"phase1_power": phase1_power,
|
||||||
|
"phase2_power": phase2_power,
|
||||||
|
"phase3_power": phase3_power,
|
||||||
|
"phase1_voltage": phase1_voltage,
|
||||||
|
"phase2_voltage": phase2_voltage,
|
||||||
|
"phase3_voltage": phase3_voltage,
|
||||||
|
"phase1_current": phase1_current,
|
||||||
|
"phase2_current": phase2_current,
|
||||||
|
"phase3_current": phase3_current,
|
||||||
|
}
|
||||||
|
|
||||||
|
def transform_one_phase_powermeter_to_vendor(payload: dict[str, Any]) -> str:
|
||||||
|
"""Transform abstract one_phase_powermeter payload to hottis_pv_modbus format."""
|
||||||
|
vendor_payload = {
|
||||||
|
"energy": payload.get("energy", 0.0),
|
||||||
|
"total_power": payload.get("total_power", 0.0),
|
||||||
|
"phase1_power": payload.get("phase1_power", 0.0),
|
||||||
|
"phase2_power": payload.get("phase2_power", 0.0),
|
||||||
|
"phase3_power": payload.get("phase3_power", 0.0),
|
||||||
|
"phase1_voltage": payload.get("phase1_voltage", 0.0),
|
||||||
|
"phase2_voltage": payload.get("phase2_voltage", 0.0),
|
||||||
|
"phase3_voltage": payload.get("phase3_voltage", 0.0),
|
||||||
|
"phase1_current": payload.get("phase1_current", 0.0),
|
||||||
|
"phase2_current": payload.get("phase2_current", 0.0),
|
||||||
|
"phase3_current": payload.get("phase3_current", 0.0),
|
||||||
|
}
|
||||||
|
return json.dumps(vendor_payload)
|
||||||
|
|
||||||
|
|
||||||
|
def transform_one_phase_powermeter_to_abstract(payload: str) -> dict[str, Any]:
|
||||||
|
"""Transform hottis_pv_modbus one_phase_powermeter payload to abstract format.
|
||||||
|
|
||||||
|
{
|
||||||
|
"status": "Ok",
|
||||||
|
"timestamp": "2026-03-05T08:32:45.523805",
|
||||||
|
"importEnergyActive": 0.04,
|
||||||
|
"importEnergyReactive": 0.0,
|
||||||
|
"exportEnergyActive": 5.44,
|
||||||
|
"exportEnergyReactive": 2.4,
|
||||||
|
"powerApparent": 27.06,
|
||||||
|
"powerActive": 0.0,
|
||||||
|
"powerReactive": -27.12,
|
||||||
|
"powerDemandPositive": 0.4,
|
||||||
|
"powerDemandReverse": 0.0,
|
||||||
|
"factor": 0.01,
|
||||||
|
"angle": 271.17,
|
||||||
|
"voltage": 228.04,
|
||||||
|
"current": 0.12,
|
||||||
|
"cnt": 73500
|
||||||
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
data = json.loads(payload)
|
data = json.loads(payload)
|
||||||
|
|
||||||
@@ -121,6 +198,7 @@ def transform_three_phase_powermeter_to_abstract(payload: str) -> dict[str, Any]
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Registry of handlers for this vendor
|
# Registry of handlers for this vendor
|
||||||
HANDLERS = {
|
HANDLERS = {
|
||||||
("relay", "to_vendor"): transform_relay_to_vendor,
|
("relay", "to_vendor"): transform_relay_to_vendor,
|
||||||
|
|||||||
@@ -1224,14 +1224,14 @@ devices:
|
|||||||
topics:
|
topics:
|
||||||
set: "IoT/PV/Control"
|
set: "IoT/PV/Control"
|
||||||
state: "IoT/PV/Control/State"
|
state: "IoT/PV/Control/State"
|
||||||
- device_id: powermeter_caroutlet
|
#- device_id: powermeter_pv
|
||||||
homekit_aid: 104
|
# homekit_aid: 104
|
||||||
name: PV Inverter
|
# name: PV Inverter
|
||||||
type: one_phase_powermeter
|
# type: one_phase_powermeter
|
||||||
cap_version: "one_phase_powermeter@1.0.0"
|
# cap_version: "one_phase_powermeter@1.0.0"
|
||||||
technology: hottis_pv_modbus
|
# technology: hottis_pv_modbus
|
||||||
topics:
|
# topics:
|
||||||
state: "IoT/PV/Values"
|
# state: "IoT/PV/Values"
|
||||||
- device_id: contact_pv
|
- device_id: contact_pv
|
||||||
homekit_aid: 105
|
homekit_aid: 105
|
||||||
name: PV Contact
|
name: PV Contact
|
||||||
|
|||||||
@@ -426,10 +426,10 @@ rooms:
|
|||||||
title: PV Schützzustand
|
title: PV Schützzustand
|
||||||
icon: 🔌
|
icon: 🔌
|
||||||
rank: 425
|
rank: 425
|
||||||
- device_id: powermeter_pv
|
#- device_id: powermeter_pv
|
||||||
title: PV Messwerte
|
# title: PV Messwerte
|
||||||
icon: 📊
|
# icon: 📊
|
||||||
rank: 430
|
# rank: 430
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user