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.paradoxalarm.internal.model;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.paradoxalarm.internal.communication.IRequest;
18 import org.openhab.binding.paradoxalarm.internal.communication.messages.zone.ZoneCommand;
19 import org.openhab.binding.paradoxalarm.internal.handlers.Commandable;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
24 * The {@link Zone} Paradox zone.
25 * ID is always numeric (1-192 for Evo192)
26 * States are taken from cached RAM memory map and parsed.
28 * @author Konstantin Polihronov - Initial contribution
31 public class Zone extends Entity implements Commandable {
33 private final Logger logger = LoggerFactory.getLogger(Zone.class);
35 private @Nullable ZoneState zoneState;
37 public Zone(ParadoxPanel panel, int id, @Nullable String label) {
38 super(panel, id, label);
41 public @Nullable ZoneState getZoneState() {
45 public void setZoneState(ZoneState zoneState) {
46 this.zoneState = zoneState;
47 logger.debug("Zone {} state updated to: {}", getLabel(), zoneState);
51 public void handleCommand(@Nullable String command) {
52 ZoneCommand zoneCommand = ZoneCommand.parse(command);
53 if (zoneCommand == null) {
54 logger.debug("Command {} is parsed to null. Skipping it", command);
58 logger.debug("Submitting command={} for partition=[{}]", zoneCommand, this);
59 IRequest request = zoneCommand.getRequest(getId());
60 getPanel().getCommunicator().submitRequest(request);