Skip to content

Commit

Permalink
Merge pull request #85 from dvdgeisler/feature/airpurifier_to_hass
Browse files Browse the repository at this point in the history
Adjustments to Airpurifier device
  • Loading branch information
TheMrBooyah committed May 11, 2023
2 parents e948b32 + 10b9358 commit 9574c23
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import com.fasterxml.jackson.annotation.JsonProperty;

public enum AirPurifierFanMode {
@JsonProperty("off")
OFF,
@JsonProperty("low")
LOW,
@JsonProperty("medium")
MEDIUM,
@JsonProperty("high")
HIGH,
@JsonProperty("auto")
AUTO,
@JsonProperty("manual")
MANUAL
AUTO
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ public AirPurifierFilterAttributes(final Integer elapsedTime, final Boolean alar
this.alarmStatus = alarmStatus;
this.lifetime = lifetime;
}

public AirPurifierFilterAttributes() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ protected void onDeviceCreated(final AirPurifierDevice device) {
config.device = this.getDeviceConfig(device);
config.command_topic = this.getTopic(device, HASS_COMPONENT, TOPIC_SET);
config.state_topic = this.getTopic(device, HASS_COMPONENT, TOPIC_STATE);
config.payload_off = this.toJSON(AirPurifierFanMode.OFF);
config.payload_low = this.toJSON(AirPurifierFanMode.LOW);
config.payload_medium = this.toJSON(AirPurifierFanMode.MEDIUM);
config.payload_high = this.toJSON(AirPurifierFanMode.HIGH);
config.payload_auto = this.toJSON(AirPurifierFanMode.AUTO);
config.payload_manual = this.toJSON(AirPurifierFanMode.MANUAL);
config.state_off = this.toJSON(AirPurifierFanMode.OFF);
config.state_low = this.toJSON(AirPurifierFanMode.LOW);
config.state_medium = this.toJSON(AirPurifierFanMode.MEDIUM);
config.state_high = this.toJSON(AirPurifierFanMode.HIGH);
config.state_auto = this.toJSON(AirPurifierFanMode.AUTO);
config.state_manual = this.toJSON(AirPurifierFanMode.MANUAL);
config.value_template = "{{value}}";

config.availability = new DeviceAvailability();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,34 @@ public class AirPurifierConfig {
public String unique_id;
public String name;
public Device device;
public String payload_off;
public String payload_low;
public String payload_medium;
public String payload_high;
public String payload_auto;
public String payload_manual;
public String command_topic;
public String state_off;
public String state_low;
public String state_medium;
public String state_high;
public String state_auto;
public String state_manual;
public String state_topic;
public String value_template;
public DeviceAvailability availability;

public AirPurifierConfig(String object_id, String unique_id, String name, Device device,
String payload_off, String payload_auto, String payload_manual, String command_topic,
String state_off, String state_auto, String state_manual, String state_topic,
String payload_low, String payload_auto, String payload_medium, String command_topic,
String state_low, String state_auto, String state_medium, String state_topic,
String value_template, DeviceAvailability availability) {
this.object_id = object_id;
this.unique_id = unique_id;
this.name = name;
this.device = device;
this.payload_off = payload_off;
this.payload_low = payload_low;
this.payload_auto = payload_auto;
this.payload_manual = payload_manual;
this.payload_medium = payload_medium;
this.command_topic = command_topic;
this.state_off = state_off;
this.state_low = state_low;
this.state_auto = state_auto;
this.state_manual = state_manual;
this.state_medium = state_medium;
this.state_topic = state_topic;
this.value_template = value_template;
this.availability = availability;
Expand Down

0 comments on commit 9574c23

Please sign in to comment.