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

Expose LG's sleep mode function #584

Merged
merged 7 commits into from
Aug 27, 2023
Merged

Expose LG's sleep mode function #584

merged 7 commits into from
Aug 27, 2023

Conversation

ldotlopez
Copy link
Contributor

@ldotlopez ldotlopez commented Aug 17, 2023

Enable sleep mode for LG's AC devices

This PR exposes sleep timer as a switch. This mode reduces energy consumption and fan noise, it also introduces some automatic adjustments

Detailed explanations from LG's user manual:

  • In the Cooling and Dehumidification Mode, the
    temperature increases by 1 °C after 30 minutes
    and additional 1 °C after another 30 minutes for a
    more comfortable sleep.

  • The temperature increases up to 2 °C from the
    preset temperature.

  • Although the remark for fan speed on the display
    screen may be changed, the fan speed is adjusted
    automatically.

Use case

In a hot night we can setup an script/automation which will balance conform and energy consumption

  • Enable jet mode for X minutes or until temperature reaches Y degrees
  • Then, change to cool/dry mode for certain amount of time or until temperate reaches lower threshold
  • Finally, enable "sleep mode" for the rest of the night.

Why is better that automations or auto mode?

The first two steps are doable with current H-A capabilities but the third, in my experience, can't be reproducible with any combination of fan speeds or temperature. Also, LG's devices beeps each time a settings is changed. Changing settings in the middle of the night via some automations can result in a orchestra of beepings. LG's sleep mode doesn't have this problem.

Further work

This PR is presented as first approach to integrate sleep mode.

Currently it's exposed as a switch. When enabled, this mode is activated with a 7 hours timer. After 7 hours it goes back to off.

Further discussion and work should determine other behavior as:

  • it's the 'switch' control the right interface?
  • should the timer be autoreset before it goes to 0?
  • should be the default timer 7 hours?

Previous discussions:

@ollo69
Copy link
Owner

ollo69 commented Aug 19, 2023

  • it's the 'switch' control the right interface?

My opinion is that this should be implemented as a service with a parameter to set the duration.
A sensor can be used to identify if the function is enabled.

@ldotlopez
Copy link
Contributor Author

  • it's the 'switch' control the right interface?

My opinion is that this should be implemented as a service with a parameter to set the duration. A sensor can be used to identify if the function is enabled.

@ollo69, done

services are not my best skill but I based my code on your existing ones.

Copy link
Owner

@ollo69 ollo69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look to my comments

custom_components/smartthinq_sensors/sensor.py Outdated Show resolved Hide resolved
custom_components/smartthinq_sensors/sensor.py Outdated Show resolved Hide resolved
custom_components/smartthinq_sensors/services.yaml Outdated Show resolved Hide resolved
custom_components/smartthinq_sensors/wideq/device_info.py Outdated Show resolved Hide resolved
custom_components/smartthinq_sensors/wideq/devices/ac.py Outdated Show resolved Hide resolved
@ollo69
Copy link
Owner

ollo69 commented Aug 26, 2023

@ldotlopez,

I did some changes on the logic used to control if status is available, range used to call the service and service availability.
I also rebased branch with master.
Please check if everything look fine for you and ask if something is not clear,

If ok I think we can merge.

Thanks.👍

@ldotlopez
Copy link
Contributor Author

ldotlopez commented Aug 27, 2023

@ollo69

It's OK for me.

Thanks 👍

@ollo69 ollo69 merged commit 0524c16 into ollo69:master Aug 27, 2023
5 checks passed
@gitmarecki
Copy link

I've been looking forward to the sleep mode, but it looks like this does not work correctly on my device (LG I38TKF - 3 ton, split inverter) - I can't see the switch entity for the sleep mode. Moreover since 33.3 the jet mode switch is now shown as unavailable - might be related?
It does properly expose the entity _sensor.sleep_time . Is there any specific procedure to reload all entities to recognize/expose/identify the new switch? (besides removing and adding again?).

@gitmarecki
Copy link

Is there any specific procedure to reload all entities to recognize/expose/identify the new switch? (besides removing and adding again?).

I tried re-enrolling a new account on another HA instance with latest SmartThinQ LGE Sensors integration (0.33.3) and the problem is the same - the device is controllable, but the sleep button is still not discovered (sleep_time is there and it is properly reporting when sleep mode is initiated from the app).

Can I share any logs with devs? Maybe this could help fixing this bug?

@ldotlopez
Copy link
Contributor Author

Hi @gitmarecki

You should file an issue for better tracking.

However, I can only talk about sleep mode which is the feature I developed: there is not sleep button, you should call the smartthinq_sensors.set_sleep_time service to start sleep mode.

@gitmarecki
Copy link

how did I miss that? :D It works! THANK YOU! where's the buy-me-a-coffee button? :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants