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.velbus.internal.packets;
15 import static org.openhab.binding.velbus.internal.VelbusBindingConstants.COMMAND_DAYLIGHT_SAVING_STATUS;
17 import java.time.ZonedDateTime;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
22 * The {@link VelbusSetDaylightSavingsStatusPacket} represents a Velbus packet that can be used to
23 * set the daylight saving status of the given Velbus module.
25 * @author Cedric Boon - Initial contribution
28 public class VelbusSetDaylightSavingsStatusPacket extends VelbusPacket {
29 private ZonedDateTime zonedDateTime;
31 public VelbusSetDaylightSavingsStatusPacket(byte address, ZonedDateTime zonedDateTime) {
32 super(address, PRIO_LOW);
34 this.zonedDateTime = zonedDateTime;
37 public boolean isDaylightSavings() {
38 return zonedDateTime.getZone().getRules().isDaylightSavings(zonedDateTime.toInstant());
42 protected byte[] getDataBytes() {
43 return new byte[] { COMMAND_DAYLIGHT_SAVING_STATUS, (byte) (isDaylightSavings() ? 0x01 : 0x00) };