[ventaair] Add Air quality and service time channels (#11792)
* [ventaair] Add Air quality and service time channels - also add value 4 for water level Signed-off-by: Stefan Triller <github@stefantriller.de>
This commit is contained in:
parent
817de38683
commit
df7552c92b
|
@ -41,6 +41,7 @@ public class VentaAirBindingConstants {
|
||||||
public static final String CHANNEL_AUTOMATIC = "automatic";
|
public static final String CHANNEL_AUTOMATIC = "automatic";
|
||||||
public static final String CHANNEL_TEMPERATURE = "temperature";
|
public static final String CHANNEL_TEMPERATURE = "temperature";
|
||||||
public static final String CHANNEL_HUMIDITY = "humidity";
|
public static final String CHANNEL_HUMIDITY = "humidity";
|
||||||
|
public static final String CHANNEL_PM25 = "pm25";
|
||||||
public static final String CHANNEL_WATERLEVEL = "waterLevel";
|
public static final String CHANNEL_WATERLEVEL = "waterLevel";
|
||||||
public static final String CHANNEL_FAN_RPM = "fanRPM";
|
public static final String CHANNEL_FAN_RPM = "fanRPM";
|
||||||
public static final String CHANNEL_CLEAN_MODE = "cleanMode";
|
public static final String CHANNEL_CLEAN_MODE = "cleanMode";
|
||||||
|
@ -48,6 +49,7 @@ public class VentaAirBindingConstants {
|
||||||
public static final String CHANNEL_DISC_REPLACE_TIME = "discReplaceTime";
|
public static final String CHANNEL_DISC_REPLACE_TIME = "discReplaceTime";
|
||||||
public static final String CHANNEL_CLEANING_TIME = "cleaningTime";
|
public static final String CHANNEL_CLEANING_TIME = "cleaningTime";
|
||||||
public static final String CHANNEL_TIMER_TIME_PASSED = "timerTimePassed";
|
public static final String CHANNEL_TIMER_TIME_PASSED = "timerTimePassed";
|
||||||
|
public static final String CHANNEL_SERVICE_TIME = "serviceTime";
|
||||||
|
|
||||||
public static final int PORT = 48000;
|
public static final int PORT = 48000;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.openhab.binding.ventaair.internal.message.dto.DeviceInfoMessage;
|
||||||
import org.openhab.binding.ventaair.internal.message.dto.Header;
|
import org.openhab.binding.ventaair.internal.message.dto.Header;
|
||||||
import org.openhab.binding.ventaair.internal.message.dto.Info;
|
import org.openhab.binding.ventaair.internal.message.dto.Info;
|
||||||
import org.openhab.binding.ventaair.internal.message.dto.Measurements;
|
import org.openhab.binding.ventaair.internal.message.dto.Measurements;
|
||||||
|
import org.openhab.core.library.dimension.Density;
|
||||||
import org.openhab.core.library.types.DecimalType;
|
import org.openhab.core.library.types.DecimalType;
|
||||||
import org.openhab.core.library.types.OnOffType;
|
import org.openhab.core.library.types.OnOffType;
|
||||||
import org.openhab.core.library.types.QuantityType;
|
import org.openhab.core.library.types.QuantityType;
|
||||||
|
@ -275,6 +276,11 @@ public class VentaThingHandler extends BaseThingHandler {
|
||||||
updateState(VentaAirBindingConstants.CHANNEL_HUMIDITY, humidityState);
|
updateState(VentaAirBindingConstants.CHANNEL_HUMIDITY, humidityState);
|
||||||
channelValueCache.put(VentaAirBindingConstants.CHANNEL_HUMIDITY, humidityState);
|
channelValueCache.put(VentaAirBindingConstants.CHANNEL_HUMIDITY, humidityState);
|
||||||
|
|
||||||
|
QuantityType<Density> pm25State = new QuantityType<>(measurements.getDust(),
|
||||||
|
Units.MICROGRAM_PER_CUBICMETRE);
|
||||||
|
updateState(VentaAirBindingConstants.CHANNEL_PM25, pm25State);
|
||||||
|
channelValueCache.put(VentaAirBindingConstants.CHANNEL_PM25, pm25State);
|
||||||
|
|
||||||
DecimalType waterLevelState = new DecimalType(measurements.getWaterLevel());
|
DecimalType waterLevelState = new DecimalType(measurements.getWaterLevel());
|
||||||
updateState(VentaAirBindingConstants.CHANNEL_WATERLEVEL, waterLevelState);
|
updateState(VentaAirBindingConstants.CHANNEL_WATERLEVEL, waterLevelState);
|
||||||
channelValueCache.put(VentaAirBindingConstants.CHANNEL_WATERLEVEL, waterLevelState);
|
channelValueCache.put(VentaAirBindingConstants.CHANNEL_WATERLEVEL, waterLevelState);
|
||||||
|
@ -310,6 +316,10 @@ public class VentaThingHandler extends BaseThingHandler {
|
||||||
updateState(VentaAirBindingConstants.CHANNEL_TIMER_TIME_PASSED, timerTimePassedState);
|
updateState(VentaAirBindingConstants.CHANNEL_TIMER_TIME_PASSED, timerTimePassedState);
|
||||||
channelValueCache.put(VentaAirBindingConstants.CHANNEL_TIMER_TIME_PASSED, timerTimePassedState);
|
channelValueCache.put(VentaAirBindingConstants.CHANNEL_TIMER_TIME_PASSED, timerTimePassedState);
|
||||||
|
|
||||||
|
QuantityType<Time> serviceTimeState = new QuantityType<Time>(info.getServiceT(), Units.MINUTE);
|
||||||
|
updateState(VentaAirBindingConstants.CHANNEL_SERVICE_TIME, serviceTimeState);
|
||||||
|
channelValueCache.put(VentaAirBindingConstants.CHANNEL_SERVICE_TIME, serviceTimeState);
|
||||||
|
|
||||||
updateProperties(info);
|
updateProperties(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,9 @@ public class Info {
|
||||||
@SerializedName(value = "FilterT")
|
@SerializedName(value = "FilterT")
|
||||||
private int filterT;
|
private int filterT;
|
||||||
|
|
||||||
|
@SerializedName(value = "ServiceT")
|
||||||
|
private int serviceT;
|
||||||
|
|
||||||
@SerializedName(value = "UVCOnT")
|
@SerializedName(value = "UVCOnT")
|
||||||
private int uvCOnT;
|
private int uvCOnT;
|
||||||
|
|
||||||
|
@ -110,6 +113,10 @@ public class Info {
|
||||||
return filterT;
|
return filterT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getServiceT() {
|
||||||
|
return serviceT;
|
||||||
|
}
|
||||||
|
|
||||||
public int getUvCOnT() {
|
public int getUvCOnT() {
|
||||||
return uvCOnT;
|
return uvCOnT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class Measurements {
|
||||||
private double humidity;
|
private double humidity;
|
||||||
|
|
||||||
@SerializedName(value = "Dust")
|
@SerializedName(value = "Dust")
|
||||||
private int dust;
|
private double dust;
|
||||||
|
|
||||||
@SerializedName(value = "WaterLevel")
|
@SerializedName(value = "WaterLevel")
|
||||||
private int waterLevel;
|
private int waterLevel;
|
||||||
|
@ -44,7 +44,7 @@ public class Measurements {
|
||||||
return humidity;
|
return humidity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDust() {
|
public double getDust() {
|
||||||
return dust;
|
return dust;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,10 @@ channel-type.ventaair.humidity.label = Humidity
|
||||||
channel-type.ventaair.humidity.description = Current Humidity
|
channel-type.ventaair.humidity.description = Current Humidity
|
||||||
channel-type.ventaair.operationTime.label = Operation Time
|
channel-type.ventaair.operationTime.label = Operation Time
|
||||||
channel-type.ventaair.operationTime.description = Operation Time since the device was first started (in hours)
|
channel-type.ventaair.operationTime.description = Operation Time since the device was first started (in hours)
|
||||||
|
channel-type.ventaair.pm25.label = Air Quality
|
||||||
|
channel-type.ventaair.pm25.description = Current Air Quality measured in PM 2.5
|
||||||
|
channel-type.ventaair.serviceTime.label = Service Time
|
||||||
|
channel-type.ventaair.serviceTime.description = Service time in minutes
|
||||||
channel-type.ventaair.sleepMode.label = Sleep Mode
|
channel-type.ventaair.sleepMode.label = Sleep Mode
|
||||||
channel-type.ventaair.sleepMode.description = Sleep Mode
|
channel-type.ventaair.sleepMode.description = Sleep Mode
|
||||||
channel-type.ventaair.targetHumidity.label = Target Humidity
|
channel-type.ventaair.targetHumidity.label = Target Humidity
|
||||||
|
@ -82,3 +86,4 @@ channel-type.ventaair.waterLevel.state.option.0 = Critical
|
||||||
channel-type.ventaair.waterLevel.state.option.1 = Refill tank
|
channel-type.ventaair.waterLevel.state.option.1 = Refill tank
|
||||||
channel-type.ventaair.waterLevel.state.option.2 = OK
|
channel-type.ventaair.waterLevel.state.option.2 = OK
|
||||||
channel-type.ventaair.waterLevel.state.option.3 = Full
|
channel-type.ventaair.waterLevel.state.option.3 = Full
|
||||||
|
channel-type.ventaair.waterLevel.state.option.4 = Max
|
||||||
|
|
|
@ -103,6 +103,13 @@
|
||||||
<state pattern="%.1f %unit%" readOnly="true"/>
|
<state pattern="%.1f %unit%" readOnly="true"/>
|
||||||
</channel-type>
|
</channel-type>
|
||||||
|
|
||||||
|
<channel-type id="pm25">
|
||||||
|
<item-type>Number:Density</item-type>
|
||||||
|
<label>Air Quality</label>
|
||||||
|
<description>Current Air Quality measured in PM 2.5</description>
|
||||||
|
<state pattern="%.1f %unit%" readOnly="true"/>
|
||||||
|
</channel-type>
|
||||||
|
|
||||||
<channel-type id="waterLevel">
|
<channel-type id="waterLevel">
|
||||||
<item-type>Number</item-type>
|
<item-type>Number</item-type>
|
||||||
<label>Water Level</label>
|
<label>Water Level</label>
|
||||||
|
@ -113,6 +120,7 @@
|
||||||
<option value="1">Refill tank</option>
|
<option value="1">Refill tank</option>
|
||||||
<option value="2">OK</option>
|
<option value="2">OK</option>
|
||||||
<option value="3">Full</option>
|
<option value="3">Full</option>
|
||||||
|
<option value="4">Max</option>
|
||||||
</options>
|
</options>
|
||||||
</state>
|
</state>
|
||||||
</channel-type>
|
</channel-type>
|
||||||
|
@ -152,4 +160,11 @@
|
||||||
<state pattern="%d" readOnly="true"/>
|
<state pattern="%d" readOnly="true"/>
|
||||||
</channel-type>
|
</channel-type>
|
||||||
|
|
||||||
|
<channel-type id="serviceTime">
|
||||||
|
<item-type>Number:Time</item-type>
|
||||||
|
<label>Service Time</label>
|
||||||
|
<description>Service time in minutes</description>
|
||||||
|
<state pattern="%d" readOnly="true"/>
|
||||||
|
</channel-type>
|
||||||
|
|
||||||
</thing:thing-descriptions>
|
</thing:thing-descriptions>
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
<channel id="automatic" typeId="automatic"/>
|
<channel id="automatic" typeId="automatic"/>
|
||||||
<channel id="temperature" typeId="temperature"/>
|
<channel id="temperature" typeId="temperature"/>
|
||||||
<channel id="humidity" typeId="humidity"/>
|
<channel id="humidity" typeId="humidity"/>
|
||||||
|
<channel id="pm25" typeId="pm25"/>
|
||||||
<channel id="waterLevel" typeId="waterLevel"/>
|
<channel id="waterLevel" typeId="waterLevel"/>
|
||||||
<channel id="fanRPM" typeId="fanRPM"/>
|
<channel id="fanRPM" typeId="fanRPM"/>
|
||||||
<channel id="cleanMode" typeId="cleanMode"/>
|
<channel id="cleanMode" typeId="cleanMode"/>
|
||||||
|
@ -56,6 +57,7 @@
|
||||||
<channel id="operationTime" typeId="operationTime"/>
|
<channel id="operationTime" typeId="operationTime"/>
|
||||||
<channel id="discReplaceTime" typeId="discReplaceTime"/>
|
<channel id="discReplaceTime" typeId="discReplaceTime"/>
|
||||||
<channel id="cleaningTime" typeId="cleaningTime"/>
|
<channel id="cleaningTime" typeId="cleaningTime"/>
|
||||||
|
<channel id="serviceTime" typeId="serviceTime"/>
|
||||||
</channels>
|
</channels>
|
||||||
|
|
||||||
<representation-property>macAddress</representation-property>
|
<representation-property>macAddress</representation-property>
|
||||||
|
|
Loading…
Reference in New Issue