这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public abstract class AbstractDevice extends AbstractMessagePart implements Data
private String name_long;
private Date last_connection;
private Boolean is_online;
private String where_id;
private String where_name;

public AbstractDevice(@JsonProperty("device_id") String device_id) {
this.device_id = device_id;
Expand Down Expand Up @@ -109,6 +111,23 @@ public Boolean getIs_online() {
return this.is_online;
}

/**
* @return Where unique identifier.
*/
@JsonProperty("where_id")
public String getWhere_id() {
return this.where_id;
}

/**
* @return The display name of the device. Associated with the where_id.
* Can be any room name from a list we provide, or a custom name.
*/
@JsonProperty("where_name")
public String getWhere_name() {
return this.where_name;
}

@Override
public void sync(DataModel dataModel) {
// Link to structure
Expand All @@ -128,6 +147,8 @@ public String toString() {
builder.append("name_long", this.name_long);
builder.append("last_connection", this.last_connection);
builder.append("is_online", this.is_online);
builder.append("where_id", this.where_id);
builder.append("where_name", this.where_name);

return builder.toString();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* Copyright (c) 2010-2016 by the respective copyright holders.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.openhab.binding.nest.internal.messages;

import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonValue;

/**
* Possible values for *_alarm_state:
*
* <dl>
* <dt>ok</dt>
* <dd>OK</dd>
* <dt>warning</dt>
* <dd>Warning - Smoke or CO Detected</dd>
* <dt>emergency</dt>
* <dd>Emergency - * Detected - move to fresh air</dd>
* </dl>
*
* @author John Cocula
* @since 1.9.0
*/
public enum AlarmState {
OK("ok"),
WARNING("warning"),
EMERGENCY("emergency");

private final String state;

private AlarmState(String state) {
this.state = state;
}

@JsonValue
public String value() {
return state;
}

@JsonCreator
public static AlarmState forValue(String v) {
for (AlarmState as : AlarmState.values()) {
if (as.state.equals(v)) {
return as;
}
}
throw new IllegalArgumentException("Invalid alarm_state: " + v);
}

@Override
public String toString() {
return this.state;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class Camera extends AbstractDevice {
public static class Event extends AbstractMessagePart {
private Boolean has_sound;
private Boolean has_motion;
private Boolean has_person;
private Date start_time;
private Date end_time;
private Date urls_expire_time;
Expand All @@ -54,6 +55,14 @@ public Boolean getHas_motion() {
return this.has_motion;
}

/**
* @return true if a person was detected.
*/
@JsonProperty("has_person")
public Boolean getHas_person() {
return this.has_person;
}

/**
* @return event start time.
*/
Expand Down Expand Up @@ -120,6 +129,7 @@ public String toString() {
builder.appendSuper(super.toString());
builder.append("has_sound", this.has_sound);
builder.append("has_motion", this.has_motion);
builder.append("has_person", this.has_person);
builder.append("start_time", this.start_time);
builder.append("end_time", this.end_time);
builder.append("urls_expire_time", this.urls_expire_time);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.openhab.binding.nest.internal.messages.SmokeCOAlarm.AlarmState;
import org.openhab.binding.nest.internal.messages.SmokeCOAlarm.BatteryHealth;
import org.openhab.binding.nest.internal.messages.SmokeCOAlarm.ColorState;
import org.openhab.binding.nest.internal.messages.Structure.AwayState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public class SmokeCOAlarm extends AbstractDevice {

/**
* Battery life/health; estimate of time to end of life.
*
*
* Possible values for battery_health:
*
*
* <dl>
* <dt>ok</dt>
* <dd>Battery OK</dd>
Expand Down Expand Up @@ -70,54 +70,10 @@ public String toString() {
}
}

/**
* Possible values for *_alarm_state:
*
* <dl>
* <dt>ok</dt>
* <dd>OK</dd>
* <dt>warning</dt>
* <dd>Warning - CO Detected</dd>
* <dt>emergency</dt>
* <dd>Emergency - * Detected - move to fresh air</dd>
* </dl>
*/
public static enum AlarmState {
OK("ok"),
WARNING("warning"),
EMERGENCY("emergency");

private final String state;

private AlarmState(String state) {
this.state = state;
}

@JsonValue
public String value() {
return state;
}

@JsonCreator
public static AlarmState forValue(String v) {
for (AlarmState as : AlarmState.values()) {
if (as.state.equals(v)) {
return as;
}
}
throw new IllegalArgumentException("Invalid alarm_state: " + v);
}

@Override
public String toString() {
return this.state;
}
}

/**
* Indicates device status by color in the Nest app UI; it is an aggregate condition for battery+smoke+co states,
* and reflects the actual color indicators displayed in the Nest app
*
*
* Possible values for ui_color_state
* <dl>
* <dt>gray</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ public void setEstimated_arrival_window_end(Date estimated_arrival_window_end) {
private Date peak_period_end_time;
private String time_zone;
private ETA eta;
private Date eta_begin;
private Boolean rhr_enrollment;
private AlarmState co_alarm_state;
private AlarmState smoke_alarm_state;

public Structure(@JsonProperty("structure_id") String structure_id) {
this.structure_id = structure_id;
Expand Down Expand Up @@ -230,6 +234,14 @@ public String getName() {
return this.name;
}

/**
* Set the structure name
*/
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}

/**
* @return the country_code
*/
Expand Down Expand Up @@ -286,6 +298,38 @@ public void setEta(ETA eta) {
this.eta = eta;
}

/**
* Read the timestamp of the earliest expected time of arrival (eta). Used to trigger actions or events.
*/
@JsonProperty("eta_begin")
public Date getEta_begin() {
return eta_begin;
}

/**
* Rush Hour Rewards enrollment status.
*/
@JsonProperty("rhr_enrollment")
public Boolean getRhr_enrollment() {
return rhr_enrollment;
}

/**
* @return CO alarm status
*/
@JsonProperty("co_alarm_state")
public AlarmState getCo_alarm_state() {
return this.co_alarm_state;
}

/**
* @return Smoke alarm status
*/
@JsonProperty("smoke_alarm_state")
public AlarmState getSmoke_alarm_state() {
return this.smoke_alarm_state;
}

/**
* This method creates maps to device objects, using the list of device IDs that were deserialized from JSON.
*/
Expand Down Expand Up @@ -343,6 +387,10 @@ public String toString() {
builder.append("peak_period_end_time", this.peak_period_end_time);
builder.append("time_zone", this.time_zone);
builder.append("eta", this.eta);
builder.append("eta_begin", this.eta_begin);
builder.append("rhr_enrollment", this.rhr_enrollment);
builder.append("co_alarm_state", this.co_alarm_state);
builder.append("smoke_alarm_state", this.smoke_alarm_state);

return builder.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ public String toString() {
private BigDecimal ambient_temperature_c;
private BigDecimal humidity;
private HvacState hvac_state;
private String where_id;
private Boolean is_locked;
private String locked_temp_min_f;
private String locked_temp_max_f;
Expand All @@ -137,7 +136,6 @@ public String toString() {
private String label;
private Boolean sunlight_correction_enabled;
private Boolean sunlight_correction_active;
private String where_name;
private Integer fan_timer_duration;
private String time_to_target;
private String time_to_target_training;
Expand Down Expand Up @@ -439,14 +437,6 @@ public HvacState getHvac_state() {
return this.hvac_state;
}

/**
* @return Where unique identifier.
*/
@JsonProperty("where_id")
public String getWhere_id() {
return this.where_id;
}

/**
* @return Thermostat Lock status. When true, the Thermostat Lock feature is enabled, and restricts the temperature
* range to these min/max values: locked_temp_min_f, locked_temp_max_f, locked_temp_min_c, and
Expand Down Expand Up @@ -528,15 +518,6 @@ public Boolean getSunlight_correction_active() {
return this.sunlight_correction_active;
}

/**
* @return The display name of the device. Associated with the thermostat where_id.
* Can be any room name from a list we provide, or a custom name.
*/
@JsonProperty("where_name")
public String getWhere_name() {
return this.where_name;
}

/**
* @return the length of time (in minutes) that the fan is set to run.
*/
Expand Down Expand Up @@ -615,7 +596,6 @@ public String toString() {
builder.append("ambient_temperature_c", this.ambient_temperature_c);
builder.append("humidity", this.humidity);
builder.append("hvac_state", this.hvac_state);
builder.append("where_id", this.where_id);
builder.append("is_locked", this.is_locked);
builder.append("locked_temp_min_f", this.locked_temp_min_f);
builder.append("locked_temp_max_f", this.locked_temp_max_f);
Expand All @@ -624,7 +604,6 @@ public String toString() {
builder.append("label", this.label);
builder.append("sunlight_correction_enabled", this.sunlight_correction_enabled);
builder.append("sunlight_correction_active", this.sunlight_correction_active);
builder.append("where_name", this.where_name);
builder.append("fan_timer_duration", this.fan_timer_duration);
builder.append("time_to_target", this.time_to_target);
builder.append("time_to_target_training", this.time_to_target_training);
Expand Down