- the `where` configuration parameter (`OpenWebNet Address`):
- example BUS/SCS zone `1` --> `where="1"`
-- 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.
+- 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:
- example sensor `5` of external zone `00` --> `where="500"`
- example: slave sensor `3` of zone `2` --> `where="302"`
-The (optional) Central Unit can be configured defining a `bus_themo_cu` Thing with the `where` configuration parameter (`OpenWebNet Address`) set to `where="0"`.
+The (optional) Central Unit can be configured defining a `bus_themo_cu` Thing with the `where` configuration parameter (`OpenWebNet Address`) set to `where="#0"` for a 99-zone Central Unit or `where="#0#1"` for a 4-zone Central Unit.
##### Thermo Central Unit integration missing points
- Read setPoint temperature and current mode
-- Holiday activation command (all zones)
-- Discovery
+- Holiday/Vacation activation command
#### Configuring Alarm and Auxiliary (AUX)
**NOTE 1** Receiving AUX messages originating from the BUS is not supported yet, only sending messages to the BUS is supported
-**NOTE 2** Alarm messages on BUS are not sent by MyHOMEServer1, therfore this gateway cannot be used to integrate the BTicino Alarm system
+**NOTE 2** Alarm messages on BUS are not sent by MyHOMEServer1, therefore this gateway cannot be used to integrate the BTicino Alarm system
BUS Auxiliary commands (WHO=9) can be used to send on the BUS commands to control, for example, external devices or a BTicino Alarm system.
bus_energy_meter CENTRAL_Ta "Energy Meter Ta" [ where="51" ]
bus_energy_meter CENTRAL_Tb "Energy Meter Tb" [ where="52" ]
- bus_thermo_cu CU_3550 "99 zones central unit" [ where="0" ]
+ bus_thermo_cu CU_3550 "99 zones Central Unit" [ where="#0" ]
bus_thermo_zone LR_zone "Living Room Zone" [ where="2"]
bus_thermo_sensor EXT_tempsensor "External Temperature" [ where="500"]
[@rubenfuser](https://community.openhab.org/u/rubenfuser),
[@stamate_viorel](https://community.openhab.org/u/stamate_viorel),
[@marchino](https://community.openhab.org/u/marchino),
-[@the-ninth](https://community.openhab.org/u/the-ninth)
+[@the-ninth](https://community.openhab.org/u/the-ninth),
+[@giacob](https://community.openhab.org/u/giacob)
and many others at the fantastic openHAB community!
private @NonNullByDefault({}) OpenWebNetBridgeHandler bridgeHandler;
private @NonNullByDefault({}) ThingUID bridgeUID;
+ private boolean cuFound = false;
+
public OpenWebNetDeviceDiscoveryService() {
super(SUPPORTED_THING_TYPES, SEARCH_TIME_SEC);
}
protected void startScan() {
logger.info("------ SEARCHING for DEVICES on bridge '{}' ({}) ...", bridgeHandler.getThing().getLabel(),
bridgeUID);
+ cuFound = false;
bridgeHandler.searchDevices();
}
String whereConfig = w.value();
- // remove # from discovered thermo zone/central unit or alarm zone
- if (OpenWebNetBindingConstants.THING_TYPE_BUS_THERMO_ZONE.equals(thingTypeUID)
- || OpenWebNetBindingConstants.THING_TYPE_BUS_THERMO_CU.equals(thingTypeUID)) {
- whereConfig = "" + ((WhereThermo) where).getZone();
- } else if (OpenWebNetBindingConstants.THING_TYPE_BUS_ALARM_ZONE.equals(thingTypeUID)) {
- whereConfig = "" + ((WhereAlarm) where).getZone();
+ // remove # from discovered alarm zone
+ if (OpenWebNetBindingConstants.THING_TYPE_BUS_ALARM_ZONE.equals(thingTypeUID)) {
+ whereConfig = "" + ((WhereAlarm) w).getZone();
}
- if (w instanceof WhereZigBee && WhereZigBee.UNIT_02.equals(((WhereZigBee) where).getUnit())) {
- logger.debug("UNIT=02 found (WHERE={}) -> will remove previous result if exists", where);
+
+ Map<String, Object> properties = new HashMap<>(2);
+
+ // detect Thermo CU type
+ if (OpenWebNetBindingConstants.THING_TYPE_BUS_THERMO_CU.equals(thingTypeUID)) {
+ cuFound = true;
+ logger.debug("CU found: {}", w);
+ if (w.value().charAt(0) == '#') { // 99-zone CU
+ thingLabel += " 99-zone";
+ logger.debug("@@@@@ THERMO CU found 99-zone: where={}, ownId={}, whereConfig={}", w, ownId,
+ whereConfig);
+ } else {
+ thingLabel += " 4-zone";
+ whereConfig = "#" + w.value();
+ logger.debug("@@@@ THERMO CU found 4-zone: where={}, ownId={}, whereConfig={}", w, ownId, whereConfig);
+ }
+ } else if (OpenWebNetBindingConstants.THING_TYPE_BUS_THERMO_ZONE.equals(thingTypeUID)) {
+ if (cuFound) {
+ // set param standalone = false for thermo zone
+ properties.put(OpenWebNetBindingConstants.CONFIG_PROPERTY_STANDALONE, false);
+ }
+ whereConfig = "" + ((WhereThermo) w).getZone();
+ logger.debug("@@@@@ THERMO ZONE found: where={}, ownId={}, whereConfig={}, standalone={}", w, ownId,
+ whereConfig, properties.get(OpenWebNetBindingConstants.CONFIG_PROPERTY_STANDALONE));
+ }
+
+ if (w instanceof WhereZigBee && WhereZigBee.UNIT_02.equals(((WhereZigBee) w).getUnit())) {
+ logger.debug("UNIT=02 found (WHERE={}) -> will remove previous result if exists", w);
thingRemoved(thingUID); // remove previously discovered thing
// re-create thingUID with new type
thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_ZB_ON_OFF_SWITCH_2UNITS;
OpenWebNetBindingConstants.THING_TYPE_ZB_ON_OFF_SWITCH,
OpenWebNetBindingConstants.THING_TYPE_ZB_ON_OFF_SWITCH_2UNITS);
}
- Map<String, Object> properties = new HashMap<>(2);
properties.put(OpenWebNetBindingConstants.CONFIG_PROPERTY_WHERE, whereConfig);
properties.put(OpenWebNetBindingConstants.PROPERTY_OWNID, ownId);
if (OpenWebNetBindingConstants.THING_TYPE_GENERIC_DEVICE.equals(thingTypeUID)) {
if (str.indexOf('#') == 0) { // Thermo central unit (#0) or zone via central unit (#Z, Z=[1-99]) --> Z,
// Alarm Zone (#Z) --> Z
str = str.substring(1);
- } else if (str.indexOf('#') > 0) { // Thermo zone Z and actuator N (Z#N, Z=[1-99], N=[1-9]) --> Z
+ } else if (str.indexOf('#') > 0 && str.charAt(0) != '0') { // Thermo zone Z and actuator N (Z#N,
+ // Z=[1-99], N=[1-9]) --> Z
str = str.substring(0, str.indexOf('#'));
}
}
* commands/messages for Thermoregulation
* Things. It extends the abstract {@link OpenWebNetThingHandler}.
*
- * @author Massimo Valla - Initial contribution
+ * @author Massimo Valla - Initial contribution. Added support for 4-zone CU
* @author Andrea Conte - Thermoregulation
* @author Gilberto Cocchi - Thermoregulation
*/
private Thermoregulation.Function currentFunction = Thermoregulation.Function.GENERIC;
private Thermoregulation.OperationMode currentMode = Thermoregulation.OperationMode.MANUAL;
- private boolean isStandAlone = false;
+ private boolean isStandAlone = true; // true if zone is not associated to a CU
private boolean isCentralUnit = false;
if (!isCentralUnit) {
Object standAloneConfig = getConfig().get(OpenWebNetBindingConstants.CONFIG_PROPERTY_STANDALONE);
if (standAloneConfig != null) {
- // null in case of thermo_sensor
isStandAlone = Boolean.parseBoolean(standAloneConfig.toString());
}
+ logger.debug("@@@@ THERMO ZONE INITIALIZE isStandAlone={}", isStandAlone);
} else {
- // central unit must have WHERE=0
- if (!deviceWhere.value().equals("0")) {
- logger.warn("initialize() Invalid WHERE={} for Central Unit.", deviceWhere.value());
+ // central unit must have WHERE=#0 or WHERE=0 or WHERE=#0#n
+ String w = deviceWhere.value();
+ if (w == null || !("0".equals(w) || "#0".equals(w) || w.startsWith("#0#"))) {
+ logger.warn("initialize() Invalid WHERE={} for Central Unit.", deviceWhere.value());
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
"@text/offline.conf-error-where");
+ return;
}
-
// reset state of signal channels (they will be setted when specific messages
// are received)
updateState(CHANNEL_CU_AT_LEAST_ONE_PROBE_MANUAL, OnOffType.OFF);
private String getWhere(String where) {
if (isCentralUnit) {
- return "#0";
+ return where;
} else {
return isStandAlone ? where : "#" + where;
}
protected void handleMessage(BaseOpenMessage msg) {
super.handleMessage(msg);
+ logger.debug("@@@@ Thermo.handleMessage(): {}", msg.toStringVerbose());
+
if (isCentralUnit) {
if (msg.getWhat() == null) {
return;
@Override
protected void refreshDevice(boolean refreshAll) {
logger.debug("--- refreshDevice() : refreshing SINGLE... ({})", thing.getUID());
- if (isCentralUnit) {
- // TODO: 4 zone central -> zone #0 CAN be also a zone with its temp.. with
- // 99-zones central no! let's assume it's a 99 zone
- try {
- send(Thermoregulation.requestStatus("#0"));
- } catch (OWNException e) {
- logger.warn("refreshDevice() central unit returned OWNException {}", e.getMessage());
- }
-
- return;
- }
if (deviceWhere != null) {
-
String w = deviceWhere.value();
+
+ if (isCentralUnit) {
+ // TODO: 4 zone central -> zone #0 CAN be also a zone with its temp.. with
+ // 99-zones central no! let's assume it's a 99 zone
+ try {
+ send(Thermoregulation.requestStatus(w));
+ } catch (OWNException e) {
+ logger.warn("refreshDevice() central unit returned OWNException {}", e.getMessage());
+ }
+ return;
+ }
+
try {
send(Thermoregulation.requestTemperature(w));
} catch (OWNException e) {
logger.warn("refreshDevice() where='{}' returned OWNException {}", w, e.getMessage());
}
+ } else {
+ logger.debug("refreshDevice() where is null");
}
}
}
thing-type.config.openwebnet.bus_scenario_control.where.label = OpenWebNet Address (where)
thing-type.config.openwebnet.bus_scenario_control.where.description = Example: scenario control module address 53 --> where=53. On local bus: where=53#4#01
thing-type.config.openwebnet.bus_thermo_cu.where.label = OpenWebNet Address (where)
-thing-type.config.openwebnet.bus_thermo_cu.where.description = The Central Unit can only assume where=0.
+thing-type.config.openwebnet.bus_thermo_cu.where.description = For Thermo Central Unit 99-zones --> where=#0, for 4-zones --> where=#0#1
thing-type.config.openwebnet.bus_thermo_sensor.where.label = OpenWebNet Address (where)
thing-type.config.openwebnet.bus_thermo_sensor.where.description = Example: sensor 3 of zone 2 --> where=302. Sensor 5 of external zone 00 --> where=500
thing-type.config.openwebnet.bus_thermo_zone.standAlone.label = Stand-alone
<representation-property>ownId</representation-property>
<config-description>
- <parameter name="where" type="text" readOnly="true">
+ <parameter name="where" type="text" required="true">
<label>OpenWebNet Address (where)</label>
- <description>The Central Unit can only assume where=0.</description>
- <default>0</default>
+ <description>For Thermo Central Unit 99-zones --> where=#0, for 4-zones --> where=#0#1</description>
</parameter>
+
</config-description>
</thing-type>
</thing:thing-descriptions>
* using {@link OpenWebNetBridgeHandler} methods: normalizeWhere(),
* ownIdFromWhoWhere(), ownIdFromMessage(), thingIdFromWhere()
*
- * @author Massimo Valla - Initial contribution, updates
+ * @author Massimo Valla - Initial contribution, various updates
* @author Andrea Conte - Energy management
* @author Giovanni Fabiani - Auxiliary message support
*/
* BUS Switch 51 51 1.51 51
* BUS Local Bus 25#4#01 25h4h01 1.25h4h01 25h4h01
* BUS Autom 93 93 2.93 93
- * BUS Thermo #1 or 1 1 4.1 1
+ * BUS Thermo zone 1 1 4.1 1
+ * BUS Thermo zone CU #1 1 4.1 1
+ * BUS Thermo CU 99-z #0 0 4.0 0
+ * BUS Thermo CU 4-z #0#1 0h1 4.0h1 0h1
* BUS Thermo actuator 1#2 1 4.1 1
* BUS TempSensor 500 500 4.500 500
* BUS Energy 51 51 18.51 51
public enum TEST {
// @formatter:off
- // msg, who, where, normW, ownId, thingId
+ // msg, who, where, normalizeWhere, ownId, thingId
zb_switch("*1*1*789309801#9##", Who.fromValue(1), new WhereZigBee("789309801#9"), "789309800h9", "1.789309800h9", "789309800h9"),
zb_switch_2u_1("*1*1*789301201#9##", Who.fromValue(1), new WhereZigBee("789301201#9"), "789301200h9", "1.789301200h9", "789301200h9"),
zb_switch_2u_2("*1*1*789301202#9##", Who.fromValue(1), new WhereZigBee("789301202#9"), "789301200h9", "1.789301200h9", "789301200h9"),
bus_switch("*1*1*51##", Who.fromValue(1), new WhereLightAutom("51"),"51", "1.51", "51"),
bus_localbus("*1*1*25#4#01##", Who.fromValue(1), new WhereLightAutom("25#4#01"), "25h4h01", "1.25h4h01", "25h4h01"),
bus_autom("*2*0*93##",Who.fromValue(2), new WhereLightAutom("93"), "93", "2.93", "93"),
- bus_thermo_via_cu("*#4*#1*0*0020##", Who.fromValue(4), new WhereThermo("#1"), "1", "4.1", "1"),
- bus_thermo("*#4*1*0*0020##", Who.fromValue(4), new WhereThermo("1"), "1", "4.1", "1"),
+ bus_thermo_zone("*#4*1*0*0020##", Who.fromValue(4), new WhereThermo("1"), "1", "4.1", "1"),
+ bus_thermo_zone_via_cu("*#4*#1*0*0020##", Who.fromValue(4), new WhereThermo("#1"), "1", "4.1", "1"),
+ bus_thermo_cu_99("*#4*#0##", Who.fromValue(4), new WhereThermo("#0") ,"0", "4.0", "0"),
+ bus_thermo_cu_4("*#4*#0#1##", Who.fromValue(4), new WhereThermo("#0#1") ,"0h1", "4.0h1", "0h1"),
bus_thermo_act("*#4*1#2*20*0##", Who.fromValue(4), new WhereThermo("1#2") ,"1", "4.1", "1"),
bus_tempSensor("*#4*500*15*1*0020*0001##",Who.fromValue(4), new WhereThermo("500"), "500", "4.500", "500"),
bus_energy("*#18*51*113##", Who.fromValue(18), new WhereEnergyManagement("51"), "51", "18.51", "51"),