]> git.basschouten.com Git - openhab-addons.git/blob
4bd420e9d403818861bc0f1443eba210248e14fd
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.avmfritz.internal.handler;
14
15 import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.*;
16
17 import java.util.Map;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.avmfritz.internal.dto.AVMFritzBaseModel;
21 import org.openhab.binding.avmfritz.internal.dto.GroupModel;
22 import org.openhab.core.thing.Thing;
23
24 /**
25  * Handler for a FRITZ! group. Handles commands, which are sent to one of the channels.
26  *
27  * @author Christoph Weitkamp - Initial contribution
28  */
29 @NonNullByDefault
30 public class GroupHandler extends AVMFritzBaseThingHandler {
31
32     public GroupHandler(Thing thing) {
33         super(thing);
34     }
35
36     @Override
37     protected void updateProperties(AVMFritzBaseModel device, Map<String, String> editProperties) {
38         if (device instanceof GroupModel) {
39             GroupModel groupModel = (GroupModel) device;
40             if (groupModel.getGroupinfo() != null) {
41                 editProperties.put(PROPERTY_MASTER, groupModel.getGroupinfo().getMasterdeviceid());
42                 editProperties.put(PROPERTY_MEMBERS, groupModel.getGroupinfo().getMembers());
43             }
44         }
45         super.updateProperties(device, editProperties);
46     }
47 }