2 * Copyright (c) 2010-2022 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.boschshc.internal.devices.wallthermostat;
15 import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.CHANNEL_HUMIDITY;
16 import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.CHANNEL_TEMPERATURE;
18 import java.util.List;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.openhab.binding.boschshc.internal.devices.BoschSHCDeviceHandler;
22 import org.openhab.binding.boschshc.internal.exceptions.BoschSHCException;
23 import org.openhab.binding.boschshc.internal.services.humiditylevel.HumidityLevelService;
24 import org.openhab.binding.boschshc.internal.services.humiditylevel.dto.HumidityLevelServiceState;
25 import org.openhab.binding.boschshc.internal.services.temperaturelevel.TemperatureLevelService;
26 import org.openhab.binding.boschshc.internal.services.temperaturelevel.dto.TemperatureLevelServiceState;
27 import org.openhab.core.thing.Thing;
30 * Handler for a wall thermostat device.
32 * @author Christian Oeing - Initial contribution
35 public final class WallThermostatHandler extends BoschSHCDeviceHandler {
37 public WallThermostatHandler(Thing thing) {
42 protected void initializeServices() throws BoschSHCException {
43 this.createService(TemperatureLevelService::new, this::updateChannels, List.of(CHANNEL_TEMPERATURE));
44 this.createService(HumidityLevelService::new, this::updateChannels, List.of(CHANNEL_HUMIDITY));
48 * Updates the channels which are linked to the {@link TemperatureLevelService} of the device.
50 * @param state Current state of {@link TemperatureLevelService}.
52 private void updateChannels(TemperatureLevelServiceState state) {
53 super.updateState(CHANNEL_TEMPERATURE, state.getTemperatureState());
57 * Updates the channels which are linked to the {@link HumidityLevelService} of the device.
59 * @param state Current state of {@link HumidityLevelService}.
61 private void updateChannels(HumidityLevelServiceState state) {
62 super.updateState(CHANNEL_HUMIDITY, state.getHumidityState());