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.souliss.internal.handler;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.souliss.internal.SoulissBindingConstants;
17 import org.openhab.core.library.types.DecimalType;
18 import org.openhab.core.thing.ChannelUID;
19 import org.openhab.core.thing.Thing;
20 import org.openhab.core.thing.ThingStatus;
21 import org.openhab.core.types.Command;
22 import org.openhab.core.types.PrimitiveType;
25 * The {@link SoulissTopicsHandler} is responsible for handling commands, which are
26 * sent to one of the channels.
28 * @author Luca Remigio - Initial contribution
29 * @author Luca Calcaterra - Refactor for OH3
32 public class SoulissTopicsHandler extends SoulissGenericActionMessage implements TypicalCommonMethods {
34 private float fSetPointValue = 0xFFFF;
36 public SoulissTopicsHandler(Thing pThing) {
38 thingGenActMsg = pThing;
42 public void handleCommand(ChannelUID channelUID, Command command) {
46 public void initialize() {
48 updateStatus(ThingStatus.ONLINE);
51 public void setState(PrimitiveType state) {
52 this.updateState(SoulissBindingConstants.T5N_VALUE_CHANNEL, (DecimalType) state);
55 public void setFloatValue(float valueOf) {
56 this.updateState(SoulissBindingConstants.LASTSTATUSSTORED_CHANNEL, this.getLastUpdateTime());
57 if (fSetPointValue != valueOf) {
58 this.setState(DecimalType.valueOf(Float.toString(valueOf)));
59 fSetPointValue = valueOf;
63 public float getFloatState() {
64 return fSetPointValue;
68 public void setRawState(byte rawState) {
69 throw new UnsupportedOperationException("Not Implemented, yet.");
73 public byte getRawState() {
74 throw new UnsupportedOperationException("Not Implemented, yet.");
78 public byte getExpectedRawState(byte bCommand) {