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.mqtt.ruuvigateway.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.mqtt.generic.ChannelConfig;
17 import org.openhab.binding.mqtt.generic.ChannelState;
18 import org.openhab.binding.mqtt.generic.values.TextValue;
19 import org.openhab.core.library.types.StringType;
20 import org.openhab.core.thing.ChannelUID;
23 * Simplified state cache for purposes of caching StringType values
25 * Unlike parent class {@link ChannelState}, this class by definition is not interacting with MQTT subscriptions nor
26 * does it update any channels
28 * @author Sami Salonen - Initial contribution
31 public class RuuviCachedStringState extends ChannelState {
34 * Construct cache for Strings
36 * @param channelUID associated channel UID
39 public RuuviCachedStringState(ChannelUID channelUID) {
40 super(new ChannelConfig(), channelUID, new TextValue(), null);
44 * Update cached state with given value
46 * @param value value. Specified as plain number with unit given in constructor
48 public void update(String value) {
49 cachedValue.update(new StringType(value));