Skip to content

Commit

Permalink
[veSync] Device support enhancements
Browse files Browse the repository at this point in the history
Device support enhancements
Signed-off-by: David Goodyear <[email protected]>
  • Loading branch information
dag81 committed Aug 1, 2023
1 parent c7af92e commit 5707696
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 55 deletions.
77 changes: 60 additions & 17 deletions bundles/org.openhab.binding.vesync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,25 @@ Channel names in **bold** are read/write, everything else is read-only

### AirHumidifier Thing

| Channel | Type | Description | Model's Supported | Controllable Values |
|----------------------------|----------------------|---------------------------------------------------------------|---------------------------------------|---------------------|
| **enabled** | Switch | Whether the hardware device is enabled (Switched on) | 200S, Dual200S, 300S, 600S, OasisMist | [ON, OFF] |
| **display** | Switch | Whether the display is enabled (display is shown) | 200S, Dual200S, 300S, 600S, OasisMist | [ON, OFF] |
| waterLacking | Switch | Indicator whether the unit is lacking water | 200S, Dual200S, 300S, 600S, OasisMist | |
| humidityHigh | Switch | Indicator for high humidity | 200S, Dual200S, 300S, 600S, OasisMist | |
| waterTankLifted | Switch | Indicator for whether the water tank is removed | 200S, Dual200S, 300S, 600S, OasisMist | |
| **stopAtHumiditySetpoint** | Switch | Whether the unit is set to stop when the set point is reached | 200S, Dual200S, 300S, 600S, OasisMist | [ON, OFF] |
| humidity | Number:Dimensionless | Indicator for the currently measured humidity % level | 200S, Dual200S, 300S, 600S, OasisMist | |
| **mistLevel** | Number:Dimensionless | The current mist level set | 300S | [1...2] |
| **mistLevel** | Number:Dimensionless | The current mist level set | 200S, Dual200S, 600S, OasisMist | [1...3] |
| **humidifierMode** | String | The current mode of operation | 200S, Dual200S, 300S, 600S, OasisMist | [auto, sleep] |
| **nightLightMode** | String | The night light mode | 200S, Dual200S, 300S | [on, dim, off] |
| **humiditySetpoint** | Number:Dimensionless | Humidity % set point to reach | 200S, Dual200S, 300S, 600S, OasisMist | [30...80] |
| warmEnabled | Switch | Indicator for warm mist mode | 600S, OasisMist | |
| **warmLevel** | Number:Dimensionless | The current warm mist level set | 600S, OasisMist | [0..3] |
| Channel | Type | Description | Model's Supported | Controllable Values |
|----------------------------|----------------------|---------------------------------------------------------------|------------------------------------------------------|---------------------|
| **enabled** | Switch | Whether the hardware device is enabled (Switched on) | 200S, Dual200S, 300S, 600S, OasisMist, OasisMist1000 | [ON, OFF] |
| **display** | Switch | Whether the display is enabled (display is shown) | 200S, Dual200S, 300S, 600S, OasisMist, OasisMist1000 | [ON, OFF] |
| waterLacking | Switch | Indicator whether the unit is lacking water | 200S, Dual200S, 300S, 600S, OasisMist, OasisMist1000 | |
| humidityHigh | Switch | Indicator for high humidity | 200S, Dual200S, 300S, 600S, OasisMist | |
| waterTankLifted | Switch | Indicator for whether the water tank is removed | 200S, Dual200S, 300S, 600S, OasisMist, OasisMist1000 | |
| **stopAtHumiditySetpoint** | Switch | Whether the unit is set to stop when the set point is reached | 200S, Dual200S, 300S, 600S, OasisMist, OasisMist1000 | [ON, OFF] |
| humidity | Number:Dimensionless | Indicator for the currently measured humidity % level | 200S, Dual200S, 300S, 600S, OasisMist, OasisMist1000 | |
| **mistLevel** | Number:Dimensionless | The current mist level set | 300S | [1...2] |
| **mistLevel** | Number:Dimensionless | The current mist level set | 200S, Dual200S, 600S, OasisMist, OasisMist1000 | [1...3] |
| **humidifierMode** | String | The current mode of operation | 200S, Dual200S, 300S, 600S, OasisMist, OasisMist1000 | [auto, sleep] |
| **nightLightMode** | String | The night light mode | 200S, Dual200S, 300S | [on, dim, off] |
| **humiditySetpoint** | Number:Dimensionless | Humidity % set point to reach | 200S, Dual200S, 300S, 600S, OasisMist, OasisMist1000 | [30...80] |
| warmEnabled | Switch | Indicator for warm mist mode | 600S, OasisMist | |
| **warmLevel** | Number:Dimensionless | The current warm mist level set | 600S, OasisMist | [0..3] |
| errorCode | Number:Dimensionless | The error code reported by the device | OasisMist1000 | |
| timerExpiry | DateTime | The expected expiry time of the current timer | OasisMist1000 | |
| schedulesCount | Number:Dimensionless | The number schedules configured | OasisMist1000 | |

