2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.mielecloud.internal.handler;
15 import static org.openhab.binding.mielecloud.internal.MieleCloudBindingConstants.Channels.*;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.mielecloud.internal.handler.channel.ActionsChannelState;
19 import org.openhab.binding.mielecloud.internal.handler.channel.DeviceChannelState;
20 import org.openhab.binding.mielecloud.internal.handler.channel.TransitionChannelState;
21 import org.openhab.core.library.types.OnOffType;
22 import org.openhab.core.thing.Thing;
25 * ThingHandler implementation for the Miele wine storage devices.
27 * @author Roland Edelhoff - Initial contribution
28 * @author Björn Lange - Add channel state wrappers
29 * @author Benjamin Bolte - Add info state channel and map signal flags from API
32 public class WineStorageDeviceThingHandler extends AbstractMieleThingHandler {
34 * Creates a new {@link WineStorageDeviceThingHandler}.
36 * @param thing The thing to handle.
38 public WineStorageDeviceThingHandler(Thing thing) {
43 public void initialize() {
45 updateState(channel(REMOTE_CONTROL_CAN_BE_STARTED), OnOffType.OFF);
46 updateState(channel(REMOTE_CONTROL_CAN_BE_STOPPED), OnOffType.OFF);
50 protected void updateDeviceState(DeviceChannelState device) {
51 updateState(channel(OPERATION_STATE), device.getOperationState());
52 updateState(channel(OPERATION_STATE_RAW), device.getOperationStateRaw());
53 updateState(channel(TEMPERATURE_TARGET), device.getWineTemperatureTarget());
54 updateState(channel(TEMPERATURE_CURRENT), device.getWineTemperatureCurrent());
55 updateState(channel(TOP_TEMPERATURE_TARGET), device.getWineTopTemperatureTarget());
56 updateState(channel(TOP_TEMPERATURE_CURRENT), device.getWineTopTemperatureCurrent());
57 updateState(channel(MIDDLE_TEMPERATURE_TARGET), device.getWineMiddleTemperatureTarget());
58 updateState(channel(MIDDLE_TEMPERATURE_CURRENT), device.getWineMiddleTemperatureCurrent());
59 updateState(channel(BOTTOM_TEMPERATURE_TARGET), device.getWineBottomTemperatureTarget());
60 updateState(channel(BOTTOM_TEMPERATURE_CURRENT), device.getWineBottomTemperatureCurrent());
61 updateState(channel(POWER_ON_OFF), device.getPowerOnOff());
62 updateState(channel(ERROR_STATE), device.getErrorState());
63 updateState(channel(INFO_STATE), device.getInfoState());
67 protected void updateTransitionState(TransitionChannelState transition) {
71 protected void updateActionState(ActionsChannelState actions) {
72 updateState(channel(REMOTE_CONTROL_CAN_BE_SWITCHED_ON), actions.getRemoteControlCanBeSwitchedOn());
73 updateState(channel(REMOTE_CONTROL_CAN_BE_SWITCHED_OFF), actions.getRemoteControlCanBeSwitchedOff());