2 * Copyright (c) 2010-2024 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.sensibo.internal.model;
15 import java.util.ArrayList;
16 import java.util.List;
17 import java.util.Optional;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
22 * The {@link SensiboModel} represents the home structure as designed by the user in the Sensibo app.
24 * @author Arne Seime - Initial contribution
27 public class SensiboModel {
28 private final long lastUpdated;
29 private final List<SensiboSky> pods = new ArrayList<>();
31 public SensiboModel(final long lastUpdated) {
32 this.lastUpdated = lastUpdated;
35 public void addPod(final SensiboSky pod) {
39 public List<SensiboSky> getPods() {
43 public long getLastUpdated() {
47 public Optional<SensiboSky> findSensiboSkyByMacAddress(final String macAddress) {
48 final String macAddressWithoutColons = macAddress.replace(":", "");
49 return pods.stream().filter(pod -> macAddressWithoutColons.equals(pod.getMacAddress())).findFirst();
56 public void updateAcState(String macAddress, AcState acState) {
57 findSensiboSkyByMacAddress(macAddress).ifPresent(sky -> sky.updateAcState(acState));