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

Added support to washer-dryers to override some of the settings defined when a course is selected. Partial implementation of feature request #596 #716

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
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
27 changes: 27 additions & 0 deletions custom_components/smartthinq_sensors/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,33 @@ class ThinQSelectEntityDescription(
available_fn=lambda x: x.device.select_course_enabled,
value_fn=lambda x: x.device.selected_course,
),
# ThinQSelectEntityDescription(
# key="temp_selection",
# name="Set Water Temp",
# icon="mdi:tune-vertical-variant",
# options_fn=lambda x: x.device.temps_list,
# select_option_fn=lambda x, option: x.device.select_start_temp(option),
# available_fn=lambda x: x.device.select_temp_enabled,
# value_fn=lambda x: x.device.selected_temp,
# ),
# ThinQSelectEntityDescription(
# key="rinse_selection",
# name="Set Rinse Option",
# icon="mdi:tune-vertical-variant",
# options_fn=lambda x: x.device.rinses_list,
# select_option_fn=lambda x, option: x.device.select_start_rinse(option),
# available_fn=lambda x: x.device.select_rinse_enabled,
# value_fn=lambda x: x.device.selected_rinse,
# ),
# ThinQSelectEntityDescription(
# key="spin_selection",
# name="Set Spin Speed",
# icon="mdi:tune-vertical-variant",
# options_fn=lambda x: x.device.spins_list,
# select_option_fn=lambda x, option: x.device.select_start_spin(option),
# available_fn=lambda x: x.device.select_spin_enabled,
# value_fn=lambda x: x.device.selected_spin,
# ),
)
MICROWAVE_SELECT: tuple[ThinQSelectEntityDescription, ...] = (
ThinQSelectEntityDescription(
Expand Down
13 changes: 10 additions & 3 deletions custom_components/smartthinq_sensors/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,10 @@ def _async_discover_device(lge_devices: dict) -> None:
platform = current_platform.get()
platform.async_register_entity_service(
SERVICE_REMOTE_START,
{vol.Optional("course"): str},
{
vol.Optional("course"): str,
vol.Optional("overrides"): str
},
"async_remote_start",
[SUPPORT_WM_SERVICES],
)
Expand Down Expand Up @@ -729,11 +732,15 @@ def _get_sensor_state(self):

return None

async def async_remote_start(self, course: str | None = None):
async def async_remote_start(
self,
course: str | None = None,
overrides: str | None = None
):
"""Call the remote start command for WM devices."""
if self._api.type not in WM_DEVICE_TYPES:
raise NotImplementedError()
await self._api.device.remote_start(course)
await self._api.device.remote_start(course, overrides)

async def async_wake_up(self):
"""Call the wakeup command for WM devices."""
Expand Down
12 changes: 9 additions & 3 deletions custom_components/smartthinq_sensors/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ remote_start:
domain: sensor
fields:
course:
name: course
description: Course (if not set will use current)
name: Programme
description: The wash programme (course), if not set will use current.
required: false
selector:
text:

overrides:
name: Option overrides
description: A JSON dictionary containing the options to override and their new value as name:value pairs.
required: false
selector:
text:

wake_up:
name: WakeUp
description: Send to ThinQ device the wakeup command.
Expand Down
23 changes: 23 additions & 0 deletions custom_components/smartthinq_sensors/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,28 @@
}
},
"title": "SmartThinQ LGE Sensors"
},
"exceptions": {
"remote_start_disabled": {
"message": "Machine is off, asleep or running, or remote start is not enabled."
},
"course_name_required": {
"message": "Programme required if option overrides are specified."
},
"invalid_json": {
"message": "Option overrides contains invalid JSON. {error}"
},
"option_missing": {
"message": "Option overrides must contain at least one option from {friendly_list} or {internal_list}."
},
"option_cannot_be_overridden": {
"message": "The programme {course} does not allow the option {option} to be overridden. Permitted options are: {friendly_list} or {internal_list}."
},
"invalid_programme": {
"message": "The programme {name} is invalid. Permitted programmes are: {permitted}."
},
"invalid_option_value": {
"message": "The value {value} is invalid and has been ignored. The value for the option {option} must be one of: {friendly_list} or {internal_list}."
}
}
}
Loading