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.somfytahoma.internal.handler;
15 import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.core.library.types.StringType;
19 import org.openhab.core.thing.ChannelUID;
20 import org.openhab.core.thing.Thing;
21 import org.openhab.core.types.Command;
22 import org.openhab.core.types.RefreshType;
25 * The {@link SomfyTahomaHitachiATWHZHandler} is responsible for handling commands,
26 * which are sent to one of the channels of the Hitachi Air To Water Heating Zone thing.
28 * @author Ondrej Pecta - Initial contribution
31 public class SomfyTahomaHitachiATWHZHandler extends SomfyTahomaBaseThingHandler {
33 public SomfyTahomaHitachiATWHZHandler(Thing thing) {
35 stateNames.put(ZONE_MODE, "modbus:AutoManuModeZone1State");
36 stateNames.put(CIRCUIT_CONTROL, "modbus:ControlCircuit1State");
37 stateNames.put(CIRCUIT_STATUS, "modbus:StatusCircuit1State");
38 stateNames.put(YUTAKI_TARGET_MODE, "modbus:YutakiTargetModeState");
39 stateNames.put(YUTAKI_MODE, "modbus:YutakiModeState");
40 stateNames.put(HOLIDAY_MODE, "modbus:HolidayModeZone1State");
41 stateNames.put(ALARM_NUMBER, "modbus:AlarmNumberState");
42 stateNames.put(THERMOSTAT_SETTING_ZONE1, "modbus:ThermostatSettingStatusZone1State");
43 stateNames.put(WH_SETTING_TEMP_ZONE1, "modbus:WaterHeatingSettingTemperatureStatusZone1State");
44 stateNames.put(ROOM_AMBIENT_TEMP_ZONE1, "modbus:RoomAmbientTemperatureStatusZone1State");
48 public void handleCommand(ChannelUID channelUID, Command command) {
49 super.handleCommand(channelUID, command);
50 if (command instanceof RefreshType) {
53 switch (channelUID.getId()) {
55 if (command instanceof StringType) {
56 sendCommand("setAutoManuMode", "[\"" + command + "\"]");
60 if (command instanceof StringType) {
61 sendCommand("setControlCircuit1", "[\"" + command + "\"]");
64 case YUTAKI_TARGET_MODE:
65 if (command instanceof StringType) {
66 sendCommand("setTargetMode", "[\"" + command + "\"]");
70 if (command instanceof StringType) {
71 sendCommand("setHolidayMode", "[\"" + command + "\"]");
74 case THERMOSTAT_SETTING_ZONE1:
75 sendTempCommand("setThermostatSettingControlZone1", command);
77 case WH_SETTING_TEMP_ZONE1:
78 sendTempCommand("setWaterHeatingSettingTemperatureControlZone1", command);
80 case ROOM_AMBIENT_TEMP_ZONE1:
81 sendTempCommand("setRoomAmbientTemperatureControlZone1", command);
84 getLogger().debug("This channel doesn't accept any commands");