fredrike / pydaikin

GNU General Public License v3.0
8 stars 9 forks source link

Temperature setting is missing when switching mode from "Fan Only" to "Heat/Cool" #31

Open chiahsing opened 1 month ago

chiahsing commented 1 month ago

Follow up on https://github.com/home-assistant/core/issues/126089

Issue:

Temperature setting is missing when switching mode directly from "Fan Only" to "Heat/Cool". Switching from "Fan Only" to "Cool" to "Heat/Cool" is fine as the temperature setting is restored when switching to "Cool".

Log:

Switch from Off to Cool

2024-09-19 20:05:10.344 DEBUG (MainThread) [pydaikin.daikin_base] Calling: https://192.168.36.169/aircon/get_control_info {} [{'X-Daikin-uuid': '7c8d62335baf4778b98ba0304916a962'}]
2024-09-19 20:05:12.266 DEBUG (MainThread) [pydaikin.daikin_brp069] Parsing ret=OK,pow=0,mode=6,adv=,stemp=--,shum=--,dt1=26.0,dt2=M,dt3=26.0,dt4=25.0,dt5=25.0,dt7=26.0,dh1=0,dh2=50,dh3=0,dh4=0,dh5=0,dh7=0,dhh=50,b_mode=6,b_stemp=--,b_shum=--,alert=255
2024-09-19 20:05:12.269 DEBUG (MainThread) [pydaikin.daikin_brp069] Sending request to aircon/set_control_info with params: {'mode': '3', 'pow': '1', 'shum': '0', 'stemp': '26.0'}
2024-09-19 20:05:12.270 DEBUG (MainThread) [pydaikin.daikin_base] Calling: https://192.168.36.169/aircon/set_control_info {'mode': '3', 'pow': '1', 'shum': '0', 'stemp': '26.0'} [{'X-Daikin-uuid': '7c8d62335baf4778b98ba0304916a962'}]
2024-09-19 20:05:14.151 DEBUG (MainThread) [pydaikin.daikin_brp069] Parsing ret=OK,adv=

Switching from Cool to Fan Only

2024-09-19 20:05:24.383 DEBUG (MainThread) [pydaikin.daikin_base] Calling: https://192.168.36.169/aircon/get_control_info {} [{'X-Daikin-uuid': '7c8d62335baf4778b98ba0304916a962'}]
2024-09-19 20:05:26.227 DEBUG (MainThread) [pydaikin.daikin_brp069] Parsing ret=OK,pow=1,mode=3,adv=,stemp=26.0,shum=0,dt1=26.0,dt2=M,dt3=26.0,dt4=25.0,dt5=25.0,dt7=26.0,dh1=0,dh2=50,dh3=0,dh4=0,dh5=0,dh7=0,dhh=50,b_mode=3,b_stemp=26.0,b_shum=0,alert=255
2024-09-19 20:05:26.229 DEBUG (MainThread) [pydaikin.daikin_brp069] Sending request to aircon/set_control_info with params: {'mode': '6', 'pow': '1', 'shum': '0', 'stemp': '26.0'}
2024-09-19 20:05:26.230 DEBUG (MainThread) [pydaikin.daikin_base] Calling: https://192.168.36.169/aircon/set_control_info {'mode': '6', 'pow': '1', 'shum': '0', 'stemp': '26.0'} [{'X-Daikin-uuid': '7c8d62335baf4778b98ba0304916a962'}]
2024-09-19 20:05:28.126 DEBUG (MainThread) [pydaikin.daikin_brp069] Parsing ret=OK,adv=

Switching from Fan Only to Heat/Cool

2024-09-19 20:05:34.030 DEBUG (MainThread) [pydaikin.daikin_base] Calling: https://192.168.36.169/aircon/get_control_info {} [{'X-Daikin-uuid': '7c8d62335baf4778b98ba0304916a962'}]
2024-09-19 20:05:36.275 DEBUG (MainThread) [pydaikin.daikin_brp069] Parsing ret=OK,pow=1,mode=6,adv=,stemp=--,shum=--,dt1=26.0,dt2=M,dt3=26.0,dt4=25.0,dt5=25.0,dt7=26.0,dh1=0,dh2=50,dh3=0,dh4=0,dh5=0,dh7=0,dhh=50,b_mode=6,b_stemp=--,b_shum=--,alert=255
2024-09-19 20:05:36.276 DEBUG (MainThread) [pydaikin.daikin_brp069] Sending request to aircon/set_control_info with params: {'mode': '0', 'pow': '1', 'shum': '--', 'stemp': '--'}
2024-09-19 20:05:36.277 DEBUG (MainThread) [pydaikin.daikin_base] Calling: https://192.168.36.169/aircon/set_control_info {'mode': '0', 'pow': '1', 'shum': '--', 'stemp': '--'} [{'X-Daikin-uuid': '7c8d62335baf4778b98ba0304916a962'}]
2024-09-19 20:05:38.120 DEBUG (MainThread) [pydaikin.daikin_brp069] Parsing ret=PARAM NG

The last one set both stemp and shum with '--' and the request failed.

chiahsing commented 1 month ago

It looks like mode for 'Heat/Cool' is 0, but there is no dt0 in current_val, so it fails to set stemp.

https://github.com/fredrike/pydaikin/blob/master/pydaikin/daikin_brp069.py#L177-L182

Or, '--' is actually a value, so it doesn't even bother to look for dt0?

fredrike commented 1 month ago

Yes, you are right if val == "--" we should skip updating.

chiahsing commented 1 month ago

I am not familir with this, but if there's a guide or instructions on showing how to set up the development env, maybe I can contribute a patch to fix this. Thanks!