]> git.basschouten.com Git - openhab-addons.git/blob
b3c735fdf8c527c8f026ef98ccb75f42964d8af8
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.mielecloud.internal.handler;
14
15 import static org.openhab.binding.mielecloud.internal.MieleCloudBindingConstants.Channels.*;
16
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.thing.Thing;
22
23 /**
24  * ThingHandler implementation for the Miele hob devices.
25  *
26  * @author Roland Edelhoff - Initial contribution
27  * @author Björn Lange - Add channel state wrappers
28  * @author Benjamin Bolte - Add plate step, add info state channel and map signal flags from API
29  */
30 @NonNullByDefault
31 public class HobDeviceThingHandler extends AbstractMieleThingHandler {
32     /**
33      * Creates a new {@link HobDeviceThingHandler}.
34      *
35      * @param thing The thing to handle.
36      */
37     public HobDeviceThingHandler(Thing thing) {
38         super(thing);
39     }
40
41     @Override
42     protected void updateDeviceState(DeviceChannelState device) {
43         updateState(channel(OPERATION_STATE), device.getOperationState());
44         updateState(channel(OPERATION_STATE_RAW), device.getOperationStateRaw());
45         updateState(channel(ERROR_STATE), device.getErrorState());
46         updateState(channel(INFO_STATE), device.getInfoState());
47         updateState(channel(PLATE_1_POWER_STEP), device.getPlateStep(0));
48         updateState(channel(PLATE_1_POWER_STEP_RAW), device.getPlateStepRaw(0));
49         updateState(channel(PLATE_2_POWER_STEP), device.getPlateStep(1));
50         updateState(channel(PLATE_2_POWER_STEP_RAW), device.getPlateStepRaw(1));
51         updateState(channel(PLATE_3_POWER_STEP), device.getPlateStep(2));
52         updateState(channel(PLATE_3_POWER_STEP_RAW), device.getPlateStepRaw(2));
53         updateState(channel(PLATE_4_POWER_STEP), device.getPlateStep(3));
54         updateState(channel(PLATE_4_POWER_STEP_RAW), device.getPlateStepRaw(3));
55         updateState(channel(PLATE_5_POWER_STEP), device.getPlateStep(4));
56         updateState(channel(PLATE_5_POWER_STEP_RAW), device.getPlateStepRaw(4));
57         updateState(channel(PLATE_6_POWER_STEP), device.getPlateStep(5));
58         updateState(channel(PLATE_6_POWER_STEP_RAW), device.getPlateStepRaw(5));
59     }
60
61     @Override
62     protected void updateTransitionState(TransitionChannelState transition) {
63         // No state transition required
64     }
65
66     @Override
67     protected void updateActionState(ActionsChannelState actions) {
68         // The Hob device has no trigger actions
69     }
70 }