henne49 / dbus-opendtu

Integrate opendtu and ahoy into Victron Energies Venus OS as a pv inverter
MIT License
121 stars 33 forks source link

Enhancement request: Support for HomeWizard JSON #219

Open bwbboot opened 4 weeks ago

bwbboot commented 4 weeks ago

I am using Homewizard energy meters which provide a nice restful API and JSON energydata.

https://www.homewizard.com/de-at/ https://api-documentation.homewizard.com/docs/getting-started

The 1Phase meters are already supported:

[TEMPLATE0] Username = Password = DigestAuth = False Host=0.0.0.0 CUST_SN = CUST_API_PATH= api/v1/data CUST_POLLING = 2000 CUST_Total= total_power_export_kwh CUST_Total_Mult = 1 CUST_Power= active_power_w CUST_Power_Mult = -1 CUST_Voltage= active_voltage_v CUST_Current= active_current_a Phase= DeviceInstance= AcPosition= Name= Servicename=com.victronenergy.pvinverter

1-PHASE JSON Example {"wifi_ssid":"xxx","wifi_strength":100,"total_power_import_kwh":23.268,"total_power_import_t1_kwh":23.268,"total_power_export_kwh":716.83,"total_power_export_t1_kwh":716.83,"active_power_w":-138.527,"active_power_l1_w":-138.527,"active_voltage_v":238.369,"active_current_a":0.605,"active_apparent_current_a":0.727,"active_reactive_current_a":0.403,"active_apparent_power_va":166.474,"active_reactive_power_var":92.317,"active_power_factor":0.832,"active_frequency_hz":50}

However it would be nice to see support for a 3PHASE config. With Homeward, data is delivered per phase. Currently there is no support for adding multiple fields to sum these values, or deliver values individually to dbus.

3-PHASE JSON Example:

{"wifi_ssid":"xxx","wifi_strength":70,"total_power_import_kwh":0.24,"total_power_import_t1_kwh":0.24,"total_power_export_kwh":1141.546,"total_power_export_t1_kwh":1141.546,"active_power_w":-237.204,"active_power_l1_w":-78.104,"active_power_l2_w":-79.524,"active_power_l3_w":-79.576,"active_voltage_l1_v":238.441,"active_voltage_l2_v":235.867,"active_voltage_l3_v":237.153,"active_current_a":1.002,"active_current_l1_a":0.329,"active_current_l2_a":0.334,"active_current_l3_a":0.34,"active_apparent_current_a":1.247,"active_apparent_current_l1_a":0.409,"active_apparent_current_l2_a":0.42,"active_apparent_current_l3_a":0.418,"active_reactive_current_a":0.742,"active_reactive_current_l1_a":0.243,"active_reactive_current_l2_a":0.255,"active_reactive_current_l3_a":0.244,"active_apparent_power_va":295.749,"active_apparent_power_l1_va":97.452,"active_apparent_power_l2_va":99.131,"active_apparent_power_l3_va":99.166,"active_reactive_power_var":-177.184,"active_reactive_power_l1_var":-57.925,"active_reactive_power_l2_var":-60.149,"active_reactive_power_l3_var":-59.109,"active_power_factor_l1":0.804,"active_power_factor_l2":0.795,"active_power_factor_l3":0.812,"active_frequency_hz":49.906}

Thanks!

henne49 commented 4 weeks ago

it should be possible to also integrate the 3 Phase, use 3P under phase and use active_power_w https://github.com/henne49/dbus-opendtu?tab=readme-ov-file#template-options

bwbboot commented 4 weeks ago

I have used 3P:

Username = Password = DigestAuth = False Host=0.0.0.0 CUST_SN = xxxx CUST_API_PATH= api/v1/data CUST_POLLING = 2000 CUST_Total= total_power_export_kwh CUST_Total_Mult = 1 CUST_Power= active_power_w CUST_Power_Mult = -1 CUST_Voltage= active_voltage_l1_v CUST_Current= active_current_l1_a Phase=3P DeviceInstance=42 AcPosition=1 Name= PV1 - Veranda Servicename=com.victronenergy.pvinverter

but there is no data unless parameters below are included (which are delivered per phase) CUST_Voltage= active_voltage_l1_v CUST_Current= active_current_l1_a

And the code assumes a three-phase balanced voltage, where Homewizard API provides individual phase voltages.

# Single Phase Voltage = (3-Phase Voltage) / (sqrt(3))
# This formula assumes that the three-phase voltage is balanced and that
# the phase angles are 120 degrees apart
# sqrt(3) = 1.73205080757 <-- So we do not need to include Math Library
singlePhaseVoltage = voltage / 1.73205080757

Would love to see support for individual phase values on dbus.

henne49 commented 4 weeks ago

I understand your request, but it does not make a huge difference. As the overall power realtime and longterm energy are still correct, even whatever you put into voltage and current. And that is the main use case.

You may submit a PR for the change and we can check to include it.