Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[miio] Add Roborock S7/S7MaxV mop mode #16608

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions bundles/org.openhab.binding.miio/README.base.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ Additionally depending on the capabilities of your robot vacuum other channels m
| Switch | status#water_box_status | Water Box Status |
| Switch | status#lock_status | Lock Status |
| Number | status#water_box_mode | Water Box Mode |
| Number | status#mop_mode | Mop Mode |
| Switch | status#water_box_carriage_status | Water Box Carriage Status |
| Switch | status#mop_forbidden_enable | Mop Forbidden |
| Switch | status#is_locating | Robot is locating |
Expand Down
1 change: 1 addition & 0 deletions bundles/org.openhab.binding.miio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ Additionally depending on the capabilities of your robot vacuum other channels m
| Switch | status#water_box_status | Water Box Status |
| Switch | status#lock_status | Lock Status |
| Number | status#water_box_mode | Water Box Mode |
| Number | status#mop_mode | Mop Mode |
| Switch | status#water_box_carriage_status | Water Box Carriage Status |
| Switch | status#mop_forbidden_enable | Mop Forbidden |
| Switch | status#is_locating | Robot is locating |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public enum MiIoCommand {
SET_MODE("set_custom_mode"),
GET_MODE("get_custom_mode"),
SET_WATERBOX_MODE("set_water_box_custom_mode"),
SET_MOP_MODE("set_mop_mode"),

TIMERZONE_SET("set_timezone"),
TIMERZONE_GET("get_timezone"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ public void handleCommand(ChannelUID channelUID, Command command) {
forceStatusUpdate();
return;
}
if (channelUID.getId().equals(RobotCababilities.MOP_MODE.getChannel())) {
sendCommand(MiIoCommand.SET_MOP_MODE, "[" + command.toString() + "]");
forceStatusUpdate();
return;
}
if (channelUID.getId().equals(RobotCababilities.SEGMENT_CLEAN.getChannel()) && !command.toString().isEmpty()
&& !command.toString().contentEquals("-")) {
sendCommand(MiIoCommand.START_SEGMENT, "[" + command.toString() + "]");
Expand Down Expand Up @@ -383,6 +388,9 @@ private boolean updateVacuumStatus(JsonObject statusData) {
if (deviceCapabilities.containsKey(RobotCababilities.WATERBOX_MODE)) {
safeUpdateState(RobotCababilities.WATERBOX_MODE.getChannel(), statusInfo.getWaterBoxMode());
}
if (deviceCapabilities.containsKey(RobotCababilities.MOP_MODE)) {
safeUpdateState(RobotCababilities.MOP_MODE.getChannel(), statusInfo.getMopMode());
}
if (deviceCapabilities.containsKey(RobotCababilities.WATERBOX_STATUS)) {
safeUpdateState(RobotCababilities.WATERBOX_STATUS.getChannel(), statusInfo.getWaterBoxStatus());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public enum RobotCababilities {
WATERBOX_STATUS("water_box_status", "status#water_box_status", "miio:water_box_status", ""),
LOCKSTATUS("lock_status", "status#lock_status", "miio:lock_status", ""),
WATERBOX_MODE("water_box_mode", "status#water_box_mode", "miio:water_box_mode", ""),
MOP_MODE("mop_mode", "status#mop_mode", "miio:mop_mode", ""),
WATERBOX_CARRIAGE("water_box_carriage_status", "status#water_box_carriage_status", "miio:water_box_carriage_status",
""),
MOP_FORBIDDEN("mop_forbidden_enable", "status#mop_forbidden_enable", "miio:mop_forbidden_enable", ""),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public class StatusDTO {
@SerializedName("water_box_mode")
@Expose
private Integer waterBoxMode;
@SerializedName("mop_mode")
@Expose
private Integer mopMode;
@SerializedName("water_box_carriage_status")
@Expose
private Integer waterBoxCarriageStatus;
Expand Down Expand Up @@ -171,6 +174,10 @@ public final Integer getWaterBoxMode() {
return waterBoxMode;
}

public final Integer getMopMode() {
return mopMode;
}

public final Integer getWaterBoxCarriageStatus() {
return waterBoxCarriageStatus;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ channel-type.miio.total_clean_time.label = Total Cleaning Time
channel-type.miio.vacuum.label = Vacuum On/Off
channel-type.miio.water_box_carriage_status.label = Water Box Carriage State
channel-type.miio.water_box_mode.label = Water Box Mode
channel-type.miio.mop_mode.label = Mop Mode
channel-type.miio.water_box_status.label = Water Box State

# thing status descriptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@
<label>Water Box Mode</label>
<state min="200" max="204" step="1" pattern="%.0f%%" readOnly="false"/>
</channel-type>
<channel-type id="mop_mode">
<item-type>Number</item-type>
<label>Water Box Mode</label>
<state min="300" max="303" step="1" pattern="%.0f%%" readOnly="false"/>
</channel-type>
<channel-type id="water_box_status">
<item-type>Switch</item-type>
<label>Water Box State</label>
Expand Down