python-daikinapi icon indicating copy to clipboard operation
python-daikinapi copied to clipboard

ValueError for target temperature in dehumidificator mode

Open KaiRo-at opened this issue 4 years ago • 6 comments

I did set my A/C to dehumidificator mode (mode = 2), and then reading the target_temperature causes a ValueError, see the following snippet:

  File "/path/to/myproject/venv/lib/python3.8/site-packages/daikinapi/daikinapi.py", line 182, in target_temperature
    return float(self._get_control()["stemp"])
ValueError: could not convert string to float: 'M'

KaiRo-at avatar Aug 28 '20 23:08 KaiRo-at

This is in debug output BTW:

2020-08-29 00:50:40,728 connectionpool.py:226 DEBUG Starting new HTTP connection (1): 192.168.x.x:80
2020-08-29 00:50:40,832 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /common/basic_info HTTP/1.1" 200 288
2020-08-29 00:50:40,832 daikinapi.py:52 DEBUG ret=OK,type=aircon,reg=eu,dst=1,ver=1_2_51,rev=D3A0C9F,pow=1,err=0,location=0,name=%4b%61%69%52%6f%20%4f%66%66%69%63%65,icon=3,method=home only,port=30050,id=,pw=,lpw_flag=0,adp_kind=3,pv=3.20,cpv=3,cpv_minor=20,led=1,en_setzone=1,mac=809133E80498,adp_mode=run,en_hol=0,grp_name=,en_grp=0
[...]
2020-08-29 01:05:29,086 connectionpool.py:226 DEBUG Starting new HTTP connection (1): 192.168.x.x:80
2020-08-29 01:05:29,190 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /aircon/get_control_info HTTP/1.1" 200 344
2020-08-29 01:05:29,191 daikinapi.py:52 DEBUG ret=OK,pow=1,mode=2,adv=,stemp=M,shum=0,dt1=22.0,dt2=M,dt3=22.0,dt4=25.0,dt5=25.0,dt7=22.0,dh1=0,dh2=0,dh3=0,dh4=0,dh5=0,dh7=0,dhh=50,b_mode=2,b_stemp=M,b_shum=0,alert=255,f_rate=A,f_dir=0,b_f_rate=B,b_f_dir=0,dfr1=B,dfr2=B,dfr3=B,dfr4=5,dfr5=5,dfr6=5,dfr7=B,dfrh=5,dfd1=0,dfd2=0,dfd3=0,dfd4=0,dfd5=0,dfd6=0,dfd7=0,dfdh=0,dmnd_run=0,en_demand=0

KaiRo-at avatar Aug 28 '20 23:08 KaiRo-at

And FWIW, it's similar in mode 6 (FAN), with this output:

2020-08-29 01:30:42,893 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /aircon/get_control_info HTTP/1.1" 200 348
2020-08-29 01:30:42,893 daikinapi.py:52 DEBUG ret=OK,pow=1,mode=6,adv=,stemp=--,shum=--,dt1=22.0,dt2=M,dt3=22.0,dt4=25.0,dt5=25.0,dt7=22.0,dh1=0,dh2=0,dh3=0,dh4=0,dh5=0,dh7=0,dhh=50,b_mode=6,b_stemp=--,b_shum=--,alert=255,f_rate=A,f_dir=0,b_f_rate=A,b_f_dir=0,dfr1=B,dfr2=B,dfr3=B,dfr4=5,dfr5=5,dfr6=A,dfr7=B,dfrh=5,dfd1=0,dfd2=0,dfd3=0,dfd4=0,dfd5=0,dfd6=0,dfd7=0,dfdh=0,dmnd_run=0,en_demand=0

And then, I can't get set any other mode any more from daikinapi, I guess because stemp and maybe shum are invalid for those modes but we send them together with the new mode, see also the following output:

