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.neohub.internal;
15 import static org.openhab.binding.neohub.internal.NeoHubBindingConstants.*;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.core.library.types.OnOffType;
19 import org.openhab.core.library.types.QuantityType;
20 import org.openhab.core.thing.Thing;
23 * The {@link NeoTemperatureSensorHandler} is the OpenHAB Handler for NeoTemperatureSensor devices
25 * Note: inherits almost all the functionality of a {@link NeoBaseHandler}
27 * @author Andrew Fiddian-Green - Initial contribution
31 public class NeoTemperatureSensorHandler extends NeoBaseHandler {
33 public NeoTemperatureSensorHandler(Thing thing) {
37 // =========== methods of NeoBaseHandler that are overridden ================
40 protected void toOpenHabSendChannelValues(NeoHubAbstractDeviceData.AbstractRecord deviceRecord) {
41 boolean offline = deviceRecord.offline();
43 toOpenHabSendValueDebounced(CHAN_TEMPERATURE_SENSOR,
44 new QuantityType<>(deviceRecord.getActualTemperature(), getTemperatureUnit()), offline);
46 toOpenHabSendValueDebounced(CHAN_BATTERY_LOW_ALARM, OnOffType.from(deviceRecord.isBatteryLow()), offline);