]> git.basschouten.com Git - openhab-addons.git/blob
295934fa478b4f8f24e8c5c30b1ba22c09d5dc2f
[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.plugwise.internal.protocol;
14
15 import static org.openhab.binding.plugwise.internal.protocol.field.MessageType.SENSE_REPORT_INTERVAL_SET_REQUEST;
16
17 import java.time.Duration;
18
19 import org.openhab.binding.plugwise.internal.protocol.field.MACAddress;
20
21 /**
22  * Sets the Sense temperature and humidity measurement report interval. Based on this interval, periodically a
23  * {@link SenseReportRequestMessage} is sent.
24  *
25  * @author Wouter Born - Initial contribution
26  */
27 public class SenseReportIntervalSetRequest extends Message {
28
29     private Duration reportInterval;
30
31     public SenseReportIntervalSetRequest(MACAddress macAddress, Duration reportInterval) {
32         super(SENSE_REPORT_INTERVAL_SET_REQUEST, macAddress);
33         this.reportInterval = reportInterval;
34     }
35
36     @Override
37     protected String payloadToHexString() {
38         return String.format("%02X", reportInterval.toMinutes());
39     }
40 }