2020-08-29 01:35:10,811 connectionpool.py:226 DEBUG Starting new HTTP connection (1): 192.168.x.x:80
2020-08-29 01:35:10,931 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /aircon/get_control_info HTTP/1.1" 200 348
2020-08-29 01:35:10,932 daikinapi.py:52 DEBUG ret=OK,pow=1,mode=6,adv=,stemp=--,shum=--,dt1=22.0,dt2=M,dt3=22.0,dt4=25.0,dt5=25.0,dt7=22.0,dh1=0,dh2=0,dh3=0,dh4=0,dh5=0,dh7=0,dhh=50,b_mode=6,b_stemp=--,b_shum=--,alert=255,f_rate=A,f_dir=0,b_f_rate=A,b_f_dir=0,dfr1=B,dfr2=B,dfr3=B,dfr4=5,dfr5=5,dfr6=A,dfr7=B,dfrh=5,dfd1=0,dfd2=0,dfd3=0,dfd4=0,dfd5=0,dfd6=0,dfd7=0,dfdh=0,dmnd_run=0,en_demand=0
2020-08-29 01:35:10,932 daikinapi.py:66 DEBUG {'f_dir': '0', 'f_rate': 'A', 'mode': 3, 'pow': '1', 'shum': '--', 'stemp': '--'}
2020-08-29 01:35:10,936 connectionpool.py:226 DEBUG Starting new HTTP connection (1): 192.168.13.30:80
2020-08-29 01:35:11,042 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /aircon/set_control_info?f_dir=0&f_rate=A&mode=3&pow=1&shum=--&stemp=-- HTTP/1.1" 200 12
2020-08-29 01:35:11,043 daikinapi.py:69 DEBUG ret=PARAM NG
[...]
2020-08-29 01:35:12,711 connectionpool.py:226 DEBUG Starting new HTTP connection (1): 192.168.x.x:80
2020-08-29 01:35:12,817 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /aircon/get_control_info HTTP/1.1" 200 348
2020-08-29 01:35:12,818 daikinapi.py:52 DEBUG ret=OK,pow=1,mode=6,adv=,stemp=--,shum=--,dt1=22.0,dt2=M,dt3=22.0,dt4=25.0,dt5=25.0,dt7=22.0,dh1=0,dh2=0,dh3=0,dh4=0,dh5=0,dh7=0,dhh=50,b_mode=6,b_stemp=--,b_shum=--,alert=255,f_rate=A,f_dir=0,b_f_rate=A,b_f_dir=0,dfr1=B,dfr2=B,dfr3=B,dfr4=5,dfr5=5,dfr6=A,dfr7=B,dfrh=5,dfd1=0,dfd2=0,dfd3=0,dfd4=0,dfd5=0,dfd6=0,dfd7=0,dfdh=0,dmnd_run=0,en_demand=0
2

Compare to that what gets done when I switch from auto (set via the remote control) to cool via daikinapi:

020-08-29 01:39:19,295 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /aircon/get_control_info HTTP/1.1" 200 350
2020-08-29 01:39:19,296 daikinapi.py:52 DEBUG ret=OK,pow=1,mode=7,adv=,stemp=25.0,shum=0,dt1=25.0,dt2=M,dt3=25.0,dt4=25.0,dt5=25.0,dt7=25.0,dh1=0,dh2=0,dh3=0,dh4=0,dh5=0,dh7=0,dhh=50,b_mode=7,b_stemp=25.0,b_shum=0,alert=255,f_rate=B,f_dir=0,b_f_rate=B,b_f_dir=0,dfr1=B,dfr2=B,dfr3=B,dfr4=5,dfr5=5,dfr6=A,dfr7=B,dfrh=5,dfd1=0,dfd2=0,dfd3=0,dfd4=0,dfd5=0,dfd6=0,dfd7=0,dfdh=0,dmnd_run=0,en_demand=0
2020-08-29 01:39:19,297 daikinapi.py:66 DEBUG {'f_dir': '0', 'f_rate': 'B', 'mode': 3, 'pow': '1', 'shum': '0', 'stemp': '25.0'}
2020-08-29 01:39:19,301 connectionpool.py:226 DEBUG Starting new HTTP connection (1): 192.168.x.x:80
2020-08-29 01:39:19,406 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /aircon/set_control_info?f_dir=0&f_rate=B&mode=3&pow=1&shum=0&stemp=25.0 HTTP/1.1" 200 11
2020-08-29 01:39:19,407 daikinapi.py:69 DEBUG ret=OK,adv=
2020-08-29 01:39:27,454 connectionpool.py:226 DEBUG Starting new HTTP connection (1): 192.168.x.x:80
2020-08-29 01:39:27,558 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /aircon/get_sensor_info HTTP/1.1" 200 51
2020-08-29 01:39:27,559 daikinapi.py:52 DEBUG ret=OK,htemp=22.0,hhum=-,otemp=20.0,err=0,cmpfreq=0
2020-08-29 01:39:27,563 connectionpool.py:226 DEBUG Starting new HTTP connection (1): 192.168.x.x:80
2020-08-29 01:39:27,675 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /aircon/get_control_info HTTP/1.1" 200 350
2020-08-29 01:39:27,676 daikinapi.py:52 DEBUG ret=OK,pow=1,mode=3,adv=,stemp=25.0,shum=0,dt1=25.0,dt2=M,dt3=25.0,dt4=25.0,dt5=25.0,dt7=25.0,dh1=0,dh2=0,dh3=0,dh4=0,dh5=0,dh7=0,dhh=50,b_mode=3,b_stemp=25.0,b_shum=0,alert=255,f_rate=B,f_dir=0,b_f_rate=B,b_f_dir=0,dfr1=B,dfr2=B,dfr3=B,dfr4=5,dfr5=5,dfr6=A,dfr7=B,dfrh=5,dfd1=0,dfd2=0,dfd3=0,dfd4=0,dfd5=0,dfd6=0,dfd7=0,dfdh=0,dmnd_run=0,en_demand=0