## Full Example

Expand Down Expand Up @@ -245,6 +248,26 @@ Number:Dimensionless LoungeAHMistLevel "Lounge Air Humidifier Mist Level
Number:Dimensionless LoungeAHWarmMistLevel "Lounge Air Humidifier Warm Mist Level" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:warmLevel" }
```

#### Air Humidifier Oasis Mist 1000 Smart Model

```java
Switch LoungeAHPower "Lounge Air Humidifier Power" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:enabled" }
Switch LoungeAHDisplay "Lounge Air Humidifier Display" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:display" }
String LoungeAHMode "Lounge Air Humidifier Mode" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:humidifierMode" }
Switch LoungeAHWaterLacking "Lounge Air Humidifier Water Lacking" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:waterLacking" }
Switch LoungeAHHighHumidity "Lounge Air Humidifier High Humidity" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:humidityHigh" }
Switch LoungeAHWaterTankRemoved "Lounge Air Humidifier Water Tank Removed" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:waterTankLifted" }
Number:Dimensionless LoungeAHHumidity "Lounge Air Humidifier Measured Humidity [%.0f %unit%]" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:humidity" }
Switch LoungeAHTargetStop "Lounge Air Humidifier Stop at target" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:stopAtTargetLevel" }
Number:Dimensionless LoungeAHTarget "Lounge Air Humidifier Target Humidity [%.0f %unit%]" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:humiditySetpoint" }
Number:Dimensionless LoungeAHMistLevel "Lounge Air Humidifier Mist Level" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:mistLevel" }
Number:Dimensionless LoungeAHWarmMistLevel "Lounge Air Humidifier Warm Mist Level" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:warmLevel" }
DateTime LoungeAHTimerExpiry "Lounge Air Humidifier Timer Expiry [%1$tA %1$tI:%1$tM %1$Tp]" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:timerExpiry" }
Number LoungeAHSchedulesCount "Lounge Air Humidifier Schedules Count" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:schedulesCount" }
Number LoungeAHErrorCode "Lounge Air Humidifier Error Code" { channel="vesync:airHumidifier:vesyncServers:loungeHumidifier:errorCode" }
```


### Configuration (*.sitemap)

#### Air Purifier Core 400S / 600S Model
Expand Down Expand Up @@ -362,7 +385,7 @@ Frame {
Frame {
Switch item=LoungeAHPower
Switch item=LoungeAHDisplay
Switch item=LoungeAHMode label="Mode" mappings=[auto="Auto", sleep="Sleeping"] icon="settings"
Switch item=LoungeAHMode label="Mode" mappings=[auto="Auto", manual="Manual Control", sleep="Sleeping"] icon="settings"
Text icon="none" item=LoungeAHWaterLacking
Text icon="none" item=LoungeAHHighHumidity
Text icon="none" item=LoungeAHWaterTankRemoved
Expand Down Expand Up @@ -392,6 +415,26 @@ Frame {
}
```

