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.*;
17 import java.util.List;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.boschshc.internal.devices.AbstractBatteryPoweredDeviceHandler;
21 import org.openhab.binding.boschshc.internal.exceptions.BoschSHCException;
22 import org.openhab.binding.boschshc.internal.services.humiditylevel.HumidityLevelService;
23 import org.openhab.binding.boschshc.internal.services.humiditylevel.dto.HumidityLevelServiceState;
24 import org.openhab.binding.boschshc.internal.services.temperaturelevel.TemperatureLevelService;
25 import org.openhab.binding.boschshc.internal.services.temperaturelevel.dto.TemperatureLevelServiceState;
26 import org.openhab.core.thing.Thing;
29 * Handler for a wall thermostat device.
31 * @author Christian Oeing - Initial contribution
34 public final class WallThermostatHandler extends AbstractBatteryPoweredDeviceHandler {
36 public WallThermostatHandler(Thing thing) {
41 protected void initializeServices() throws BoschSHCException {
42 super.initializeServices();
44 this.createService(TemperatureLevelService::new, this::updateChannels, List.of(CHANNEL_TEMPERATURE));
45 this.createService(HumidityLevelService::new, this::updateChannels, List.of(CHANNEL_HUMIDITY));
49 * Updates the channels which are linked to the {@link TemperatureLevelService} of the device.
51 * @param state Current state of {@link TemperatureLevelService}.
53 private void updateChannels(TemperatureLevelServiceState state) {
54 super.updateState(CHANNEL_TEMPERATURE, state.getTemperatureState());
58 * Updates the channels which are linked to the {@link HumidityLevelService} of the device.
60 * @param state Current state of {@link HumidityLevelService}.
62 private void updateChannels(HumidityLevelServiceState state) {
63 super.updateState(CHANNEL_HUMIDITY, state.getHumidityState());