From 553fcfa3b4b749fbc178ba986a63e5adc12f1316 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Sun, 8 May 2022 12:08:02 +0200 Subject: [PATCH 01/22] [netatmo] Do not ignore updated events (same timestamp) (#12701) Fix #12699 Signed-off-by: Laurent Garnier --- .../handler/channelhelper/EventChannelHelper.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/channelhelper/EventChannelHelper.java b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/channelhelper/EventChannelHelper.java index 3d880661a7bc3..a5fe003f7e5b7 100644 --- a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/channelhelper/EventChannelHelper.java +++ b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/channelhelper/EventChannelHelper.java @@ -15,8 +15,6 @@ import static org.openhab.binding.netatmo.internal.NetatmoBindingConstants.*; import static org.openhab.binding.netatmo.internal.utils.ChannelTypeUtils.*; -import java.time.ZonedDateTime; - import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.netatmo.internal.api.data.ModuleType; @@ -37,7 +35,6 @@ @NonNullByDefault public class EventChannelHelper extends ChannelHelper { private boolean isLocal; - private @Nullable ZonedDateTime lastEventTime; private @Nullable String vpnUrl, localUrl; private ModuleType moduleType = ModuleType.UNKNOWN; @@ -63,12 +60,9 @@ public void setUrls(String vpnUrl, @Nullable String localUrl) { public void setNewData(@Nullable NAObject data) { if (data instanceof Event) { Event event = (Event) data; - ZonedDateTime localLast = lastEventTime; - ZonedDateTime eventTime = event.getTime(); - if ((localLast != null && !eventTime.isAfter(localLast)) || !event.getEventType().appliesOn(moduleType)) { - return; // ignore incoming events if they are deprecated + if (!event.getEventType().appliesOn(moduleType)) { + return; } - lastEventTime = eventTime; } super.setNewData(data); } From 888f9621167d8862d594197f343bf18c2e90eb7f Mon Sep 17 00:00:00 2001 From: Giovanni Fabiani Date: Sun, 8 May 2022 21:02:42 +0200 Subject: [PATCH 02/22] [openwebnet] Add support for sending Auxiliary (AUX) commands/messages to the bus (WHO=9) (#12468) Signed-off-by: Giovanni Fabiani --- .../org.openhab.binding.openwebnet/README.md | 63 ++++++--- .../internal/OpenWebNetBindingConstants.java | 11 +- .../internal/OpenWebNetHandlerFactory.java | 5 + .../OpenWebNetDeviceDiscoveryService.java | 7 + .../handler/OpenWebNetAuxiliaryHandler.java | 131 ++++++++++++++++++ .../handler/OpenWebNetBridgeHandler.java | 3 +- .../main/resources/OH-INF/thing/BusAux.xml | 34 +++++ .../main/resources/OH-INF/thing/channels.xml | 23 +++ .../internal/handler/OwnIdTest.java | 8 +- 9 files changed, 263 insertions(+), 22 deletions(-) create mode 100644 bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetAuxiliaryHandler.java create mode 100644 bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/BusAux.xml diff --git a/bundles/org.openhab.binding.openwebnet/README.md b/bundles/org.openhab.binding.openwebnet/README.md index bbccb32565c2e..70658a2a8368c 100644 --- a/bundles/org.openhab.binding.openwebnet/README.md +++ b/bundles/org.openhab.binding.openwebnet/README.md @@ -38,15 +38,16 @@ The following Things and OpenWebNet `WHOs` are supported: ### For BUS/SCS -| Category | WHO | Thing Type IDs | Description | Status | -| ----------------------------- | :----------: | :--------------------------------------------------------: | ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Gateway Management | `13` | `bus_gateway` | Any IP gateway supporting OpenWebNet protocol should work | Successfully tested: F452, F453, F453AV,F454, F455, MyHOMEServer1, MyHOME_Screen10, MyHOME_Screen3,5, MH201, MH202, MH200N. Some connection stability issues/gateway resets reported with MH202  | -| Lighting | `1` | `bus_on_off_switch`, `bus_dimmer` | BUS switches and dimmers | Successfully tested: F411/2, F411/4, F411U2, F422, F429. Some discovery issues reported with F429 (DALI Dimmers) | -| 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`, `bus_thermo_cu` | Thermo zones management and temperature sensors (probes). | Successfully tested: H/LN4691, HS4692, KG4691; thermo sensors: L/N/NT4577 + 3455; Central Units (4 or 99 zones) are not fully supported yet. See [Channels - Thermo](#configuring-thermo) for more details | -| 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 | +| Category | WHO | Thing Type IDs | Description | Status | +|-------------------------------|:-----------:|:----------------------------------------------------------:|------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Gateway Management | `13` | `bus_gateway` | Any IP gateway supporting OpenWebNet protocol should work | Successfully tested: F452, F453, F453AV,F454, F455, MyHOMEServer1, MyHOME_Screen10, MyHOME_Screen3,5, MH201, MH202, MH200N. Some connection stability issues/gateway resets reported with MH202  | +| Lighting | `1` | `bus_on_off_switch`, `bus_dimmer` | BUS switches and dimmers | Successfully tested: F411/2, F411/4, F411U2, F422, F429. Some discovery issues reported with F429 (DALI Dimmers) | +| 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`, `bus_thermo_cu` | Thermo zones management and temperature sensors (probes). | Successfully tested: H/LN4691, HS4692, KG4691; thermo sensors: L/N/NT4577 + 3455; Central Units (4 or 99 zones) are not fully supported yet. See [Channels - Thermo](#configuring-thermo) for more details | +| Auxiliary (AUX) | `9` | `bus_aux` | AUX commands | Successfully tested: AUX configured for bulgrar-alarm unit 3486. Only sending AUX commands is supported | +| 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 | ### For ZigBee (Radio) @@ -152,6 +153,21 @@ Temperature sensors can be configured defining a `bus_thermo_sensor` Thing with The (optional) Central Unit can be configured defining a `bus_themo_cu` Thing. +#### Configuring Auxiliary (AUX) + +BUS Auxiliary commands (WHO=9) can be used to send on the BUS commands to control, for example, external devices or a BTcino Alarm system. + +To control a BTicino alarm system the alarm unit should be configured for example as follows: + +Antitheft -> Automations -> then toggle the Event option -> then select OPEN code + +- Type in the AUX command you want to set, e.g.\*9\*1\*4\## (where=4) +- Type in the associated Open Web Net code you want to execute, e.g.\*5\*8*#1234## (engage alarm on zones 1,2,3,4). + +Please note that receiving AUX messages originating from the bus is not supported yet, only sending messages to the bus is supported. + + + ### Central Unit integration missing points - Read setPoint temperature and current mode @@ -162,14 +178,15 @@ The (optional) Central Unit can be configured defining a `bus_themo_cu` Thing. ### 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 | -| ---------------------------------------- | ------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------- | :---------: | -| `switch` or `switch_01`/`02` for ZigBee | `bus_on_off_switch`, `zb_on_off_switch`, `zb_on_off_switch2u` | Switch | To switch the device `ON` and `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 | -| `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 | +| Channel Type ID (channel ID) | Applies to Thing Type IDs | Item Type | Description | Read/Write | +|-----------------------------------------|---------------------------------------------------------------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------|:-----------:| +| `switch` or `switch_01`/`02` for ZigBee | `bus_on_off_switch`, `zb_on_off_switch`, `zb_on_off_switch2u` | Switch | To switch the device `ON` and `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 | +| `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 | +| `aux` | `bus_aux` | String | Possible commands: ON,OFF,TOGGLE, STOP, UP,DOWN,ENABLED, DISABLED, RESET_GEN, RESET_BI, RESET_TRI. Only 'ON' and `OFF' are supported for now | R/W | ### Thermo channels @@ -263,6 +280,7 @@ Bridge openwebnet:bus_gateway:mybridge "MyHOMEServer1" [ host="192.168.1.35", pa 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_dry_contact_ir LR_IR_sensor "Living Room IR Sensor" [ where="399" ] + bus_aux Alarm_activation "Alarm activation" [ where="4" ] } ``` @@ -320,7 +338,10 @@ Number:Temperature iEXT_temp "Temperature [%.1f %unit%]" (g String iCENPlusProxyItem "CEN+ Proxy Item" -Switch iLR_IR_sensor "Sensor" { channel="openwebnet:bus_dry_contact_ir:mybridge:LR_IR_sensor:sensor" } +String iAlarm_activation "Alarm Activation" { channel="openwebnet:bus_aux:mybridge:Alarm_activation:aux"} + +Switch iLR_IR_sensor "Sensor" { channel="openwebnet:bus_dry_contact_ir:mybridge:LR_IR_sensor:sensor" } + ``` @@ -368,6 +389,12 @@ sitemap openwebnet label="OpenWebNet Binding Example Sitemap" { Switch item=iCENPlusProxyItem label="My CEN+ scenario" icon="movecontrol" mappings=[ON="Activate"] } + + Frame label="Alarm activation via AUX command" + { + Switch item=iAlarm_activation icon="siren" + + } } ``` diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetBindingConstants.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetBindingConstants.java index b5a436cd9e3ab..c51acc1401d77 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetBindingConstants.java +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetBindingConstants.java @@ -27,6 +27,7 @@ * @author Massimo Valla - Initial contribution * @author Gilberto Cocchi - Thermoregulation * @author Andrea Conte - Energy management, Thermoregulation + * @author Giovanni Fabiani - Aux support */ @NonNullByDefault @@ -70,6 +71,8 @@ public class OpenWebNetBindingConstants { "bus_cenplus_scenario_control"); public static final String THING_LABEL_BUS_CENPLUS_SCENARIO_CONTROL = "CEN+ Control"; + public static final ThingTypeUID THING_TYPE_BUS_AUX = new ThingTypeUID(BINDING_ID, "bus_aux"); + public static final String THING_LABEL_BUS_AUX = "Auxiliary"; // ZIGBEE public static final ThingTypeUID THING_TYPE_ZB_ON_OFF_SWITCH = new ThingTypeUID(BINDING_ID, "zb_on_off_switch"); public static final String THING_LABEL_ZB_ON_OFF_SWITCH = "ZigBee Switch"; @@ -99,11 +102,14 @@ public class OpenWebNetBindingConstants { // ## CEN/CEN+ Scenario public static final Set SCENARIO_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BUS_CEN_SCENARIO_CONTROL, THING_TYPE_BUS_CENPLUS_SCENARIO_CONTROL, THING_TYPE_BUS_DRY_CONTACT_IR); + + // ## Aux + public static final Set AUX_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BUS_AUX); // ## Groups public static final Set DEVICE_SUPPORTED_THING_TYPES = Stream .of(LIGHTING_SUPPORTED_THING_TYPES, AUTOMATION_SUPPORTED_THING_TYPES, THERMOREGULATION_SUPPORTED_THING_TYPES, ENERGY_MANAGEMENT_SUPPORTED_THING_TYPES, - SCENARIO_SUPPORTED_THING_TYPES, GENERIC_SUPPORTED_THING_TYPES) + SCENARIO_SUPPORTED_THING_TYPES, GENERIC_SUPPORTED_THING_TYPES, AUX_SUPPORTED_THING_TYPES) .flatMap(Collection::stream).collect(Collectors.toCollection(HashSet::new)); public static final Set BRIDGE_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_ZB_GATEWAY, THING_TYPE_BUS_GATEWAY); @@ -146,6 +152,9 @@ public class OpenWebNetBindingConstants { public static final String CHANNEL_TYPE_CEN_PLUS_BUTTON_EVENT = "cenPlusButtonEvent"; public static final String CHANNEL_DRY_CONTACT_IR = "sensor"; + // Aux + public static final String CHANNEL_AUX = "aux"; + // devices config properties public static final String CONFIG_PROPERTY_WHERE = "where"; public static final String CONFIG_PROPERTY_SHUTTER_RUN = "shutterRun"; diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java index 08077109bfb19..3f484fb79227d 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java @@ -17,6 +17,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.openwebnet.internal.handler.OpenWebNetAutomationHandler; +import org.openhab.binding.openwebnet.internal.handler.OpenWebNetAuxiliaryHandler; import org.openhab.binding.openwebnet.internal.handler.OpenWebNetBridgeHandler; import org.openhab.binding.openwebnet.internal.handler.OpenWebNetEnergyHandler; import org.openhab.binding.openwebnet.internal.handler.OpenWebNetGenericHandler; @@ -39,6 +40,7 @@ * @author Massimo Valla - Initial contribution * @author Andrea Conte - Energy management, Thermoregulation * @author Gilberto Cocchi - Thermoregulation + * @author Giovanni Fabiani - Auxiliary support */ @NonNullByDefault @Component(configurationPid = "binding.openwebnet", service = ThingHandlerFactory.class) @@ -74,6 +76,9 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { } else if (OpenWebNetScenarioHandler.SUPPORTED_THING_TYPES.contains(thing.getThingTypeUID())) { logger.debug("creating NEW SCENARIO Handler --- {}", thing.getUID()); return new OpenWebNetScenarioHandler(thing); + } else if (OpenWebNetAuxiliaryHandler.SUPPORTED_THING_TYPES.contains(thing.getThingTypeUID())) { + logger.debug("Creating NEW AUXILIARY Handler"); + return new OpenWebNetAuxiliaryHandler(thing); } logger.warn("ThingType {} is not supported by this binding", thing.getThingTypeUID()); return null; diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java index 3065fbb39849b..e366671fb6e01 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java @@ -43,6 +43,7 @@ * @author Massimo Valla - Initial contribution * @author Andrea Conte - Energy management, Thermoregulation * @author Gilberto Cocchi - Thermoregulation + * @author Giovanni Fabiani - Aux support */ @NonNullByDefault public class OpenWebNetDeviceDiscoveryService extends AbstractDiscoveryService @@ -173,6 +174,12 @@ public void newDiscoveryResult(Where where, OpenDeviceType deviceType, @Nullable deviceWho = Who.CEN_PLUS_SCENARIO_SCHEDULER; break; } + case SCS_AUXILIARY_TOGGLE_CONTROL: { + thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_BUS_AUX; + thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_AUX; + deviceWho = Who.AUX; + break; + } default: logger.warn("Device type {} is not supported, default to GENERIC device (WHERE={})", deviceType, where); if (where instanceof WhereZigBee) { diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetAuxiliaryHandler.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetAuxiliaryHandler.java new file mode 100644 index 0000000000000..75ab772b88471 --- /dev/null +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetAuxiliaryHandler.java @@ -0,0 +1,131 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.openwebnet.internal.handler; + +import static org.openhab.binding.openwebnet.internal.OpenWebNetBindingConstants.CHANNEL_AUX; + +import java.util.Set; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.binding.openwebnet.internal.OpenWebNetBindingConstants; +import org.openhab.core.library.types.StringType; +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.thing.ThingTypeUID; +import org.openhab.core.types.Command; +import org.openwebnet4j.communication.OWNException; +import org.openwebnet4j.message.Auxiliary; +import org.openwebnet4j.message.BaseOpenMessage; +import org.openwebnet4j.message.MalformedFrameException; +import org.openwebnet4j.message.OpenMessage; +import org.openwebnet4j.message.UnsupportedFrameException; +import org.openwebnet4j.message.Where; +import org.openwebnet4j.message.WhereAuxiliary; +import org.openwebnet4j.message.Who; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The {@link OpenWebNetAuxiliaryHandler} is responsible for sending Auxiliary (AUX) commands/messages to the bus + * It extends the abstract {@link OpenWebNetThingHandler}. + * + * NOTICE: Support for handling messages from the bus regarding alarm control has to be implemented + * + * @author Giovanni Fabiani - Initial contribution + * + */ +@NonNullByDefault +public class OpenWebNetAuxiliaryHandler extends OpenWebNetThingHandler { + + public static final Set SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.AUX_SUPPORTED_THING_TYPES; + private final Logger logger = LoggerFactory.getLogger(OpenWebNetAuxiliaryHandler.class); + + public OpenWebNetAuxiliaryHandler(Thing thing) { + super(thing); + } + + /** + * Handles Auxiliary command for a channel + * + * @param channel the channel + * @param command the Command + */ + @Override + protected void handleChannelCommand(ChannelUID channel, Command command) { + logger.debug("handleAuxiliaryCommand() (command={} - channel={})", command, channel); + Where w = deviceWhere; + if (w != null) { + if (channel.getId().equals(CHANNEL_AUX)) { + if (command instanceof StringType) { + try { + if (command.toString().equals(Auxiliary.WhatAuxiliary.ON.name())) { + send(Auxiliary.requestTurnOn(w.value())); + } else if (command.toString().equals(Auxiliary.WhatAuxiliary.OFF.name())) { + send(Auxiliary.requestTurnOff(w.value())); + } + } catch (OWNException e) { + logger.debug("Exception while processing command {}: {}", command, e.getMessage()); + } + } else { + logger.debug("Unsupported command {} for channel {}", command, channel); + } + } else { + logger.debug("Unsupported ChannelUID {}", channel); + } + } + } + + @Override + protected void requestChannelState(ChannelUID channel) { + /* + * NOTICE: It is not possible to get the state of a + * WHO=9 command. To get state of the Alarm system use WHO=5 instead + */ + + super.requestChannelState(channel); + Where w = deviceWhere; + if (w != null) { + try { + OpenMessage msg = BaseOpenMessage.parse("*#9##"); + // initializing + send(msg); + } catch (MalformedFrameException | UnsupportedFrameException | OWNException e) { + logger.debug("Exception while processing command: {}", e.getMessage()); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage()); + } + } + } + + @Override + protected void refreshDevice(boolean refreshAll) { + /* + * NOTICE: It is not possible to refresh the state of a + * WHO=9 command. To refresh the state of the Alarm system use WHO=5 instead + */ + + logger.debug("--- refreshDevice() : refreshing SINGLE... ({})", thing.getUID()); + requestChannelState(new ChannelUID(thing.getUID(), CHANNEL_AUX)); + } + + @Override + protected Where buildBusWhere(String wStr) throws IllegalArgumentException { + return new WhereAuxiliary(wStr); + } + + @Override + protected String ownIdPrefix() { + return Who.AUX.value().toString(); + } +} diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetBridgeHandler.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetBridgeHandler.java index f28de749ab064..f7c58014c9722 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetBridgeHandler.java +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetBridgeHandler.java @@ -49,6 +49,7 @@ import org.openwebnet4j.communication.OWNAuthException; import org.openwebnet4j.communication.OWNException; import org.openwebnet4j.message.Automation; +import org.openwebnet4j.message.Auxiliary; import org.openwebnet4j.message.BaseOpenMessage; import org.openwebnet4j.message.CEN; import org.openwebnet4j.message.EnergyManagement; @@ -497,7 +498,7 @@ public void onEventMessage(@Nullable OpenMessage msg) { BaseOpenMessage baseMsg = (BaseOpenMessage) msg; // let's try to get the Thing associated with this message... if (baseMsg instanceof Lighting || baseMsg instanceof Automation || baseMsg instanceof EnergyManagement - || baseMsg instanceof Thermoregulation || baseMsg instanceof CEN) { + || baseMsg instanceof Thermoregulation || baseMsg instanceof CEN || baseMsg instanceof Auxiliary) { String ownId = ownIdFromMessage(baseMsg); logger.debug("ownIdFromMessage({}) --> {}", baseMsg, ownId); OpenWebNetThingHandler deviceHandler = registeredDevices.get(ownId); diff --git a/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/BusAux.xml b/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/BusAux.xml new file mode 100644 index 0000000000000..afc30924b11d1 --- /dev/null +++ b/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/BusAux.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + A OpenWebNet BUS/SCS Auxiliary command + + + + + + + BTicino/Legrand + 272 + + + ownId + + + + + Example: Where=1 + + + + + diff --git a/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/channels.xml b/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/channels.xml index c8b91b615cfc0..698a7cc0d1c3d 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/channels.xml +++ b/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/channels.xml @@ -16,6 +16,29 @@ + + + + String + + Controls an Auxiliary command (read/write) + + + + + + + + + + + + + + + + + Dimmer diff --git a/bundles/org.openhab.binding.openwebnet/src/test/java/org/openhab/binding/openwebnet/internal/handler/OwnIdTest.java b/bundles/org.openhab.binding.openwebnet/src/test/java/org/openhab/binding/openwebnet/internal/handler/OwnIdTest.java index 3ed1724b8c7b8..87f02831ea954 100644 --- a/bundles/org.openhab.binding.openwebnet/src/test/java/org/openhab/binding/openwebnet/internal/handler/OwnIdTest.java +++ b/bundles/org.openhab.binding.openwebnet/src/test/java/org/openhab/binding/openwebnet/internal/handler/OwnIdTest.java @@ -22,6 +22,7 @@ import org.openwebnet4j.message.BaseOpenMessage; import org.openwebnet4j.message.FrameException; import org.openwebnet4j.message.Where; +import org.openwebnet4j.message.WhereAuxiliary; import org.openwebnet4j.message.WhereCEN; import org.openwebnet4j.message.WhereEnergyManagement; import org.openwebnet4j.message.WhereLightAutom; @@ -38,6 +39,7 @@ * * @author Massimo Valla - Initial contribution * @author Andrea Conte - Energy management + * @author Giovanni Fabiani - AAuxiliary message support */ @NonNullByDefault public class OwnIdTest { @@ -64,7 +66,7 @@ public class OwnIdTest { * BUS CEN 51 51 15.51 51 * BUS CEN+ 212 212 25.212 212 * BUS DryContact 399 399 25.399 399 - * + * BUS AUX 4 4 9.4 4 */ // @formatter:on @@ -83,7 +85,9 @@ public enum TEST { 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"); + bus_drycontact(new WhereCEN("399"), Who.fromValue(25), "*25*32#1*399##", "399", "25.399", "399"), + bus_aux(new WhereAuxiliary("4"), Who.fromValue(9), "*9*1*4##","4","9.4","4"); + // @formatter:on From 9d594469dffe717cc57d66bab0686a8e5654918e Mon Sep 17 00:00:00 2001 From: Mark Herwege Date: Mon, 9 May 2022 23:05:30 +0200 Subject: [PATCH 03/22] Correct error for long thing names (#12708) Signed-off-by: Mark Herwege --- .../elroconnects/internal/util/ElroConnectsUtil.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java b/bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java index 7fe252eef2108..8c6207a7f8b8e 100644 --- a/bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java +++ b/bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java @@ -46,8 +46,10 @@ public static int decode(int value, int msgId) { */ public static String encode(String input, int length) { byte[] bytes = input.getBytes(StandardCharsets.UTF_8); - String content = "@".repeat(length - bytes.length) + new String(bytes, StandardCharsets.UTF_8) + "$"; - bytes = content.getBytes(StandardCharsets.UTF_8); + String content = "@".repeat((length > bytes.length) ? (length - bytes.length) : 0) + + new String(bytes, StandardCharsets.UTF_8); + bytes = Arrays.copyOf(content.getBytes(StandardCharsets.UTF_8), length); + bytes[length] = (byte) "$".charAt(0); return HexUtils.bytesToHex(bytes); } From 97db8aa40716684e8fbd7225d46f68291ba50bb5 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Wed, 11 May 2022 22:00:44 +0200 Subject: [PATCH 04/22] Fix case for item-type tag value (channel definition) (#12713) Related to #12712 Signed-off-by: Laurent Garnier --- .../main/resources/OH-INF/thing/channels.xml | 2 +- .../resources/OH-INF/thing/thing-types.xml | 4 +-- .../main/resources/OH-INF/thing/partition.xml | 30 +++++++++---------- .../src/main/resources/OH-INF/thing/zone.xml | 4 +-- .../resources/OH-INF/thing/thing-types.xml | 4 +-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/bundles/org.openhab.binding.ihc/src/main/resources/OH-INF/thing/channels.xml b/bundles/org.openhab.binding.ihc/src/main/resources/OH-INF/thing/channels.xml index 393753736a5cb..63855284ec8dc 100644 --- a/bundles/org.openhab.binding.ihc/src/main/resources/OH-INF/thing/channels.xml +++ b/bundles/org.openhab.binding.ihc/src/main/resources/OH-INF/thing/channels.xml @@ -193,7 +193,7 @@ - RollerShutter + Rollershutter Generic roller shutter channel diff --git a/bundles/org.openhab.binding.ism8/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.ism8/src/main/resources/OH-INF/thing/thing-types.xml index ab020053913d5..477cf168a0412 100644 --- a/bundles/org.openhab.binding.ism8/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.ism8/src/main/resources/OH-INF/thing/thing-types.xml @@ -61,7 +61,7 @@ - number + Number @@ -87,7 +87,7 @@ - number + Number diff --git a/bundles/org.openhab.binding.paradoxalarm/src/main/resources/OH-INF/thing/partition.xml b/bundles/org.openhab.binding.paradoxalarm/src/main/resources/OH-INF/thing/partition.xml index 5276bb6cb8110..f5d1771eb604b 100644 --- a/bundles/org.openhab.binding.paradoxalarm/src/main/resources/OH-INF/thing/partition.xml +++ b/bundles/org.openhab.binding.paradoxalarm/src/main/resources/OH-INF/thing/partition.xml @@ -66,91 +66,91 @@ - switch + Switch Partition ready to arm - switch + Switch Partition in Exit Delay - switch + Switch Partition in Entry Delay - switch + Switch Partition in Trouble - switch + Switch Partition has Alarm in Memory - switch + Switch Partition has Zone Bypass - switch + Switch Partition has in Tamper Trouble - switch + Switch Partition has in Low Battery Trouble - switch + Switch Partition has in Fire Loop Trouble - switch + Switch Partition has in Supervision Trouble - switch + Switch Partition is Stay Instant Ready - switch + Switch Partition is Force Ready - switch + Switch Partition is Bypass Ready - switch + Switch Partition is Inhibit Ready - contact + Contact Partition has All Zones closed diff --git a/bundles/org.openhab.binding.paradoxalarm/src/main/resources/OH-INF/thing/zone.xml b/bundles/org.openhab.binding.paradoxalarm/src/main/resources/OH-INF/thing/zone.xml index e49683063287d..67c3b62fc1d0d 100644 --- a/bundles/org.openhab.binding.paradoxalarm/src/main/resources/OH-INF/thing/zone.xml +++ b/bundles/org.openhab.binding.paradoxalarm/src/main/resources/OH-INF/thing/zone.xml @@ -33,13 +33,13 @@ - contact + Contact State of zone - switch + Switch State of zone diff --git a/bundles/org.openhab.binding.souliss/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.souliss/src/main/resources/OH-INF/thing/thing-types.xml index f7fabd7000d21..151020d157077 100644 --- a/bundles/org.openhab.binding.souliss/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.souliss/src/main/resources/OH-INF/thing/thing-types.xml @@ -1097,7 +1097,7 @@ - RollerShutter + Rollershutter Rollershutter Up/Down Blinds @@ -1274,7 +1274,7 @@ - RollerShutter + Rollershutter Brightness Up/Down Light From cb27dc5e6861585247119f32b095f64957db362a Mon Sep 17 00:00:00 2001 From: lolodomo Date: Wed, 11 May 2022 22:02:06 +0200 Subject: [PATCH 05/22] [knx] Fix item-type value for channel type datetime-control (#12717) Related to #12712 Signed-off-by: Laurent Garnier --- .../src/main/resources/OH-INF/thing/device.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.knx/src/main/resources/OH-INF/thing/device.xml b/bundles/org.openhab.binding.knx/src/main/resources/OH-INF/thing/device.xml index 155185a285df8..352848c533de0 100644 --- a/bundles/org.openhab.binding.knx/src/main/resources/OH-INF/thing/device.xml +++ b/bundles/org.openhab.binding.knx/src/main/resources/OH-INF/thing/device.xml @@ -142,7 +142,7 @@ - DateTime Control + DateTime Control a date/time item (i.e. the status is not owned by KNX) From 01006b73aaa1515bc6d598d130929320fd6f5449 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Wed, 11 May 2022 22:03:11 +0200 Subject: [PATCH 06/22] [automower] Fix item-type value for channel type positionType (#12714) Related to #12712 Signed-off-by: Laurent Garnier --- .../src/main/resources/OH-INF/thing/thing-types.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.automower/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.automower/src/main/resources/OH-INF/thing/thing-types.xml index 087e7691c8f8d..5edae121a4fba 100644 --- a/bundles/org.openhab.binding.automower/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.automower/src/main/resources/OH-INF/thing/thing-types.xml @@ -260,7 +260,7 @@ - Point + Location The channel providing a waypoint of the mower's activity. From 96323f91ab412ff8c44a735156767f72fdfe1077 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Wed, 11 May 2022 22:03:44 +0200 Subject: [PATCH 07/22] [lutron] Fix item-type tag value for channel type buttonpress (#12715) Related to #12712 Signed-off-by: Laurent Garnier --- .../src/main/resources/OH-INF/thing/thing-types.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.lutron/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.lutron/src/main/resources/OH-INF/thing/thing-types.xml index d5d40b6ae8700..2fbc0b8df2b01 100644 --- a/bundles/org.openhab.binding.lutron/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.lutron/src/main/resources/OH-INF/thing/thing-types.xml @@ -1378,7 +1378,7 @@ - Text + String Last button pressed From 7364e69fd231789b6b49f90a3d5a73e049f47390 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Wed, 11 May 2022 22:05:54 +0200 Subject: [PATCH 08/22] [oceanic] Fix item-type value for channel types reserve and flow (#12716) Related to #12712 Signed-off-by: Laurent Garnier --- .../src/main/resources/OH-INF/thing/channel-types.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.oceanic/src/main/resources/OH-INF/thing/channel-types.xml b/bundles/org.openhab.binding.oceanic/src/main/resources/OH-INF/thing/channel-types.xml index b64d32099fe6f..47c04a37626d1 100644 --- a/bundles/org.openhab.binding.oceanic/src/main/resources/OH-INF/thing/channel-types.xml +++ b/bundles/org.openhab.binding.oceanic/src/main/resources/OH-INF/thing/channel-types.xml @@ -19,13 +19,13 @@ - Decimal + Number Flow in l/min - Decimal + Number Water reserve in l before regeneration has to start From 47418606c6432cc6751515a51e240a3066389584 Mon Sep 17 00:00:00 2001 From: Daniel Lienert Date: Thu, 12 May 2022 07:40:48 +0200 Subject: [PATCH 09/22] DOCS: Add missing bracket (#12722) --- bundles/org.openhab.automation.jsscripting/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.automation.jsscripting/README.md b/bundles/org.openhab.automation.jsscripting/README.md index 4055a4c214878..003858ce00eec 100644 --- a/bundles/org.openhab.automation.jsscripting/README.md +++ b/bundles/org.openhab.automation.jsscripting/README.md @@ -611,7 +611,7 @@ Additionally all the above triggers have the following functions: //Basic rule, when the BedroomLight1 is changed, run a custom function rules.when().item('BedroomLight1').changed().then(e => { console.log("BedroomLight1 state", e.newState) -}.build(); +}).build(); //turn on the kitchen light at SUNSET rules.when().timeOfDay("SUNSET").then().sendOn().toItem("KitchenLight").build("Sunset Rule","turn on the kitchen light From 9c0541c2c937794e3434329fc4adf4e436dc2000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Matu=C5=A1ka?= Date: Thu, 12 May 2022 07:45:20 +0200 Subject: [PATCH 10/22] Update README.md (#12707) Mention that Sinclair devices using the Gree protocol are supported as well (EWPE smart). --- bundles/org.openhab.binding.gree/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.binding.gree/README.md b/bundles/org.openhab.binding.gree/README.md index 76af7d0de807b..f0c9faf2c6f8a 100644 --- a/bundles/org.openhab.binding.gree/README.md +++ b/bundles/org.openhab.binding.gree/README.md @@ -1,8 +1,8 @@ # GREE Binding -This binding integrates GREE Air Conditioners. +This binding integrates Air Conditioners that use the GREE protocol (GREE, Sinclair and others). -Note: The GREE Air Conditioner must already be setup on the WiFi network and must have a fixed IP Address. +Note: The Air Conditioner must already be set-up on the WiFi network and must have a fixed IP Address. ## Supported Things @@ -10,7 +10,7 @@ This binding supports one Thing type `airconditioner`. ## Discovery -Once the GREE is on the network (WiFi active) it could be discovery automatically. +Once the Air Conditioner is on the network (WiFi active) it could be discovered automatically. An IP broadcast message is sent and every responding unit gets added to the Inbox. ## Binding Configuration From 2e1fbdd86f17a912149ecfc55dd9f6efc6fae41b Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Thu, 12 May 2022 19:31:45 +0200 Subject: [PATCH 11/22] [evcc] Initial contribution (#12611) Signed-off-by: Florian Hotze --- CODEOWNERS | 1 + bom/openhab-addons/pom.xml | 5 + bundles/org.openhab.binding.evcc/NOTICE | 13 + bundles/org.openhab.binding.evcc/README.md | 171 +++++++ bundles/org.openhab.binding.evcc/pom.xml | 17 + .../src/main/feature/feature.xml | 9 + .../evcc/internal/EvccBindingConstants.java | 131 +++++ .../evcc/internal/EvccConfiguration.java | 34 ++ .../binding/evcc/internal/EvccHandler.java | 448 ++++++++++++++++++ .../evcc/internal/EvccHandlerFactory.java | 55 +++ .../binding/evcc/internal/api/EvccAPI.java | 122 +++++ .../evcc/internal/api/EvccApiException.java | 34 ++ .../evcc/internal/api/dto/Loadpoint.java | 316 ++++++++++++ .../binding/evcc/internal/api/dto/Result.java | 140 ++++++ .../binding/evcc/internal/api/dto/Status.java | 31 ++ .../main/resources/OH-INF/binding/binding.xml | 9 + .../resources/OH-INF/i18n/evcc.properties | 111 +++++ .../resources/OH-INF/i18n/evcc_de.properties | 111 +++++ .../resources/OH-INF/thing/thing-types.xml | 327 +++++++++++++ bundles/pom.xml | 1 + 20 files changed, 2086 insertions(+) create mode 100644 bundles/org.openhab.binding.evcc/NOTICE create mode 100644 bundles/org.openhab.binding.evcc/README.md create mode 100644 bundles/org.openhab.binding.evcc/pom.xml create mode 100644 bundles/org.openhab.binding.evcc/src/main/feature/feature.xml create mode 100644 bundles/org.openhab.binding.evcc/src/main/java/org/openhab/binding/evcc/internal/EvccBindingConstants.java create mode 100644 bundles/org.openhab.binding.evcc/src/main/java/org/openhab/binding/evcc/internal/EvccConfiguration.java create mode 100644 bundles/org.openhab.binding.evcc/src/main/java/org/openhab/binding/evcc/internal/EvccHandler.java create mode 100644 bundles/org.openhab.binding.evcc/src/main/java/org/openhab/binding/evcc/internal/EvccHandlerFactory.java create mode 100644 bundles/org.openhab.binding.evcc/src/main/java/org/openhab/binding/evcc/internal/api/EvccAPI.java create mode 100644 bundles/org.openhab.binding.evcc/src/main/java/org/openhab/binding/evcc/internal/api/EvccApiException.java create mode 100644 bundles/org.openhab.binding.evcc/src/main/java/org/openhab/binding/evcc/internal/api/dto/Loadpoint.java create mode 100644 bundles/org.openhab.binding.evcc/src/main/java/org/openhab/binding/evcc/internal/api/dto/Result.java create mode 100644 bundles/org.openhab.binding.evcc/src/main/java/org/openhab/binding/evcc/internal/api/dto/Status.java create mode 100644 bundles/org.openhab.binding.evcc/src/main/resources/OH-INF/binding/binding.xml create mode 100644 bundles/org.openhab.binding.evcc/src/main/resources/OH-INF/i18n/evcc.properties create mode 100644 bundles/org.openhab.binding.evcc/src/main/resources/OH-INF/i18n/evcc_de.properties create mode 100644 bundles/org.openhab.binding.evcc/src/main/resources/OH-INF/thing/thing-types.xml diff --git a/CODEOWNERS b/CODEOWNERS index 07176c0424207..110ba738a9b8e 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -90,6 +90,7 @@ /bundles/org.openhab.binding.enturno/ @klocsson /bundles/org.openhab.binding.epsonprojector/ @mlobstein /bundles/org.openhab.binding.etherrain/ @dfad1469 +/bundles/org.openhab.binding.evcc/ @florian-h05 /bundles/org.openhab.binding.evohome/ @Nebula83 /bundles/org.openhab.binding.exec/ @kgoderis /bundles/org.openhab.binding.feed/ @svilenvul diff --git a/bom/openhab-addons/pom.xml b/bom/openhab-addons/pom.xml index e4b65e93f8293..3218cb7841bdf 100644 --- a/bom/openhab-addons/pom.xml +++ b/bom/openhab-addons/pom.xml @@ -441,6 +441,11 @@ org.openhab.binding.etherrain ${project.version} + + org.openhab.addons.bundles + org.openhab.binding.evcc + ${project.version} + org.openhab.addons.bundles org.openhab.binding.evohome diff --git a/bundles/org.openhab.binding.evcc/NOTICE b/bundles/org.openhab.binding.evcc/NOTICE new file mode 100644 index 0000000000000..38d625e349232 --- /dev/null +++ b/bundles/org.openhab.binding.evcc/NOTICE @@ -0,0 +1,13 @@ +This content is produced and maintained by the openHAB project. + +* Project home: https://www.openhab.org + +== Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License 2.0 which is available at +https://www.eclipse.org/legal/epl-2.0/. + +== Source Code + +https://github.com/openhab/openhab-addons diff --git a/bundles/org.openhab.binding.evcc/README.md b/bundles/org.openhab.binding.evcc/README.md new file mode 100644 index 0000000000000..8b83a6d3b5bac --- /dev/null +++ b/bundles/org.openhab.binding.evcc/README.md @@ -0,0 +1,171 @@ +# evcc Binding + +This binding integrates [evcc - electric vehicle charging control](https://evcc.io), a project that provides a control center for electric vehicle charging. + +evcc controls your wallbox(es) with multiple charging modes and allows you to charge your ev with your photovoltaik's excess current. +To provide an intelligent charging control, evcc supports over 30 wallboxes and over 20 energy meters/home energy management systems from many manufacturers as well as electric vehicles from over 20 car manufacturers. +Furthermore, evcc calculates your money savings. + +This binding enables openHAB to retrieve status data from your evcc installation and to control the charging process. +For more advanced features like calculated savings, you have to visit the web UI of evcc. + +## Supported Things + +- `device`: A running evcc installation. + +## Discovery + +No auto discovery supported. + +## Thing Configuration + +### `device` Thing Configuration + +| Parameter | Type | Description | Advanced | Required | +|-----------------|--------|----------------------------------------------------------|----------|----------| +| url | String | URL of evcc web UI, e.g. *https://demo.evcc.io* | No | Yes | +| refreshInterval | Number | Interval the status is polled in seconds (minimum is 15) | Yes | No | + +Default value for *refreshInterval* is 60 seconds. + +## Channels + +### General channels + +Those channels exist only once. +Please note that some of them are only available when evcc is properly configured. + +| Channel | Type | Read/Write | Description | +|----------------------------|----------------------|------------|--------------------------------------------------------------------------------------------------------------| +| general#batteryPower | Number:Power | R | Current power from battery. | +| general#batterySoC | Number:Dimensionless | R | Current State of Charge of battery. | +| general#batteryPrioritySoC | Number:Dimensionless | R | State of State of Charge for which the battery has priority over charging the ev when charging mode is "pv". | +| general#gridPower | Number:Power | R | Current power from grid (negative means feed-in) | +| general#homePower | Number:Power | R | Current power taken by home. | +| general#pvPower | Number:Power | R | Current power from photovoltaik. | + + +### Loadpoint channels + +Those channels exist per configured loadpoint. +Please note that you have to replace *N* with your loadpoint number. + +| Channel | Type | Read/Write | Description | +|-------------------------------------|------------------------|------------|-----------------------------------------------------------------------------------------------------| +| loadpointN#activePhases | Number | R | Current number of active phases while charging | +| loadpointN#chargeCurrent | Number:ElectricCurrent | R | Current amperage per connected phase while charging | +| loadpointN#chargeDuration | Number:Time | R | Charging duration | +| loadpointN#chargeRemainingDuration | Number:Time | R | Remaining duration until target SoC is reached | +| loadpointN#chargeRemainingEnergy | Number:Energy | R | Remaining energy until target SoC is reached | +| loadpointN#chargePower | Number:Power | R | Current power of charging | +| loadpointN#chargedEnergy | Number:Energy | R | Energy charged since plugged-in | +| loadpointN#charging | Switch | R | Loadpoint is currently charging | +| loadpointN#enabled | Switch | R | Charging enabled (mode is not "off") | +| loadpointN#hasVehicle | Switch | R | Whether vehicle is configured for loadpoint | +| loadpointN#maxCurrent | Number:ElectricCurrent | RW | Maximum amperage per connected phase with which the car should be charged | +| loadpointN#minCurrent | Number:ElectricCurrent | RW | Minimum amperage per connected phase with which the car should be charged | +| loadpointN#minSoC | Number:Dimensionless | RW | Charge immediately with maximum power up to the defined SoC, if the charge mode is not set to "off" | +| loadpointN#mode | String | RW | Charging mode: "off", "now", "minpv", "pv" | +| loadpointN#phases | Number | RW | The maximum number of phases which can be used | +| loadpointN#targetSoC | Number:Dimensionless | RW | Until which state of charge (SoC) should the vehicle be charged | +| loadpointN#targetTime | DateTime | RW | When the target SoC should be reached | +| loadpointN#targetTimeEnabled | Switch | RW | Target time for charging enabled | +| loadpointN#title | String | R | Title of loadpoint | +| loadpointN#vehicleConnected | Switch | R | Whether vehicle is connected to loadpoint | +| loadpointN#vehicleConnectedDuration | Number:Time | R | Duration the vehicle is connected to loadpoint | +| loadpointN#vehicleCapacity | Number:Energy | R | Capacity of EV battery | +| loadpointN#vehicleOdometer | Number:Length | R | Total distance travelled by EV | +| loadpointN#vehiclePresent | Switch | R | Whether evcc is able to get data from vehicle | +| loadpointN#vehicleRange | Number:Length | R | Battery range for EV | +| loadpointN#vehicleSoC | Number:Dimensionless | R | Current State of Charge of EV | +| loadpointN#vehicleTitle | String | R | Name of EV | + +## Full Example + +### Thing(s) + +``` +Thing evcc:device:demo "evcc Demo" [url="https://demo.evcc.io", refreshInterval=60] +``` + +### Items + +``` +// General +Number:Power evcc_demo_batteryPower "Battery Power [%.1f kW]" {channel="evcc:device:demo:general#batteryPower"} +Number:Dimensionless evcc_demo_batterySoC "Battery SoC [%d %%]" {channel="evcc:device:demo:general#batterySoC"} +Number:Dimensionless evcc_demo_batteryPrioritySoC "Battery Priority SoC [%d %%]" {channel="evcc:device:demo:general#batteryPrioritySoC"} +Number:Power evcc_demo_gridPower "Grid Power [%.1f kW]" {channel="evcc:device:demo:general#gridPower"} +Number:Power evcc_demo_homePower "Home Power [%.1f kW]" {channel="evcc:device:demo:general#homePower"} +Number:Power evcc_demo_pvPower "PV Power [%.1f kW]" {channel="evcc:device:demo:general#pvPower"} + +// Loadpoint +Number evcc_demo_loadpoint0_activePhases "Active Phases [%d]" {channel="evcc:device:demo:loadpoint0#activePhases"} +Number:ElectricCurrent evcc_demo_loadpoint0_chargeCurrent "Charging current [%.0f A]" {channel="evcc:device:demo:loadpoint0#chargeCurrent"} +Number:Time evcc_demo_loadpoint0_chargeDuration "Charging duration [%1$tH:%1$tM]"