#### Air Humidifier Oasis Mist 1000 Smart Model

```perl
Frame {
Switch item=LoungeAHPower
Switch item=LoungeAHDisplay
Switch item=LoungeAHMode label="Mode" mappings=[auto="Auto", sleep="Sleeping"] icon="settings"
Text icon="none" item=LoungeAHWaterLacking
Text icon="none" item=LoungeAHHighHumidity
Text icon="none" item=LoungeAHWaterTankRemoved
Text icon="none" item=LoungeAHHumidity
Switch item=LoungeAHTargetStop
Slider item=LoungeAHTarget minValue=30 maxValue=80
Slider item=LoungeAHMistLevel minValue=1 maxValue=3
Slider item=LoungeAHWarmMistLevel minValue=1 maxValue=3
Text item=LoungeAHTimerExpiry label="Timer Shutdown @" icon="clock"
Text item=LoungeAHErrorCode label="Error Code [%.0f]"
}
```

### Credits

The binding code is based on a lot of work done by other developers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ public class VeSyncConstants {
public static final String DEVICE_CHANNEL_AF_NIGHT_LIGHT = "nightLightMode";
public static final String DEVICE_CHANNEL_AF_LIGHT_DETECTION = "lightDetection";
public static final String DEVICE_CHANNEL_AF_LIGHT_DETECTED = "lightDetected";
public static final String DEVICE_CHANNEL_SCHEDULE_COUNT = "scheduleCount";
public static final String DEVICE_CHANNEL_TIMER_EXPIRES = "timerExpires";

// Humidity related channels
public static final String DEVICE_CHANNEL_WATER_LACKS = "waterLacking";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,21 @@ protected String[] getChannelsToRemove() {
switch (deviceFamily) {
case DEV_FAMILY_CLASSIC_300S:
toRemove = new String[] { DEVICE_CHANNEL_WARM_ENABLED, DEVICE_CHANNEL_WARM_LEVEL,
DEVICE_CHANNEL_SCHEDULE_COUNT, DEVICE_CHANNEL_TIMER_EXPIRES };
DEVICE_CHANNEL_AF_SCHEDULES_COUNT, DEVICE_CHANNEL_AF_AUTO_OFF_CALC_TIME };
break;
case DEV_FAMILY_DUAL_200S:
case DEV_FAMILY_CLASSIC_200S:
toRemove = new String[] { DEVICE_CHANNEL_WARM_ENABLED, DEVICE_CHANNEL_WARM_LEVEL,
DEVICE_CHANNEL_AF_NIGHT_LIGHT, DEVICE_CHANNEL_SCHEDULE_COUNT,
DEVICE_CHANNEL_TIMER_EXPIRES };
DEVICE_CHANNEL_AF_NIGHT_LIGHT, DEVICE_CHANNEL_AF_SCHEDULES_COUNT,
DEVICE_CHANNEL_AF_AUTO_OFF_CALC_TIME };
break;
case DEV_FAMILY_OASIS_MIST_1000:
toRemove = new String[] { DEVICE_CHANNEL_WARM_ENABLED, DEVICE_CHANNEL_WARM_LEVEL,
DEVICE_CHANNEL_AF_NIGHT_LIGHT };
break;
case DEV_FAMILY_OASIS_MIST:
toRemove = new String[] { DEVICE_CHANNEL_AF_NIGHT_LIGHT, DEVICE_CHANNEL_SCHEDULE_COUNT,
DEVICE_CHANNEL_TIMER_EXPIRES };
toRemove = new String[] { DEVICE_CHANNEL_AF_NIGHT_LIGHT, DEVICE_CHANNEL_AF_SCHEDULES_COUNT,
DEVICE_CHANNEL_AF_AUTO_OFF_CALC_TIME };
break;
}
}
Expand Down Expand Up @@ -395,13 +395,7 @@ protected void pollForDeviceData(final ExpiringCache<String> cachedResponse) {
if (devContraints.protocolV2Version != 2) {
parseV2Ver1Poll((VeSyncV2BypassHumidifierStatus) humidifierStatus, deviceFamily);
} else {
parseV2Ver2Poll((VeSyncV2Ver2BypassHumidifierStatus) humidifierStatus);/*
* else {
* parseV2Ver1Poll((
* VeSyncV2BypassPurifierStatus)
* purifierStatus);
* }
*/
parseV2Ver2Poll((VeSyncV2Ver2BypassHumidifierStatus) humidifierStatus);
}
}