KaiRo-at avatar Aug 28 '20 23:08 KaiRo-at

Sorry for another comment, but interestingly, switching from mode 2 (dehumificator) to mode 3 (cool) seems to work, it only gets stuck in fan mode, so it seems like 'M' is valid for set_control_info:

2020-08-29 01:49:10,950 connectionpool.py:226 DEBUG Starting new HTTP connection (1): 192.168.x.x:80
2020-08-29 01:49:11,057 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /aircon/get_control_info HTTP/1.1" 200 344
2020-08-29 01:49:11,057 daikinapi.py:52 DEBUG ret=OK,pow=1,mode=2,adv=,stemp=M,shum=0,dt1=25.0,dt2=M,dt3=25.0,dt4=25.0,dt5=25.0,dt7=25.0,dh1=0,dh2=0,dh3=0,dh4=0,dh5=0,dh7=0,dhh=50,b_mode=2,b_stemp=M,b_shum=0,alert=255,f_rate=A,f_dir=0,b_f_rate=A,b_f_dir=0,dfr1=B,dfr2=A,dfr3=B,dfr4=5,dfr5=5,dfr6=A,dfr7=B,dfrh=5,dfd1=0,dfd2=0,dfd3=0,dfd4=0,dfd5=0,dfd6=0,dfd7=0,dfdh=0,dmnd_run=0,en_demand=0
2020-08-29 01:49:11,058 daikinapi.py:66 DEBUG {'f_dir': '0', 'f_rate': 'A', 'mode': 3, 'pow': '1', 'shum': '0', 'stemp': 'M'}
2020-08-29 01:49:11,061 connectionpool.py:226 DEBUG Starting new HTTP connection (1): 192.168.13.30:80
2020-08-29 01:49:11,166 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /aircon/set_control_info?f_dir=0&f_rate=A&mode=3&pow=1&shum=0&stemp=M HTTP/1.1" 200 11
2020-08-29 01:49:11,167 daikinapi.py:69 DEBUG ret=OK,adv=
2020-08-29 01:49:20,741 connectionpool.py:226 DEBUG Starting new HTTP connection (1): 192.168.x.x:80
2020-08-29 01:49:20,854 connectionpool.py:433 DEBUG http://192.168.x.x:80 "GET /aircon/get_control_info HTTP/1.1" 200 344
2020-08-29 01:49:20,855 daikinapi.py:52 DEBUG ret=OK,pow=1,mode=3,adv=,stemp=25.0,shum=0,dt1=25.0,dt2=M,dt3=M,dt4=25.0,dt5=25.0,dt7=25.0,dh1=0,dh2=0,dh3=0,dh4=0,dh5=0,dh7=0,dhh=50,b_mode=3,b_stemp=M,b_shum=0,alert=255,f_rate=A,f_dir=0,b_f_rate=A,b_f_dir=0,dfr1=B,dfr2=A,dfr3=A,dfr4=5,dfr5=5,dfr6=A,dfr7=B,dfrh=5,dfd1=0,dfd2=0,dfd3=0,dfd4=0,dfd5=0,dfd6=0,dfd7=0,dfdh=0,dmnd_run=0,en_demand=0

(And FWIW, 25°C was the stemp before I switched to mode 2.)

KaiRo-at avatar Aug 28 '20 23:08 KaiRo-at

Hello @KaiRo-at,

Thanks for reporting, as I don't use dehumidifier mode (and not too much testing) I did not catch this. Would you be interested to submit a pull request?

Cheers, Aarno

arska avatar Sep 25 '21 22:09 arska

Thanks for reporting, as I don't use dehumidifier mode (and not too much testing) I did not catch this. Would you be interested to submit a pull request?

I also usually do not use it but when my setup was new, I played around a bit to see how things are working - and I had a wall in my office that was wet from a minor water damage so I did run the dehumidifer mode for a number of nights to help dry that up.

Not sure how much time I'll have to look into a potential pull request as I'm short on time in general, but I'll keep this marked as something to look into.

KaiRo-at avatar Sep 26 '21 14:09 KaiRo-at

Cool, thanks, so leaving this issue open for now :)

arska avatar Sep 26 '21 17:09 arska

I've run into this problem myself some time ago too. * When switched to fan-mode the temperature target becomes '--' * When switched to drying mode the temperature target becomes 'M'

I solved this application-side by replacing the temperature target by the actual temperature in case of a ValueError (ref). Of course this can also be solved API-side in a similar way.

Mausy5043 avatar Apr 08 '23 08:04 Mausy5043

#18 proposes a change to the API that would fix this issue API-side but may have impact on applications that are expecting a numerical result.

Mausy5043 avatar Apr 08 '23 09:04 Mausy5043