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.hue.internal.handler.sensors;
15 import static org.openhab.binding.hue.internal.HueBindingConstants.*;
16 import static org.openhab.binding.hue.internal.api.dto.clip1.FullSensor.STATE_PRESENCE;
21 import org.eclipse.jdt.annotation.NonNullByDefault;
22 import org.openhab.binding.hue.internal.api.dto.clip1.FullSensor;
23 import org.openhab.binding.hue.internal.api.dto.clip1.SensorConfigUpdate;
24 import org.openhab.binding.hue.internal.handler.HueSensorHandler;
25 import org.openhab.core.config.core.Configuration;
26 import org.openhab.core.library.types.OnOffType;
27 import org.openhab.core.thing.Thing;
28 import org.openhab.core.thing.ThingTypeUID;
31 * Geofence Presence Sensor
33 * @author Christoph Weitkamp - Initial contribution
36 public class GeofencePresenceHandler extends HueSensorHandler {
38 public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Set.of(THING_TYPE_GEOFENCE_SENSOR);
40 public GeofencePresenceHandler(Thing thing) {
45 protected SensorConfigUpdate doConfigurationUpdate(Map<String, Object> configurationParameters) {
46 return new SensorConfigUpdate();
50 protected void doSensorStateChanged(FullSensor sensor, Configuration config) {
51 Object presence = sensor.getState().get(STATE_PRESENCE);
52 if (presence != null) {
53 boolean value = Boolean.parseBoolean(String.valueOf(presence));
54 updateState(CHANNEL_PRESENCE, value ? OnOffType.ON : OnOffType.OFF);