diff --git a/bundles/org.openhab.binding.livisismarthome/README.md b/bundles/org.openhab.binding.livisismarthome/README.md
index 26030a9c03f33..dff62dea5fd11 100644
--- a/bundles/org.openhab.binding.livisismarthome/README.md
+++ b/bundles/org.openhab.binding.livisismarthome/README.md
@@ -93,6 +93,7 @@ However, only devices will appear that are added in the LIVISI SmartHome app bef
| moldWarning | Switch | Active, if the measured humidity is too low (ON/OFF) | RST, RST2, WRT |
| motionCount | Number | Number of detected motions, increases with each detected motion | WMD, WMDO |
| operationMode | String | The mode of a thermostat (auto/manual) | RST, RST2, WRT |
+| restart | Switch | Restarts the device (stateless switch) | SHC (bridge) |
| rollershutter | Rollershutter | Controls a roller shutter | ISR2 |
| targetTemperature | Number | Sets the target temperature in °C (min 6 °C, max 30 °C) | RST, RST2, WRT |
| siren | Switch | Switches the siren (ON/OFF) | SIR |
diff --git a/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/LivisiBindingConstants.java b/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/LivisiBindingConstants.java
index ad83eef22ddce..0ccd27883ed54 100644
--- a/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/LivisiBindingConstants.java
+++ b/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/LivisiBindingConstants.java
@@ -184,6 +184,7 @@ public class LivisiBindingConstants {
public static final String CHANNEL_DISK = "disk";
public static final String CHANNEL_MEMORY = "memory";
public static final String CHANNEL_OPERATION_STATUS = "status";
+ public static final String CHANNEL_RESTART = "restart";
// List of channel parameters
public static final String INVERT_CHANNEL_PARAMETER = "invert";
diff --git a/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/client/LivisiClient.java b/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/client/LivisiClient.java
index a2275dec13c3a..4cd049a189ae4 100644
--- a/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/client/LivisiClient.java
+++ b/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/client/LivisiClient.java
@@ -33,6 +33,7 @@
import org.openhab.binding.livisismarthome.internal.LivisiBindingConstants;
import org.openhab.binding.livisismarthome.internal.client.api.entity.StatusResponseDTO;
import org.openhab.binding.livisismarthome.internal.client.api.entity.action.ActionDTO;
+import org.openhab.binding.livisismarthome.internal.client.api.entity.action.RestartActionDTO;
import org.openhab.binding.livisismarthome.internal.client.api.entity.action.ShutterActionDTO;
import org.openhab.binding.livisismarthome.internal.client.api.entity.action.ShutterActionType;
import org.openhab.binding.livisismarthome.internal.client.api.entity.action.StateActionSetterDTO;
@@ -265,6 +266,15 @@ public void setRollerShutterAction(final String capabilityId, final ShutterActio
executePost(createActionURL(), new ShutterActionDTO(capabilityId, rollerShutterAction));
}
+ /**
+ * Restarts the SHC (bridge) device
+ */
+ public void setRestartAction(@Nullable final String bridgeDeviceId) throws IOException {
+ if (bridgeDeviceId != null) {
+ executePost(createActionURL(), new RestartActionDTO(bridgeDeviceId));
+ }
+ }
+
/**
* Sets a new state of a VariableActuator.
*/
diff --git a/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/client/api/entity/action/ActionParamsDTO.java b/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/client/api/entity/action/ActionParamsDTO.java
index cd6d40cd76aeb..186993a985598 100644
--- a/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/client/api/entity/action/ActionParamsDTO.java
+++ b/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/client/api/entity/action/ActionParamsDTO.java
@@ -29,6 +29,7 @@ public class ActionParamsDTO {
private StringActionParamDTO operationMode;
private StringActionParamDTO rampDirection;
private StringActionParamDTO activeChannel;
+ private StringActionParamDTO reason;
/**
* @return the onState
@@ -141,4 +142,18 @@ public StringActionParamDTO getActiveChannel() {
public void setActiveChannel(StringActionParamDTO activeChannel) {
this.activeChannel = activeChannel;
}
+
+ /**
+ * @return the reason (for example the reason to restart the controller)
+ */
+ public StringActionParamDTO getReason() {
+ return reason;
+ }
+
+ /**
+ * @param reason the reason (for example the reason to restart the controller)
+ */
+ public void setReason(StringActionParamDTO reason) {
+ this.reason = reason;
+ }
}
diff --git a/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/client/api/entity/action/RestartActionDTO.java b/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/client/api/entity/action/RestartActionDTO.java
new file mode 100644
index 0000000000000..f086ffb7a5b0e
--- /dev/null
+++ b/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/client/api/entity/action/RestartActionDTO.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright (c) 2010-2024 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.livisismarthome.internal.client.api.entity.action;
+
+import org.openhab.binding.livisismarthome.internal.client.api.entity.link.LinkDTO;
+
+/**
+ * Special {@link ActionDTO} to execute a restart.
+ *
+ * @author Sven Strohschein - Initial contribution
+ */
+public class RestartActionDTO extends ActionDTO {
+
+ private static final String ACTION_TYPE_RESTART = "Restart";
+ private static final String CONSTANT = "Constant";
+ private static final String DEFAULT_RESTART_REASON = "The openHAB binding requested to restart the smart home controller.";
+
+ public RestartActionDTO(String deviceId) {
+ setType(ACTION_TYPE_RESTART);
+ setTarget(LinkDTO.LINK_TYPE_DEVICE + deviceId);
+
+ final ActionParamsDTO params = new ActionParamsDTO();
+ params.setReason(new StringActionParamDTO(CONSTANT, DEFAULT_RESTART_REASON));
+ setParams(params);
+ }
+}
diff --git a/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/handler/LivisiBridgeHandler.java b/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/handler/LivisiBridgeHandler.java
index 3df6053788ac7..3c08eaf4f10fd 100644
--- a/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/handler/LivisiBridgeHandler.java
+++ b/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/handler/LivisiBridgeHandler.java
@@ -67,6 +67,7 @@
import org.openhab.core.auth.client.oauth2.OAuthException;
import org.openhab.core.auth.client.oauth2.OAuthFactory;
import org.openhab.core.auth.client.oauth2.OAuthResponseException;
+import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.types.StringType;
import org.openhab.core.library.unit.Units;
@@ -132,7 +133,17 @@ public LivisiBridgeHandler(final Bridge bridge, final OAuthFactory oAuthFactory,
@Override
public void handleCommand(final ChannelUID channelUID, final Command command) {
- // not needed
+ if (CHANNEL_RESTART.equals(channelUID.getId())) {
+ commandRestart(command);
+ } else {
+ logger.debug("UNSUPPORTED channel {} for bridge {}.", channelUID.getId(), bridgeId);
+ }
+ }
+
+ private void commandRestart(Command command) {
+ if (OnOffType.ON.equals(command)) {
+ commandRestart();
+ }
}
@Override
@@ -821,6 +832,19 @@ public void commandSetRollerShutterStop(final String deviceId, final ShutterActi
(capabilityId) -> client.setRollerShutterAction(capabilityId, action));
}
+ /**
+ * Restarts the SHC (bridge) device
+ */
+ public void commandRestart() {
+ try {
+ client.setRestartAction(bridgeId);
+
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "Restarting...");
+ } catch (IOException e) {
+ handleClientException(e);
+ }
+ }
+
private void executeCommand(final String deviceId, final String capabilityType,
final CommandExecutor commandExecutor) {
try {
diff --git a/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/handler/LivisiDeviceHandler.java b/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/handler/LivisiDeviceHandler.java
index bac5a2693c5ec..4412e6b285d57 100644
--- a/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/handler/LivisiDeviceHandler.java
+++ b/bundles/org.openhab.binding.livisismarthome/src/main/java/org/openhab/binding/livisismarthome/internal/handler/LivisiDeviceHandler.java
@@ -225,7 +225,7 @@ private void commandSwitchAlarm(Command command, LivisiBridgeHandler bridgeHandl
}
private void commandSwitchSiren(Command command, String notificationSound, LivisiBridgeHandler bridgeHandler) {
- if (command instanceof OnOffType && OnOffType.ON.equals(command)) {
+ if (OnOffType.ON.equals(command)) {
bridgeHandler.commandSwitchSiren(deviceId, notificationSound);
} else {
bridgeHandler.commandSwitchSiren(deviceId, SIREN_NONE);
diff --git a/bundles/org.openhab.binding.livisismarthome/src/main/resources/OH-INF/i18n/livisismarthome.properties b/bundles/org.openhab.binding.livisismarthome/src/main/resources/OH-INF/i18n/livisismarthome.properties
index 71618fd703310..ac55affa22040 100644
--- a/bundles/org.openhab.binding.livisismarthome/src/main/resources/OH-INF/i18n/livisismarthome.properties
+++ b/bundles/org.openhab.binding.livisismarthome/src/main/resources/OH-INF/i18n/livisismarthome.properties
@@ -128,6 +128,8 @@ channel-type.livisismarthome.powerGenerationWatt.label = Current Power Generatio
channel-type.livisismarthome.powerGenerationWatt.description = The current power generation (Watt)
channel-type.livisismarthome.pushButtonCounter.label = Button Pushed Count
channel-type.livisismarthome.pushButtonCounter.description = The count of button pushes.
+channel-type.livisismarthome.restartAction.label = Restart
+channel-type.livisismarthome.restartAction.description = Restarts the device
channel-type.livisismarthome.rollerShutterActuator.label = Blinds Position
channel-type.livisismarthome.rollerShutterActuator.description = Controls the blinds (percent)
channel-type.livisismarthome.smokeDetectorSensor.label = Smoke
diff --git a/bundles/org.openhab.binding.livisismarthome/src/main/resources/OH-INF/thing/bridge.xml b/bundles/org.openhab.binding.livisismarthome/src/main/resources/OH-INF/thing/bridge.xml
index 27f5281d1845b..09f3424f1a839 100644
--- a/bundles/org.openhab.binding.livisismarthome/src/main/resources/OH-INF/thing/bridge.xml
+++ b/bundles/org.openhab.binding.livisismarthome/src/main/resources/OH-INF/thing/bridge.xml
@@ -13,6 +13,7 @@
+
id
diff --git a/bundles/org.openhab.binding.livisismarthome/src/main/resources/OH-INF/thing/channels.xml b/bundles/org.openhab.binding.livisismarthome/src/main/resources/OH-INF/thing/channels.xml
index be98f1f701cf3..c3ab274c947a3 100644
--- a/bundles/org.openhab.binding.livisismarthome/src/main/resources/OH-INF/thing/channels.xml
+++ b/bundles/org.openhab.binding.livisismarthome/src/main/resources/OH-INF/thing/channels.xml
@@ -389,4 +389,13 @@
+
+
+ Switch
+
+ Restarts the device
+ Switch
+ veto
+
+