]> git.basschouten.com Git - openhab-addons.git/blob
159fa8eefc55930013ccb18825a5a712b36cd6c2
[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.yeelight.internal.handler;
14
15 import org.openhab.binding.yeelight.internal.YeelightBindingConstants;
16 import org.openhab.binding.yeelight.internal.lib.device.DeviceStatus;
17 import org.openhab.binding.yeelight.internal.lib.enums.ActiveMode;
18 import org.openhab.core.library.types.OnOffType;
19 import org.openhab.core.thing.Thing;
20
21 /**
22  * The {@link YeelightCeilingWithNightHandler} is responsible for handling commands, which are
23  * sent to one of the channels.
24  *
25  * @author Nikita Pogudalov - Initial contribution
26  */
27 public class YeelightCeilingWithNightHandler extends YeelightCeilingHandler {
28
29     public YeelightCeilingWithNightHandler(Thing thing) {
30         super(thing);
31     }
32
33     @Override
34     protected void updateUI(DeviceStatus status) {
35         super.updateUI(status);
36
37         updateState(YeelightBindingConstants.CHANNEL_NIGHTLIGHT,
38                 (status.getActiveMode() == ActiveMode.MOONLIGHT_MODE) ? OnOffType.ON : OnOffType.OFF);
39     }
40 }