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.nobohub.internal;
15 import java.time.Duration;
16 import java.time.format.DateTimeFormatter;
17 import java.util.Arrays;
18 import java.util.Collections;
19 import java.util.HashSet;
22 import java.util.stream.Collectors;
23 import java.util.stream.Stream;
25 import org.eclipse.jdt.annotation.NonNullByDefault;
26 import org.openhab.core.thing.ThingTypeUID;
29 * The {@link NoboHubBindingConstants} class defines common constants, which are
30 * used across the whole binding.
32 * @author Jørgen Austvik - Initial contribution
33 * @author Espen Fossen - Initial contribution
36 public class NoboHubBindingConstants {
38 private static final String BINDING_ID = "nobohub";
40 public static final String API_VERSION = "1.1";
42 public static final String PROPERTY_NAME = "name";
43 public static final String PROPERTY_MODEL = "model";
44 public static final String PROPERTY_HOSTNAME = "hostName";
46 public static final String PROPERTY_VENDOR_NAME = "Glen Dimplex Nobø";
47 public static final String PROPERTY_PRODUCTION_DATE = "productionDate";
49 public static final String PROPERTY_SOFTWARE_VERSION = "softwareVersion";
51 public static final String PROPERTY_ZONE = "zone";
52 public static final String PROPERTY_ZONE_ID = "id";
53 public static final String PROPERTY_TEMPERATURE_SENSOR_FOR_ZONE = "temperatureSensorForZone";
55 public static final int NOBO_HUB_TCP_PORT = 27779;
57 public static final Duration TIME_BETWEEN_FULL_SCANS = Duration.ofMinutes(10);
58 public static final Duration TIME_BETWEEN_RETRIES_ON_ERROR = Duration.ofSeconds(10);
60 public static final Duration RECOMMENDED_KEEPALIVE_INTERVAL = Duration.ofSeconds(14);
62 // List of all Thing Type UIDs
63 public static final ThingTypeUID THING_TYPE_HUB = new ThingTypeUID(BINDING_ID, "nobohub");
64 public static final ThingTypeUID THING_TYPE_ZONE = new ThingTypeUID(BINDING_ID, "zone");
65 public static final ThingTypeUID THING_TYPE_COMPONENT = new ThingTypeUID(BINDING_ID, "component");
67 public static final Set<ThingTypeUID> AUTODISCOVERED_THING_TYPES_UIDS = new HashSet<>(
68 Arrays.asList(THING_TYPE_ZONE, THING_TYPE_COMPONENT));
70 public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = new HashSet<>(
71 Arrays.asList(THING_TYPE_HUB, THING_TYPE_ZONE, THING_TYPE_COMPONENT));
73 // List of all Channel ids
76 public static final String CHANNEL_HUB_ACTIVE_OVERRIDE_NAME = "activeOverrideName";
79 public static final String CHANNEL_ZONE_ACTIVE_WEEK_PROFILE_NAME = "activeWeekProfileName";
80 public static final String CHANNEL_ZONE_ACTIVE_WEEK_PROFILE = "activeWeekProfile";
81 public static final String CHANNEL_ZONE_CALCULATED_WEEK_PROFILE_STATUS = "calculatedWeekProfileStatus";
82 public static final String CHANNEL_ZONE_COMFORT_TEMPERATURE = "comfortTemperature";
83 public static final String CHANNEL_ZONE_ECO_TEMPERATURE = "ecoTemperature";
84 public static final String CHANNEL_ZONE_CURRENT_TEMPERATURE = "currentTemperature";
87 public static final String CHANNEL_COMPONENT_CURRENT_TEMPERATURE = "currentTemperature";
90 public static final DateTimeFormatter DATE_FORMAT_SECONDS = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
91 public static final DateTimeFormatter DATE_FORMAT_MINUTES = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
92 public static final DateTimeFormatter TIME_FORMAT_MINUTES = DateTimeFormatter.ofPattern("HHmm");
95 public static final int NOBO_HUB_BROADCAST_PORT = 10000;
96 public static final String NOBO_HUB_BROADCAST_ADDRESS = "0.0.0.0";
97 public static final int NOBO_HUB_MULTICAST_PORT = 10001;
98 public static final String NOBO_HUB_MULTICAST_ADDRESS = "239.0.1.187";
102 public static final Map<String, String> REJECT_REASONS = Stream.of(new String[][] {
103 { "0", "Client command set too old. Please run with debug logs." },
104 { "1", "Hub serial number mismatch. Should be 12 digits, if hub was autodetected, please add the last three." },
105 { "2", "Wrong number of arguments. Please run with debug logs." },
106 { "3", "Timestamp incorrectly formatted. Please run with debug logs." }, })
107 .collect(Collectors.collectingAndThen(Collectors.toMap(data -> data[0], data -> data[1]),
108 Collections::<String, String> unmodifiableMap));
110 // Full list of units: https://help.nobo.no/skriver/?chapterid=344&chapterlanguageid=2
111 public static final Map<String, String> SERIALNUMBERS_FOR_TYPES = Stream.of(new String[][] { { "100", "EC-700" },
112 { "102", "Eco Hub" }, { "103", "Quantum Hub" }, { "105", "Ewt Plus" }, { "120", "RS-700" },
113 { "130", "RCE-700" }, { "121", "RSX-700" }, { "160", "R80 RDC-700" }, { "165", "R80 RDC-700 LST" },
114 { "168", "NCU-2R" }, { "169", "DCU-2R" }, { "170", "Series 18 Ewt Touch" }, { "180", "2NC9-700" },
115 { "182", "R80 RSC-700 5-24" }, { "183", "R80 RSC-700 5-30" }, { "184", "NCU-1R" },
116 { "186", "NTD-4R/DCU-1R" }, { "190", "S16-700 Safir" }, { "192", "R80 TXF-700" }, { "194", "R80 RXC-700" },
117 { "198", "NCU-ER" }, { "199", "DCU-ER" }, { "200", "TRB-700" }, { "210", "NTB-2R" }, { "220", "TR36-700" },
118 { "230", "TCU-700" }, { "231", "THB-700" }, { "232", "TXB-700" }, { "233", "EcoSense MSW" },
119 { "234", "Nobø Eco Switch" },
121 }).collect(Collectors.collectingAndThen(Collectors.toMap(data -> data[0], data -> data[1]),
122 Collections::<String, String> unmodifiableMap));