]> git.basschouten.com Git - openhab-addons.git/blob
ffacb248b21087ea5fc677f6d3321ee0be65803c
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.gardena.internal.model.property;
14
15 import com.google.gson.annotations.SerializedName;
16
17 /**
18  * Represents a Gardena complex property value for the irrigation control.
19  *
20  * @author Gerhard Riegler - Initial contribution
21  */
22
23 public class IrrigationControlWateringProperty extends BaseProperty {
24     private IrrigationControlWateringValue value = new IrrigationControlWateringValue();
25
26     public IrrigationControlWateringProperty(String name, int duration, int valveId) {
27         super(name);
28
29         value.state = duration == 0 ? "idle" : "manual";
30         value.duration = duration;
31         value.valveId = valveId;
32     }
33
34     @Override
35     public String getValue() {
36         return String.valueOf(value.duration);
37     }
38
39     @SuppressWarnings("unused")
40     private class IrrigationControlWateringValue {
41         public String state;
42         public int duration;
43         @SerializedName("valve_id")
44         public int valveId;
45     }
46 }