[homewizard] Fix for incorrect thing type id for kWh meter (#18352)
* Fixed toString in several payloads Signed-off-by: Gearrel Welvaart <gearrel.welvaart@gmail.com> * Fix for incorrect thing-type id Signed-off-by: Gearrel Welvaart <gearrel.welvaart@gmail.com> --------- Signed-off-by: Gearrel Welvaart <gearrel.welvaart@gmail.com>pull/18349/merge
parent
77c729bc39
commit
a0bae2fd31
|
@ -250,7 +250,8 @@ public class HomeWizardEnergyMeterMeasurementPayload {
|
|||
voltage: %f voltageL1: %f voltageL2: %f voltageL3: %f
|
||||
current: %f currentL1: %f currentL2: %f currentL3: %f frequency: %f
|
||||
]
|
||||
""", energyImport, energyImportT1, energyExportT2, energyExport, energyExportT1, energyExportT2,
|
||||
voltage, voltageL1, voltageL2, voltageL3, current, currentL1, currentL2, currentL3, frequency);
|
||||
""", energyImport, energyImportT1, energyImportT2, energyExport, energyExportT1, energyExportT2, power,
|
||||
powerL1, powerL2, powerL3, voltage, voltageL1, voltageL2, voltageL3, current, currentL1, currentL2,
|
||||
currentL3, frequency);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,8 +160,8 @@ public class HomeWizardP1MeterMeasurementPayload extends HomeWizardEnergyMeterMe
|
|||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " " + String.format("""
|
||||
Data [protocolVersion: %d meterModel: %s anyPowerFailCount: %f longPowerFailCount: %f"
|
||||
totalGasM3: %f gasTimestamp: %.0f"
|
||||
Data [protocolVersion: %d meterModel: %s anyPowerFailCount: %d longPowerFailCount: %d"
|
||||
totalGasM3: %f gasTimestamp: %d"
|
||||
|
||||
""", protocolVersion, meterModel, anyPowerFailCount, longPowerFailCount, totalGasM3, gasTimestamp);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class HomeWizardPlugInBatteryMeasurementPayload extends HomeWizardEnergyM
|
|||
@Override
|
||||
public String toString() {
|
||||
return String.format("""
|
||||
Battery Data [stateOfCharge: %d cycles: %d"]
|
||||
Battery Data [stateOfCharge: %f cycles: %f"]
|
||||
""", stateOfCharge, cycles);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class HomeWizardWaterMeterHandler extends HomeWizardDeviceHandler {
|
|||
*/
|
||||
@Override
|
||||
protected void handleDataPayload(String data) {
|
||||
var payload = gson.fromJson(data, HomeWizardWaterMeterDataPayload.class);
|
||||
var payload = gson.fromJson(data, HomeWizardWaterMeterMeasurementPayload.class);
|
||||
if (payload != null) {
|
||||
if (!thing.getThingTypeUID().equals(HomeWizardBindingConstants.THING_TYPE_WATERMETER)) {
|
||||
updateState(HomeWizardBindingConstants.CHANNEL_GROUP_WATER,
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.google.gson.annotations.SerializedName;
|
|||
*
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class HomeWizardWaterMeterDataPayload {
|
||||
public class HomeWizardWaterMeterMeasurementPayload {
|
||||
|
||||
@SerializedName("active_liter_lpm")
|
||||
private double activeLiter;
|
|
@ -5,8 +5,8 @@ addon.homewizard.description = This binding provides access to the data provided
|
|||
|
||||
# thing types
|
||||
|
||||
thing-type.homewizard.HWE-kwh.label = HomeWizard kWh Meter
|
||||
thing-type.homewizard.HWE-kwh.description = This thing provides the measurement data that is available through the API of a HomeWizard kWh Meter.
|
||||
thing-type.homewizard.hwe-kwh.label = HomeWizard kWh Meter
|
||||
thing-type.homewizard.hwe-kwh.description = This thing provides the measurement data that is available through the API of a HomeWizard kWh Meter.
|
||||
thing-type.homewizard.energy_socket.label = HomeWizard Energysocket
|
||||
thing-type.homewizard.energy_socket.description = This thing provides the measurement data that is available through the http interface of a HomeWizard Energysocket.
|
||||
thing-type.homewizard.hwe-bat.label = HomeWizard Plug-In Battery
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="HWE-kwh">
|
||||
<thing-type id="hwe-kwh">
|
||||
<label>HomeWizard kWh Meter</label>
|
||||
<description>This thing provides the measurement data that is available through the API of a HomeWizard
|
||||
kWh Meter.</description>
|
||||
|
|
|
@ -34,8 +34,8 @@ public class HomeWizardWaterMeterMeasurementPayloadTest {
|
|||
|
||||
@Test
|
||||
public void deserializeResponse() throws IOException {
|
||||
HomeWizardWaterMeterDataPayload key = DATA_UTIL.fromJson("response-measurement-water-meter.json",
|
||||
HomeWizardWaterMeterDataPayload.class);
|
||||
HomeWizardWaterMeterMeasurementPayload key = DATA_UTIL.fromJson("response-measurement-water-meter.json",
|
||||
HomeWizardWaterMeterMeasurementPayload.class);
|
||||
assertThat(key, is(notNullValue()));
|
||||
|
||||
assertThat(key.getActiveLiter(), is(7.2));
|
||||
|
@ -44,8 +44,8 @@ public class HomeWizardWaterMeterMeasurementPayloadTest {
|
|||
|
||||
@Test
|
||||
public void deserializeResponseEmpty() throws IOException {
|
||||
HomeWizardWaterMeterDataPayload key = DATA_UTIL.fromJson("response-empty.json",
|
||||
HomeWizardWaterMeterDataPayload.class);
|
||||
HomeWizardWaterMeterMeasurementPayload key = DATA_UTIL.fromJson("response-empty.json",
|
||||
HomeWizardWaterMeterMeasurementPayload.class);
|
||||
assertThat(key, is(notNullValue()));
|
||||
|
||||
assertThat(key.getActiveLiter(), is(0.0));
|
||||
|
|
Loading…
Reference in New Issue