Skip to content

Commit

Permalink
Add ability for TCP bridge. Apply moving of modbus transport to core.…
Browse files Browse the repository at this point in the history
… Apply renaming of Units. Remove feature file.

Signed-off-by: Fabian Wolter <[email protected]>
  • Loading branch information
fwolter committed Dec 23, 2020
1 parent 39bc39f commit fbaf623
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 48 deletions.
6 changes: 0 additions & 6 deletions bundles/org.openhab.binding.modbus.sbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
<name>openHAB Add-ons :: Bundles :: Modbus SBC Binding</name>

<dependencies>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.io.transport.modbus</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.modbus</artifactId>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.modbus.handler.BaseModbusThingHandler;
import org.openhab.core.io.transport.modbus.AsyncModbusFailure;
import org.openhab.core.io.transport.modbus.AsyncModbusReadResult;
import org.openhab.core.io.transport.modbus.ModbusBitUtilities;
import org.openhab.core.io.transport.modbus.ModbusReadFunctionCode;
import org.openhab.core.io.transport.modbus.ModbusReadRequestBlueprint;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus;
import org.openhab.core.thing.ThingStatusDetail;
import org.openhab.core.types.Command;
import org.openhab.core.types.RefreshType;
import org.openhab.io.transport.modbus.AsyncModbusFailure;
import org.openhab.io.transport.modbus.AsyncModbusReadResult;
import org.openhab.io.transport.modbus.ModbusBitUtilities;
import org.openhab.io.transport.modbus.ModbusReadFunctionCode;
import org.openhab.io.transport.modbus.ModbusReadRequestBlueprint;

/**
* The {@link ALD1Handler} is responsible for handling commands, which are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
*/
package org.openhab.binding.modbus.sbc.internal;

import static org.openhab.io.transport.modbus.ModbusConstants.ValueType.*;
import static org.openhab.core.io.transport.modbus.ModbusConstants.ValueType.*;

import java.math.BigDecimal;

import javax.measure.Unit;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.io.transport.modbus.ModbusConstants;
import org.openhab.io.transport.modbus.ModbusConstants.ValueType;
import org.openhab.core.io.transport.modbus.ModbusConstants;
import org.openhab.core.io.transport.modbus.ModbusConstants.ValueType;
import org.openhab.core.library.unit.Units;

/**
* The {@link ALD1Registers} is responsible for defining Modbus registers and their units.
Expand All @@ -31,14 +31,14 @@
@NonNullByDefault
public enum ALD1Registers {
// the following register numbers are 1-based. They need to be converted before sending them on the wire.
TOTAL_ENERGY(0.01f, 28, UINT32, SmartHomeUnits.KILOWATT_HOUR),
PARTIAL_ENERGY(0.01f, 30, UINT32, SmartHomeUnits.KILOWATT_HOUR), // only unidirectional meters
FEEDING_BACK_ENERGY(0.01f, 30, UINT32, SmartHomeUnits.KILOWATT_HOUR), // only bidirectional meters
VOLTAGE(1, 36, UINT16, SmartHomeUnits.VOLT),
CURRENT(0.1f, 37, UINT16, SmartHomeUnits.AMPERE),
ACTIVE_POWER(10, 38, INT16, SmartHomeUnits.WATT),
REACTIVE_POWER(10, 39, INT16, SmartHomeUnits.VAR),
POWER_FACTOR(0.01f, 40, UINT16, SmartHomeUnits.ONE);
TOTAL_ENERGY(0.01f, 28, UINT32, Units.KILOWATT_HOUR),
PARTIAL_ENERGY(0.01f, 30, UINT32, Units.KILOWATT_HOUR), // only unidirectional meters
FEEDING_BACK_ENERGY(0.01f, 30, UINT32, Units.KILOWATT_HOUR), // only bidirectional meters
VOLTAGE(1, 36, UINT16, Units.VOLT),
CURRENT(0.1f, 37, UINT16, Units.AMPERE),
ACTIVE_POWER(10, 38, INT16, Units.WATT),
REACTIVE_POWER(10, 39, INT16, Units.VAR),
POWER_FACTOR(0.01f, 40, UINT16, Units.ONE);

private BigDecimal multiplier;
private int registerNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<thing-type id="ald1Bidirectional">
<supported-bridge-type-refs>
<bridge-type-ref id="serial"/>
<bridge-type-ref id="tcp"/>
</supported-bridge-type-refs>

<label>ALD1 Energy Meter (Bidi.)</label>
Expand Down

0 comments on commit fbaf623

Please sign in to comment.