Expand Down Expand Up @@ -469,12 +463,12 @@ private void parseV2Ver2Poll(final VeSyncV2Ver2BypassHumidifierStatus humidifier
updateState(DEVICE_CHANNEL_CONFIG_TARGET_HUMIDITY,
new QuantityType<>(humidifierStatus.result.result.targetHumidity, Units.PERCENT));
updateState(DEVICE_CHANNEL_ERROR_CODE, new DecimalType(humidifierStatus.result.result.errorCode));
updateState(DEVICE_CHANNEL_SCHEDULE_COUNT, new DecimalType(humidifierStatus.result.result.scheduleCount));
updateState(DEVICE_CHANNEL_AF_SCHEDULES_COUNT, new DecimalType(humidifierStatus.result.result.scheduleCount));
if (humidifierStatus.result.result.timerRemain > 0) {
updateState(DEVICE_CHANNEL_TIMER_EXPIRES, new DateTimeType(LocalDateTime.now()
updateState(DEVICE_CHANNEL_AF_AUTO_OFF_CALC_TIME, new DateTimeType(LocalDateTime.now()
.plus(humidifierStatus.result.result.timerRemain, ChronoUnit.MINUTES).toString()));
} else {
updateState(DEVICE_CHANNEL_TIMER_EXPIRES, new DateTimeItem("nullEnforcements").getState());
updateState(DEVICE_CHANNEL_AF_AUTO_OFF_CALC_TIME, new DateTimeItem("nullEnforcements").getState());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,3 @@ channel-type.vesync.warmLevel.label = Warm Level
channel-type.vesync.warmLevel.description = Warm Level
channel-type.vesync.warmModeEnabled.label = Warm Mode Enabled
channel-type.vesync.warmModeEnabled.description = Indicator if the device is set to warm mist
channel-type.vesync.scheduleCount.label = Schedule Count
channel-type.vesync.scheduleCount.description = Schedule Count
channel-type.vesync.timerExpires.label = Timer Expires
channel-type.vesync.timerExpires.description = Timer Expires
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
<channel id="humiditySetpoint" typeId="deviceConfigTargetHumidity"/>
<channel id="warmEnabled" typeId="warmModeEnabled"/>
<channel id="warmLevel" typeId="warmLevel"/>
<channel id="scheduleCount" typeId="scheduleCount"/>
<channel id="timerExpires" typeId="timerExpires"/>
<channel id="schedulesCount" typeId="deviceAFConfigAutoScheduleCountType"/>
<channel id="timerExpiry" typeId="deviceAFTimerExpiry"/>
</channels>

<properties>
Expand Down Expand Up @@ -352,19 +352,4 @@
<state readOnly="false" pattern="%.0f"/>
</channel-type>

<channel-type id="scheduleCount">
<item-type>Number:Dimensionless</item-type>
<label>Schedule Count</label>
<description>Schedule Count</description>
<state readOnly="true" pattern="%.0f"/>
</channel-type>

<channel-type id="timerExpires">
<item-type>DateTime</item-type>
<label>Timer Expires</label>
<description>Timer Expires</description>
<state readOnly="true" pattern="%.0f"/>
</channel-type>


</thing:thing-descriptions>

0 comments on commit 5707696

Please sign in to comment.