[openwebnet] Add support for Dry Contact and IR interfaces for WHO=25 (#11747)
* [openwebnet] updated where parameter labels Signed-off-by: Massimo Valla <mvcode00@gmail.com> * [openwebnet] added support for DryContact/IR interfaces Signed-off-by: Massimo Valla <mvcode00@gmail.com> * [openwebnet] updated README Signed-off-by: Massimo Valla <mvcode00@gmail.com> * [openwebnet] checkstyle Signed-off-by: Massimo Valla <mvcode00@gmail.com>pull/11766/head^2
parent
67f7de1403
commit
aba67bcfd8
|
@ -45,6 +45,7 @@ The following Things and OpenWebNet `WHOs` are supported:
|
||||||
| Automation | `2` | `bus_automation` | BUS roller shutters, with position feedback and auto-calibration | Successfully tested: LN4672M2 |
|
| Automation | `2` | `bus_automation` | BUS roller shutters, with position feedback and auto-calibration | Successfully tested: LN4672M2 |
|
||||||
| Temperature Control | `4` | `bus_thermo_zone`, `bus_thermo_sensor` | Thermo zones management and temperature sensors (probes). NOTE Central Units (4 or 99 zones) are not fully supported yet. See [Channels - Thermo](#configuring-thermo) for more details. | Successfully tested: H/LN4691, HS4692, KG4691; thermo sensors: L/N/NT4577 + 3455 |
|
| Temperature Control | `4` | `bus_thermo_zone`, `bus_thermo_sensor` | Thermo zones management and temperature sensors (probes). NOTE Central Units (4 or 99 zones) are not fully supported yet. See [Channels - Thermo](#configuring-thermo) for more details. | Successfully tested: H/LN4691, HS4692, KG4691; thermo sensors: L/N/NT4577 + 3455 |
|
||||||
| CEN & CEN+ Scenarios | `15` & `25` | `bus_cen_scenario_control`, `bus_cenplus_scenario_control` | CEN/CEN+ scenarios events and virtual activation | Successfully tested: scenario buttons: HC/HD/HS/L/N/NT4680 |
|
| CEN & CEN+ Scenarios | `15` & `25` | `bus_cen_scenario_control`, `bus_cenplus_scenario_control` | CEN/CEN+ scenarios events and virtual activation | Successfully tested: scenario buttons: HC/HD/HS/L/N/NT4680 |
|
||||||
|
| Dry Contact and IR Interfaces | `25` | `bus_dry_contact_ir` | Dry Contacts and IR Interfaces | Successfully tested: contact interfaces F428 and 3477; IR sensors: HC/HD/HS/L/N/NT4610 |
|
||||||
| Energy Management | `18` | `bus_energy_meter` | Energy Management | Successfully tested: F520, F521 |
|
| Energy Management | `18` | `bus_energy_meter` | Energy Management | Successfully tested: F520, F521 |
|
||||||
|
|
||||||
### For ZigBee (Radio)
|
### For ZigBee (Radio)
|
||||||
|
@ -123,12 +124,13 @@ Devices can be discovered automatically using an Inbox Scan after a gateway has
|
||||||
For any manually added device, you must configure:
|
For any manually added device, you must configure:
|
||||||
|
|
||||||
- the associated gateway (`Parent Bridge` menu)
|
- the associated gateway (`Parent Bridge` menu)
|
||||||
- the `where` config parameter (`OpenWebNet Device Address`):
|
- the `where` configuration parameter (`OpenWebNet Address`):
|
||||||
- example for BUS/SCS:
|
- example for BUS/SCS:
|
||||||
- light device with WHERE address Point to Point `A=2 PL=4` --> `where="24"`
|
- light device with WHERE address Point to Point `A=2 PL=4` --> `where="24"`
|
||||||
- light device with WHERE address Point to Point `A=03 PL=11` on local bus --> `where="0311#4#01"`
|
- light device with WHERE address Point to Point `A=03 PL=11` on local bus --> `where="0311#4#01"`
|
||||||
- CEN scenario with WHERE address Point to Point `A=05 PL=12` --> `where="0512"`
|
- CEN scenario with WHERE address Point to Point `A=05 PL=12` --> `where="0512"`
|
||||||
- CEN+ configured scenario `5`: add a `2` before --> `where="25"`
|
- CEN+ configured scenario `5`: add a `2` before --> `where="25"`
|
||||||
|
- Dry Contact or IR Interface `99`: add a `3` before --> `where="399"`
|
||||||
- example for ZigBee devices: `where=765432101#9`. The ID of the device (ADDR part) is usually written in hexadecimal on the device itself, for example `ID 0074CBB1`: convert to decimal (`7654321`) and add `01#9` at the end to obtain `where=765432101#9`. For 2-unit switch devices (`zb_on_off_switch2u`), last part should be `00#9`.
|
- example for ZigBee devices: `where=765432101#9`. The ID of the device (ADDR part) is usually written in hexadecimal on the device itself, for example `ID 0074CBB1`: convert to decimal (`7654321`) and add `01#9` at the end to obtain `where=765432101#9`. For 2-unit switch devices (`zb_on_off_switch2u`), last part should be `00#9`.
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,13 +140,13 @@ In BTicino MyHOME Thermoregulation (WHO=4) each **zone** has associated a thermo
|
||||||
|
|
||||||
Thermo zones can be configured defining a `bus_thermo_zone` Thing for each zone with the following parameters:
|
Thermo zones can be configured defining a `bus_thermo_zone` Thing for each zone with the following parameters:
|
||||||
|
|
||||||
- the `where` config parameter (`OpenWebNet Device Address`):
|
- the `where` configuration parameter (`OpenWebNet Address`):
|
||||||
- example BUS/SCS Thermo zone `1` --> `where="1"`
|
- example BUS/SCS Thermo zone `1` --> `where="1"`
|
||||||
- the `standAlone` config parameter (`boolean`, default: `true`): identifies if the zone is managed or not by a Central Unit (4 or 99 zones). `standAlone=true` means no Central Unit is present in the system.
|
- the `standAlone` configuration parameter (`boolean`, default: `true`): identifies if the zone is managed or not by a Central Unit (4 or 99 zones). `standAlone=true` means no Central Unit is present in the system.
|
||||||
|
|
||||||
Temperature sensors can be configured defining a `bus_thermo_sensor` Thing with the following parameters:
|
Temperature sensors can be configured defining a `bus_thermo_sensor` Thing with the following parameters:
|
||||||
|
|
||||||
- the `where` config parameter (`OpenWebNet Device Address`):
|
- the `where` configuration parameter (`OpenWebNet Address`):
|
||||||
- example sensor `5` of external zone `00` --> `where="500"`
|
- example sensor `5` of external zone `00` --> `where="500"`
|
||||||
- example: slave sensor `3` of zone `2` --> `where="302"`
|
- example: slave sensor `3` of zone `2` --> `where="302"`
|
||||||
|
|
||||||
|
@ -155,7 +157,7 @@ Systems with Central Units (4 or 99 zones) are not fully supported yet.
|
||||||
|
|
||||||
## Channels
|
## Channels
|
||||||
|
|
||||||
### Lighting, Automation, Power meter and CEN/CEN+ Scenario Events channels
|
### Lighting, Automation, Power meter, CEN/CEN+ Scenario Events and Dry Contact / IR Interfaces channels
|
||||||
|
|
||||||
| Channel Type ID (channel ID) | Applies to Thing Type IDs | Item Type | Description | Read/Write |
|
| Channel Type ID (channel ID) | Applies to Thing Type IDs | Item Type | Description | Read/Write |
|
||||||
| ---------------------------------------- | ------------------------------------------------------------- | ------------- | ----------------------------------------------------- | :--------: |
|
| ---------------------------------------- | ------------------------------------------------------------- | ------------- | ----------------------------------------------------- | :--------: |
|
||||||
|
@ -163,6 +165,7 @@ Systems with Central Units (4 or 99 zones) are not fully supported yet.
|
||||||
| `brightness` | `bus_dimmer`, `zb_dimmer` | Dimmer | To adjust the brightness value (Percent, `ON`, `OFF`) | R/W |
|
| `brightness` | `bus_dimmer`, `zb_dimmer` | Dimmer | To adjust the brightness value (Percent, `ON`, `OFF`) | R/W |
|
||||||
| `shutter` | `bus_automation` | Rollershutter | To activate roller shutters (`UP`, `DOWN`, `STOP`, Percent - [see Shutter position](#shutter-position)) | R/W |
|
| `shutter` | `bus_automation` | Rollershutter | To activate roller shutters (`UP`, `DOWN`, `STOP`, Percent - [see Shutter position](#shutter-position)) | R/W |
|
||||||
| `button#X` | `bus_cen_scenario_control`, `bus_cenplus_scenario_control` | String | Trigger channel for CEN/CEN+ scenario events [see possible values](#cen-cen-channels) | R (TRIGGER) |
|
| `button#X` | `bus_cen_scenario_control`, `bus_cenplus_scenario_control` | String | Trigger channel for CEN/CEN+ scenario events [see possible values](#cen-cen-channels) | R (TRIGGER) |
|
||||||
|
| `sensor` | `bus_dry_contact_ir` | Switch | Indicates if a Dry Contact Interface is `ON`/`OFF`, or if a IR Sensor is detecting movement (`ON`), or not (`OFF`) | R |
|
||||||
| `power` | `bus_energy_meter` | Number:Power | The current active power usage from Energy Meter | R |
|
| `power` | `bus_energy_meter` | Number:Power | The current active power usage from Energy Meter | R |
|
||||||
|
|
||||||
### Thermo channels
|
### Thermo channels
|
||||||
|
@ -233,6 +236,7 @@ Bridge openwebnet:bus_gateway:mybridge "MyHOMEServer1" [ host="192.168.1.35", pa
|
||||||
bus_thermo_sensor EXT_tempsensor "External Temperature" [ where="500"]
|
bus_thermo_sensor EXT_tempsensor "External Temperature" [ where="500"]
|
||||||
bus_cen_scenario_control LR_CEN_scenario "Living Room CEN" [ where="51", buttons="4,3,8"]
|
bus_cen_scenario_control LR_CEN_scenario "Living Room CEN" [ where="51", buttons="4,3,8"]
|
||||||
bus_cenplus_scenario_control LR_CENplus_scenario "Living Room CEN+" [ where="212", buttons="1,5,18" ]
|
bus_cenplus_scenario_control LR_CENplus_scenario "Living Room CEN+" [ where="212", buttons="1,5,18" ]
|
||||||
|
bus_dry_contact_ir LR_IR_sensor "Living Room IR Sensor" [ where="399" ]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -275,8 +279,9 @@ String iLR_zone_cv "Conditioning valves" (g
|
||||||
|
|
||||||
Number:Temperature iEXT_temp "Temperature [%.1f %unit%]" (gExternal) { channel="openwebnet:bus_thermo_sensor:mybridge:EXT_tempsensor:temperature" }
|
Number:Temperature iEXT_temp "Temperature [%.1f %unit%]" (gExternal) { channel="openwebnet:bus_thermo_sensor:mybridge:EXT_tempsensor:temperature" }
|
||||||
|
|
||||||
String iCENPlusProxyItem "CEN+ Proxy Item"
|
String iCENPlusProxyItem "CEN+ Proxy Item"
|
||||||
|
|
||||||
|
Switch iLR_IR_sensor "Sensor" { channel="openwebnet:bus_dry_contact_ir:mybridge:LR_IR_sensor:sensor" }
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -299,6 +304,7 @@ sitemap openwebnet label="OpenWebNet Binding Example Sitemap"
|
||||||
Default item=iLR_switch icon="light"
|
Default item=iLR_switch icon="light"
|
||||||
Default item=iLR_dimmer icon="light"
|
Default item=iLR_dimmer icon="light"
|
||||||
Default item=iLR_shutter
|
Default item=iLR_shutter
|
||||||
|
Switch item=iLR_IR_sensor mappings=[ON="Presence", OFF="No Presence"]
|
||||||
}
|
}
|
||||||
|
|
||||||
Frame label="Energy Meters" icon="energy"
|
Frame label="Energy Meters" icon="energy"
|
||||||
|
|
|
@ -25,8 +25,8 @@ import org.openhab.core.thing.ThingTypeUID;
|
||||||
* The {@link OpenWebNetBindingConstants} class defines common constants, which are used across the whole binding.
|
* The {@link OpenWebNetBindingConstants} class defines common constants, which are used across the whole binding.
|
||||||
*
|
*
|
||||||
* @author Massimo Valla - Initial contribution
|
* @author Massimo Valla - Initial contribution
|
||||||
* @author Andrea Conte - Energy management, Thermoregulation
|
|
||||||
* @author Gilberto Cocchi - Thermoregulation
|
* @author Gilberto Cocchi - Thermoregulation
|
||||||
|
* @author Andrea Conte - Energy management, Thermoregulation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@NonNullByDefault
|
@NonNullByDefault
|
||||||
|
@ -62,6 +62,8 @@ public class OpenWebNetBindingConstants {
|
||||||
public static final ThingTypeUID THING_TYPE_BUS_CEN_SCENARIO_CONTROL = new ThingTypeUID(BINDING_ID,
|
public static final ThingTypeUID THING_TYPE_BUS_CEN_SCENARIO_CONTROL = new ThingTypeUID(BINDING_ID,
|
||||||
"bus_cen_scenario_control");
|
"bus_cen_scenario_control");
|
||||||
public static final String THING_LABEL_BUS_CEN_SCENARIO_CONTROL = "CEN Control";
|
public static final String THING_LABEL_BUS_CEN_SCENARIO_CONTROL = "CEN Control";
|
||||||
|
public static final ThingTypeUID THING_TYPE_BUS_DRY_CONTACT_IR = new ThingTypeUID(BINDING_ID, "bus_dry_contact_ir");
|
||||||
|
public static final String THING_LABEL_BUS_DRY_CONTACT_IR = "Dry Contact/IR";
|
||||||
public static final ThingTypeUID THING_TYPE_BUS_CENPLUS_SCENARIO_CONTROL = new ThingTypeUID(BINDING_ID,
|
public static final ThingTypeUID THING_TYPE_BUS_CENPLUS_SCENARIO_CONTROL = new ThingTypeUID(BINDING_ID,
|
||||||
"bus_cenplus_scenario_control");
|
"bus_cenplus_scenario_control");
|
||||||
public static final String THING_LABEL_BUS_CENPLUS_SCENARIO_CONTROL = "CEN+ Control";
|
public static final String THING_LABEL_BUS_CENPLUS_SCENARIO_CONTROL = "CEN+ Control";
|
||||||
|
@ -94,7 +96,7 @@ public class OpenWebNetBindingConstants {
|
||||||
public static final Set<ThingTypeUID> ENERGY_MANAGEMENT_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BUS_ENERGY_METER);
|
public static final Set<ThingTypeUID> ENERGY_MANAGEMENT_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BUS_ENERGY_METER);
|
||||||
// ## CEN/CEN+ Scenario
|
// ## CEN/CEN+ Scenario
|
||||||
public static final Set<ThingTypeUID> SCENARIO_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BUS_CEN_SCENARIO_CONTROL,
|
public static final Set<ThingTypeUID> SCENARIO_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BUS_CEN_SCENARIO_CONTROL,
|
||||||
THING_TYPE_BUS_CENPLUS_SCENARIO_CONTROL);
|
THING_TYPE_BUS_CENPLUS_SCENARIO_CONTROL, THING_TYPE_BUS_DRY_CONTACT_IR);
|
||||||
// ## Groups
|
// ## Groups
|
||||||
public static final Set<ThingTypeUID> DEVICE_SUPPORTED_THING_TYPES = Stream
|
public static final Set<ThingTypeUID> DEVICE_SUPPORTED_THING_TYPES = Stream
|
||||||
.of(LIGHTING_SUPPORTED_THING_TYPES, AUTOMATION_SUPPORTED_THING_TYPES,
|
.of(LIGHTING_SUPPORTED_THING_TYPES, AUTOMATION_SUPPORTED_THING_TYPES,
|
||||||
|
@ -130,6 +132,7 @@ public class OpenWebNetBindingConstants {
|
||||||
public static final String CHANNEL_SCENARIO_BUTTON = "button#";
|
public static final String CHANNEL_SCENARIO_BUTTON = "button#";
|
||||||
public static final String CHANNEL_TYPE_CEN_BUTTON_EVENT = "cenButtonEvent";
|
public static final String CHANNEL_TYPE_CEN_BUTTON_EVENT = "cenButtonEvent";
|
||||||
public static final String CHANNEL_TYPE_CEN_PLUS_BUTTON_EVENT = "cenPlusButtonEvent";
|
public static final String CHANNEL_TYPE_CEN_PLUS_BUTTON_EVENT = "cenPlusButtonEvent";
|
||||||
|
public static final String CHANNEL_DRY_CONTACT_IR = "sensor";
|
||||||
|
|
||||||
// devices config properties
|
// devices config properties
|
||||||
public static final String CONFIG_PROPERTY_WHERE = "where";
|
public static final String CONFIG_PROPERTY_WHERE = "where";
|
||||||
|
|
|
@ -159,6 +159,12 @@ public class OpenWebNetDeviceDiscoveryService extends AbstractDiscoveryService
|
||||||
deviceWho = Who.CEN_SCENARIO_SCHEDULER;
|
deviceWho = Who.CEN_SCENARIO_SCHEDULER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SCS_DRY_CONTACT_IR: {
|
||||||
|
thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_BUS_DRY_CONTACT_IR;
|
||||||
|
thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_DRY_CONTACT_IR;
|
||||||
|
deviceWho = Who.CEN_PLUS_SCENARIO_SCHEDULER;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case MULTIFUNCTION_SCENARIO_CONTROL: {
|
case MULTIFUNCTION_SCENARIO_CONTROL: {
|
||||||
thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_BUS_CENPLUS_SCENARIO_CONTROL;
|
thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_BUS_CENPLUS_SCENARIO_CONTROL;
|
||||||
thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_CENPLUS_SCENARIO_CONTROL;
|
thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_CENPLUS_SCENARIO_CONTROL;
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.openwebnet.internal.OpenWebNetBindingConstants;
|
import org.openhab.binding.openwebnet.internal.OpenWebNetBindingConstants;
|
||||||
import org.openhab.binding.openwebnet.internal.actions.OpenWebNetCENActions;
|
import org.openhab.binding.openwebnet.internal.actions.OpenWebNetCENActions;
|
||||||
|
import org.openhab.core.library.types.OnOffType;
|
||||||
import org.openhab.core.thing.Channel;
|
import org.openhab.core.thing.Channel;
|
||||||
import org.openhab.core.thing.ChannelUID;
|
import org.openhab.core.thing.ChannelUID;
|
||||||
import org.openhab.core.thing.Thing;
|
import org.openhab.core.thing.Thing;
|
||||||
|
@ -36,6 +37,7 @@ import org.openhab.core.thing.binding.builder.ThingBuilder;
|
||||||
import org.openhab.core.thing.type.ChannelKind;
|
import org.openhab.core.thing.type.ChannelKind;
|
||||||
import org.openhab.core.thing.type.ChannelTypeUID;
|
import org.openhab.core.thing.type.ChannelTypeUID;
|
||||||
import org.openhab.core.types.Command;
|
import org.openhab.core.types.Command;
|
||||||
|
import org.openwebnet4j.communication.OWNException;
|
||||||
import org.openwebnet4j.message.BaseOpenMessage;
|
import org.openwebnet4j.message.BaseOpenMessage;
|
||||||
import org.openwebnet4j.message.CEN;
|
import org.openwebnet4j.message.CEN;
|
||||||
import org.openwebnet4j.message.CEN.Pressure;
|
import org.openwebnet4j.message.CEN.Pressure;
|
||||||
|
@ -51,8 +53,9 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link OpenWebNetScenarioHandler} is responsible for handling commands/messages for CEN/CEN+ Scenarios. It
|
* The {@link OpenWebNetScenarioHandler} is responsible for handling CEN/CEN+ Scenarios messages and Dry Contact / IR
|
||||||
* extends the abstract {@link OpenWebNetThingHandler}.
|
* Interfaces messages.
|
||||||
|
* It extends the abstract {@link OpenWebNetThingHandler}.
|
||||||
*
|
*
|
||||||
* @author Massimo Valla - Initial contribution
|
* @author Massimo Valla - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -112,13 +115,21 @@ public class OpenWebNetScenarioHandler extends OpenWebNetThingHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isDryContactIR = false;
|
||||||
private boolean isCENPlus = false;
|
private boolean isCENPlus = false;
|
||||||
|
private static long lastAllDevicesRefreshTS = -1; // timestamp when the last request for all device refresh was sent
|
||||||
|
// for this handler
|
||||||
|
protected static final int ALL_DEVICES_REFRESH_INTERVAL_MSEC = 10000; // interval in msec before sending another all
|
||||||
|
// devices refresh request
|
||||||
|
|
||||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.SCENARIO_SUPPORTED_THING_TYPES;
|
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.SCENARIO_SUPPORTED_THING_TYPES;
|
||||||
|
|
||||||
public OpenWebNetScenarioHandler(Thing thing) {
|
public OpenWebNetScenarioHandler(Thing thing) {
|
||||||
super(thing);
|
super(thing);
|
||||||
if (OpenWebNetBindingConstants.THING_TYPE_BUS_CENPLUS_SCENARIO_CONTROL.equals(thing.getThingTypeUID())) {
|
if (OpenWebNetBindingConstants.THING_TYPE_BUS_DRY_CONTACT_IR.equals(thing.getThingTypeUID())) {
|
||||||
|
isDryContactIR = true;
|
||||||
|
logger.debug("created DryContact/IR device for thing: {}", getThing().getUID());
|
||||||
|
} else if (OpenWebNetBindingConstants.THING_TYPE_BUS_CENPLUS_SCENARIO_CONTROL.equals(thing.getThingTypeUID())) {
|
||||||
isCENPlus = true;
|
isCENPlus = true;
|
||||||
logger.debug("created CEN+ device for thing: {}", getThing().getUID());
|
logger.debug("created CEN+ device for thing: {}", getThing().getUID());
|
||||||
} else {
|
} else {
|
||||||
|
@ -156,7 +167,7 @@ public class OpenWebNetScenarioHandler extends OpenWebNetThingHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String ownIdPrefix() {
|
protected String ownIdPrefix() {
|
||||||
if (isCENPlus) {
|
if (isCENPlus || isDryContactIR) {
|
||||||
return Who.CEN_PLUS_SCENARIO_SCHEDULER.value().toString();
|
return Who.CEN_PLUS_SCENARIO_SCHEDULER.value().toString();
|
||||||
} else {
|
} else {
|
||||||
return Who.CEN_SCENARIO_SCHEDULER.value().toString();
|
return Who.CEN_SCENARIO_SCHEDULER.value().toString();
|
||||||
|
@ -167,13 +178,33 @@ public class OpenWebNetScenarioHandler extends OpenWebNetThingHandler {
|
||||||
protected void handleMessage(BaseOpenMessage msg) {
|
protected void handleMessage(BaseOpenMessage msg) {
|
||||||
super.handleMessage(msg);
|
super.handleMessage(msg);
|
||||||
if (msg.isCommand()) {
|
if (msg.isCommand()) {
|
||||||
triggerChannel((CEN) msg);
|
if (isDryContactIR) {
|
||||||
|
updateDryContactIRState((CENPlusScenario) msg);
|
||||||
|
} else {
|
||||||
|
triggerButtonChannel((CEN) msg);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.debug("handleMessage() Ignoring unsupported DIM for thing {}. Frame={}", getThing().getUID(), msg);
|
logger.debug("handleMessage() Ignoring unsupported DIM for thing {}. Frame={}", getThing().getUID(), msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void triggerChannel(CEN cenMsg) {
|
private void updateDryContactIRState(CENPlusScenario msg) {
|
||||||
|
logger.debug("updateDryContactIRState() for thing: {}", thing.getUID());
|
||||||
|
try {
|
||||||
|
if (msg.isOn()) {
|
||||||
|
updateState(CHANNEL_DRY_CONTACT_IR, OnOffType.ON);
|
||||||
|
} else if (msg.isOff()) {
|
||||||
|
updateState(CHANNEL_DRY_CONTACT_IR, OnOffType.OFF);
|
||||||
|
} else {
|
||||||
|
logger.debug("updateDryContactIRState() Ignoring unsupported WHAT for thing {}. Frame={}",
|
||||||
|
getThing().getUID(), msg);
|
||||||
|
}
|
||||||
|
} catch (FrameException fe) {
|
||||||
|
logger.warn("updateDryContactIRState() Ignoring invalid frame {}", msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void triggerButtonChannel(CEN cenMsg) {
|
||||||
Integer buttonNumber;
|
Integer buttonNumber;
|
||||||
try {
|
try {
|
||||||
buttonNumber = cenMsg.getButtonNumber();
|
buttonNumber = cenMsg.getButtonNumber();
|
||||||
|
@ -244,7 +275,6 @@ public class OpenWebNetScenarioHandler extends OpenWebNetThingHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerChannel(channel.getUID(), pressEv.toString());
|
triggerChannel(channel.getUID(), pressEv.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,21 +356,59 @@ public class OpenWebNetScenarioHandler extends OpenWebNetThingHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleChannelCommand(ChannelUID channel, Command command) {
|
protected void handleChannelCommand(ChannelUID channel, Command command) {
|
||||||
logger.warn("CEN/CEN+ channels are trigger channels and do not handle commands");
|
logger.warn("CEN/CEN+ and DryContact/IR have read-only channels. Ignoring command {} for channel {}", command,
|
||||||
|
channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void refreshDevice(boolean refreshAll) {
|
protected void refreshDevice(boolean refreshAll) {
|
||||||
logger.debug("CEN/CEN+ channels are trigger channels and do not have state");
|
if (isDryContactIR) {
|
||||||
|
if (refreshAll) {
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
if (now - lastAllDevicesRefreshTS > ALL_DEVICES_REFRESH_INTERVAL_MSEC) {
|
||||||
|
try {
|
||||||
|
send(CENPlusScenario.requestStatus("30"));
|
||||||
|
lastAllDevicesRefreshTS = now;
|
||||||
|
} catch (OWNException e) {
|
||||||
|
logger.warn("Excpetion while requesting all DryContact/IR devices refresh: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.debug("Refresh all devices just sent...");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
requestState();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.debug("CEN/CEN+ channels are trigger channels and do not have state");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void requestChannelState(ChannelUID channel) {
|
||||||
|
if (isDryContactIR) {
|
||||||
|
requestState();
|
||||||
|
} else {
|
||||||
|
logger.debug("CEN/CEN+ channels are trigger channels and do not have state");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* helper method to request DryContact/IR device state */
|
||||||
|
private void requestState() {
|
||||||
|
Where w = deviceWhere;
|
||||||
|
if (w != null) {
|
||||||
|
try {
|
||||||
|
send(CENPlusScenario.requestStatus(w.value()));
|
||||||
|
} catch (OWNException e) {
|
||||||
|
logger.warn("requestState() Exception while requesting device state: {} for thing {}", e.getMessage(),
|
||||||
|
thing.getUID());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.warn("Could not requestState(): deviceWhere is null");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Where buildBusWhere(String wStr) throws IllegalArgumentException {
|
protected Where buildBusWhere(String wStr) throws IllegalArgumentException {
|
||||||
return new WhereCEN(wStr);
|
return new WhereCEN(wStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void requestChannelState(ChannelUID channel) {
|
|
||||||
logger.debug("CEN/CEN+ channels are trigger channels and do not have state");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="where" type="text" required="true">
|
<parameter name="where" type="text" required="true">
|
||||||
<label>OpenWebNet Address (where)</label>
|
<label>OpenWebNet Address (where)</label>
|
||||||
<description>Use 2+N[0-2047]. Example: scenario control 5 --> WHERE=25</description>
|
<description>Use 2+N[0-2047]. Example: scenario control 5 --> where=25</description>
|
||||||
</parameter>
|
</parameter>
|
||||||
</config-description>
|
</config-description>
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="where" type="text" required="true">
|
<parameter name="where" type="text" required="true">
|
||||||
<label>OpenWebNet Address (where)</label>
|
<label>OpenWebNet Address (where)</label>
|
||||||
<description>Example: A/PL address: A=1 PL=3 --> WHERE=13. On local bus: WHERE=13#4#01</description>
|
<description>Example: A/PL address: A=1 PL=3 --> where=13. On local bus: where=13#4#01</description>
|
||||||
</parameter>
|
</parameter>
|
||||||
|
|
||||||
</config-description>
|
</config-description>
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<thing:thing-descriptions bindingId="openwebnet"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
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 for BUS Dry Contact Interfaces and IR Interfaces -->
|
||||||
|
<thing-type id="bus_dry_contact_ir">
|
||||||
|
<supported-bridge-type-refs>
|
||||||
|
<bridge-type-ref id="bus_gateway"/>
|
||||||
|
</supported-bridge-type-refs>
|
||||||
|
|
||||||
|
<label>Dry Contact/IR Interface</label>
|
||||||
|
<description>A OpenWebNet BUS/SCS Dry Contact Interface or IR Interface. BTicino models: 3477/F428, IR 4610-4611-4640
|
||||||
|
etc.</description>
|
||||||
|
|
||||||
|
<channels>
|
||||||
|
<channel id="sensor" typeId="dryContactIR"/>
|
||||||
|
</channels>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<property name="vendor">BTicino/Legrand</property>
|
||||||
|
<property name="model">BTI-3477/F428/IR 4610-4611-4640 etc.</property>
|
||||||
|
<property name="ownDeviceType">2510</property>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<representation-property>ownId</representation-property>
|
||||||
|
|
||||||
|
<config-description>
|
||||||
|
<parameter name="where" type="text" required="true">
|
||||||
|
<label>OpenWebNet Address (where)</label>
|
||||||
|
<description>Automation Dry Contacts (N=1-201): example N=60 --> where=360. Alarm Dry Contacts and IR sensors
|
||||||
|
(Zone=1-9, N=1-9): example Zone=4, N=5 --> where=345</description>
|
||||||
|
</parameter>
|
||||||
|
</config-description>
|
||||||
|
|
||||||
|
</thing-type>
|
||||||
|
</thing:thing-descriptions>
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<config-description>
|
<config-description>
|
||||||
<parameter name="where" type="text" required="true">
|
<parameter name="where" type="text" required="true">
|
||||||
<label>OpenWebNet Device Address (where)</label>
|
<label>OpenWebNet Address (where)</label>
|
||||||
<description>It identifies one OpenWebNet device</description>
|
<description>It identifies one OpenWebNet device</description>
|
||||||
</parameter>
|
</parameter>
|
||||||
</config-description>
|
</config-description>
|
||||||
|
|
|
@ -205,4 +205,12 @@
|
||||||
</options>
|
</options>
|
||||||
</event>
|
</event>
|
||||||
</channel-type>
|
</channel-type>
|
||||||
|
|
||||||
|
<channel-type id="dryContactIR">
|
||||||
|
<item-type>Switch</item-type>
|
||||||
|
<label>Sensor</label>
|
||||||
|
<description>Dry Contact Interface or IR Interface sensor movement (read only)</description>
|
||||||
|
<state readOnly="true"></state>
|
||||||
|
</channel-type>
|
||||||
|
|
||||||
</thing:thing-descriptions>
|
</thing:thing-descriptions>
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.openhab.core.thing.Bridge;
|
||||||
import org.openwebnet4j.message.BaseOpenMessage;
|
import org.openwebnet4j.message.BaseOpenMessage;
|
||||||
import org.openwebnet4j.message.FrameException;
|
import org.openwebnet4j.message.FrameException;
|
||||||
import org.openwebnet4j.message.Where;
|
import org.openwebnet4j.message.Where;
|
||||||
|
import org.openwebnet4j.message.WhereCEN;
|
||||||
import org.openwebnet4j.message.WhereEnergyManagement;
|
import org.openwebnet4j.message.WhereEnergyManagement;
|
||||||
import org.openwebnet4j.message.WhereLightAutom;
|
import org.openwebnet4j.message.WhereLightAutom;
|
||||||
import org.openwebnet4j.message.WhereThermo;
|
import org.openwebnet4j.message.WhereThermo;
|
||||||
|
@ -60,9 +61,9 @@ public class OwnIdTest {
|
||||||
* BUS Thermo actuator 1#2 1 4.1 1
|
* BUS Thermo actuator 1#2 1 4.1 1
|
||||||
* BUS TempSensor 500 500 4.500 500
|
* BUS TempSensor 500 500 4.500 500
|
||||||
* BUS Energy 51 51 18.51 51
|
* BUS Energy 51 51 18.51 51
|
||||||
* -INACTIVE- BUS CEN 51 51 15.51 51
|
* BUS CEN 51 51 15.51 51
|
||||||
* -INACTIVE- BUS CEN+ 212 212 25.212 212
|
* BUS CEN+ 212 212 25.212 212
|
||||||
* -INACTIVE- BUS DryContact 399 399 25.399 399
|
* BUS DryContact 399 399 25.399 399
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
@ -79,7 +80,10 @@ public class OwnIdTest {
|
||||||
bus_thermo(new WhereThermo("1"), Who.fromValue(4),"*#4*1*0*0020##" , "1", "4.1", "1"),
|
bus_thermo(new WhereThermo("1"), Who.fromValue(4),"*#4*1*0*0020##" , "1", "4.1", "1"),
|
||||||
bus_thermo_act(new WhereThermo("1#2"), Who.fromValue(4),"*#4*1#2*20*0##" ,"1", "4.1", "1"),
|
bus_thermo_act(new WhereThermo("1#2"), Who.fromValue(4),"*#4*1#2*20*0##" ,"1", "4.1", "1"),
|
||||||
bus_tempSensor(new WhereThermo("500"), Who.fromValue(4), "*#4*500*15*1*0020*0001##", "500", "4.500", "500"),
|
bus_tempSensor(new WhereThermo("500"), Who.fromValue(4), "*#4*500*15*1*0020*0001##", "500", "4.500", "500"),
|
||||||
bus_energy(new WhereEnergyManagement("51"), Who.fromValue(18), "*#18*51*113##", "51", "18.51", "51");
|
bus_energy(new WhereEnergyManagement("51"), Who.fromValue(18), "*#18*51*113##", "51", "18.51", "51"),
|
||||||
|
bus_cen(new WhereCEN("51"), Who.fromValue(15), "*15*31*51##", "51", "15.51", "51"),
|
||||||
|
bus_cen_plus(new WhereCEN("212"), Who.fromValue(25), "*25*21#31*212##", "212", "25.212", "212"),
|
||||||
|
bus_drycontact(new WhereCEN("399"), Who.fromValue(25), "*25*32#1*399##", "399", "25.399", "399");
|
||||||
|
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue