]> git.basschouten.com Git - openhab-addons.git/blob
3ed6f6e926fe6f47e0942555f08022ca063bc0ab
[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.souliss.internal.handler;
14
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;
23
24 /**
25  * The {@link SoulissTopicsHandler} is responsible for handling commands, which are
26  * sent to one of the channels.
27  *
28  * @author Luca Remigio - Initial contribution
29  * @author Luca Calcaterra - Refactor for OH3
30  */
31 @NonNullByDefault
32 public class SoulissTopicsHandler extends SoulissGenericActionMessage implements TypicalCommonMethods {
33
34     private float fSetPointValue = 0xFFFF;
35
36     public SoulissTopicsHandler(Thing pThing) {
37         super(pThing);
38         thingGenActMsg = pThing;
39     }
40
41     @Override
42     public void handleCommand(ChannelUID channelUID, Command command) {
43     }
44
45     @Override
46     public void initialize() {
47         // status online
48         updateStatus(ThingStatus.ONLINE);
49     }
50
51     public void setState(PrimitiveType state) {
52         this.updateState(SoulissBindingConstants.T5N_VALUE_CHANNEL, (DecimalType) state);
53     }
54
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;
60         }
61     }
62
63     public float getFloatState() {
64         return fSetPointValue;
65     }
66
67     @Override
68     public void setRawState(byte rawState) {
69         throw new UnsupportedOperationException("Not Implemented, yet.");
70     }
71
72     @Override
73     public byte getRawState() {
74         throw new UnsupportedOperationException("Not Implemented, yet.");
75     }
76
77     @Override
78     public byte getExpectedRawState(byte bCommand) {
79         return -1;
80     }
81 }