
    8iA                        S r SSKrSSKJrJr  SSKJrJr  SSKJ	r	  SSK
Jr  SSKJr  SS	KJrJrJrJrJr  SS
KJr  SSKJrJrJr  SSKJrJr  SSKJr  \R>                  " \ 5      r!\RD                  \RF                  \RH                  /r%\\/r&\RN                  \RP                  -  \RR                  -  r*\*\RV                  -  r,S\S\S\SS4S jr- " S S\\5      r. " S S\.5      r/ " S S\.5      r0g)zDyson climate platform.    N)ListOptional   )DATA_DEVICESDOMAIN)environmental_property)DysonPureHotCoolLink)ClimateEntity)
HVACActionFAN_DIFFUSE	FAN_FOCUSHVACModeClimateEntityFeature)ConfigEntry)ATTR_TEMPERATURE	CONF_NAMEUnitOfTemperature)CallableHomeAssistant)DysonEntityhassconfig_entryasync_add_entitiesreturnc                    #    U R                   [           [           UR                     nUR                   [           n[        U[        5      (       a  [        X45      nO[        X45      nU" U/5        g7f)z)Set up Dyson climate from a config entry.N)	datar   r   entry_idr   
isinstancer	   DysonPureHotCoolLinkEntityDysonPureHotCoolEntity)r   r   r   devicenameentitys         0/config/custom_components/dyson_local/climate.pyasync_setup_entryr%   !   sa      YYv|,\-B-BCFY'D&.//+F9'5x s   A1A3c                   H   \ rS rSrSrSr\S\4S j5       r\S\	\   4S j5       r
\S\4S j5       r\S\4S j5       rSS
 jrSS jr\S\4S j5       r\S\4S j5       r\S\4S j5       r\S\\   4S j5       r\S\4S j5       r\S 5       r\S 5       rS rS\4S jrSrg	)DysonClimateEntity.   z Dyson climate entity base class.Fr   c                     U R                   R                  (       d  [        R                  $ U R                   R                  (       a  [        R
                  $ [        R                  $ )zReturn hvac operation.)_deviceis_onr   OFFheat_mode_is_onHEATCOOLselfs    r$   	hvac_modeDysonClimateEntity.hvac_mode3   s<     ||!!<<<<''== }}    c                     [         $ )z2Return the list of available hvac operation modes.)
HVAC_MODESr0   s    r$   
hvac_modesDysonClimateEntity.hvac_modes<   s
     r4   c                 $   U R                   R                  (       d  [        R                  $ U R                   R                  (       a;  U R                   R
                  (       a  [        R                  $ [        R                  $ [        R                  $ )z*Return the current running hvac operation.)	r*   r+   r   r,   r-   heat_status_is_onHEATINGIDLECOOLINGr0   s    r$   hvac_actionDysonClimateEntity.hvac_actionA   sW     ||!!>>!<<''||--!)))??"!!!r4   c                     [         $ z&Return the list of supported features.)SUPPORT_FLAGSr0   s    r$   supported_features%DysonClimateEntity.supported_featuresL   s
     r4   Nc                 8    U R                   R                  5         g N)r*   turn_onr0   s    r$   rG   DysonClimateEntity.turn_onQ   s    r4   c                 8    U R                   R                  5         g rF   )r*   turn_offr0   s    r$   rJ   DysonClimateEntity.turn_offT   s    r4   c                 "    [         R                  $ )zReturn the unit of measurement.)r   CELSIUSr0   s    r$   temperature_unit#DysonClimateEntity.temperature_unitW   s     !(((r4   c                 4    U R                   R                  S-
  $ )zReturn the target temperature.  )r*   heat_targetr0   s    r$   target_temperature%DysonClimateEntity.target_temperature\   s     ||''#--r4   c                 .    U R                   R                  $ )z)Return the current temperature in kelvin.)r*   temperaturer0   s    r$   _current_temperature_kelvin.DysonClimateEntity._current_temperature_kelvina   s     ||'''r4   c                 f    U R                   n[        U[        5      (       a  g[        US-
  S 5      $ )zReturn the current temperature.Ngfffffq@z.1f)rW   r   strfloat)r1   temperature_kelvins     r$   current_temperature&DysonClimateEntity.current_temperaturef   s7     "==(#..+f4c:<<r4   c                 .    U R                   R                  $ )zReturn the current humidity.)r*   humidityr0   s    r$   current_humidity#DysonClimateEntity.current_humidityn   s     ||$$$r4   c                     g)zReturn the minimum temperature.r    r0   s    r$   min_tempDysonClimateEntity.min_temps   s     r4   c                     g)zReturn the maximum temperature.%   rd   r0   s    r$   max_tempDysonClimateEntity.max_tempx   s     r4   c                    UR                  [        5      nUc  [        R                  SU5        gX R                  :  d  X R
                  :  aA  [        R                  S5        [        U R
                  U5      n[        U R                  U5      n[        R                  SU R                  U5        U R                  R                  US-   5        g)zSet new target temperature.NzMissing target temperature %sz9Temperature requested is outside min/max range, adjustingzSet %s temperature %srQ   )getr   _LOGGERerrorre   ri   warningminmaxdebugr"   r*   set_heat_target)r1   kwargstarget_temps      r$   set_temperature"DysonClimateEntity.set_temperature}   s    jj!12MM96B&+*EOOWXdmm[9Kdmm[9K-tyy+F$$[3%67r4   r2   c                    [         R                  SU R                  U5        U[        R                  :X  a  U R
                  R                  5         O5U R
                  R                  (       d  U R
                  R                  5         U[        R                  :X  a  U R
                  R                  5         gU[        R                  :X  a  U R
                  R                  5         gg)zSet new hvac mode.zSet %s heat mode %sN)rm   rr   r"   r   r,   r*   rJ   r+   rG   r.   enable_heat_moder/   disable_heat_mode)r1   r2   s     r$   set_hvac_mode DysonClimateEntity.set_hvac_mode   s    +TYY	B$LL!!###LL  "%LL))+(--'LL**, (r4   rd   )r   N)__name__
__module____qualname____firstlineno____doc__+_enable_turn_on_off_backwards_compatibilitypropertyrZ   r2   r   r7   r>   intrC   rG   rJ   rN   rS   r   rW   r   r]   ra   re   ri   rv   r{   __static_attributes__rd   r4   r$   r'   r'   .   sG   *27/3   DI   "S " " C    )# ) ) .C . . (S ( ( =Xc] = = %# % %    8
-s 
-r4   r'   c                   x    \ rS rSrSr\S\4S j5       r\S\\   4S j5       r	\S\
4S j5       rS\SS4S	 jrS
rg)r      z Dyson Pure Hot+Cool Link entity.r   c                 P    U R                   R                  (       a  [        $ [        $ )zReturn the fan setting.)r*   
focus_moder   r   r0   s    r$   fan_mode#DysonPureHotCoolLinkEntity.fan_mode   s     <<""r4   c                     [         $ )z'Return the list of available fan modes.)	FAN_MODESr0   s    r$   	fan_modes$DysonPureHotCoolLinkEntity.fan_modes   s
     r4   c                     [         $ rA   )SUPPORT_FLAGS_LINKr0   s    r$   rC   -DysonPureHotCoolLinkEntity.supported_features   s
     "!r4   r   Nc                     [         R                  SU R                  U5        U[        :X  a  U R                  R                  5         gU[        :X  a  U R                  R                  5         gg)zSet fan mode of the device.zSet %s focus mode %sN)rm   rr   r"   r   r*   enable_focus_moder   disable_focus_mode)r1   r   s     r$   set_fan_mode'DysonPureHotCoolLinkEntity.set_fan_mode   sL    ,diiBy LL**,$LL++- %r4   rd   )r}   r~   r   r   r   r   rZ   r   r   r   r   rC   r   r   rd   r4   r$   r   r      sk    *#   49   "C " ".S .T .r4   r   c                       \ rS rSrSrSrg)r       zDyson Pure Hot+Cool entity.rd   N)r}   r~   r   r   r   r   rd   r4   r$   r    r       s    %r4   r    )1r   loggingtypingr   r   constr   r   utilsr   libdysonr	    homeassistant.components.climater
   &homeassistant.components.climate.constr   r   r   r   r   homeassistant.config_entriesr   homeassistant.constr   r   r   homeassistant.corer   r    r   	getLoggerr}   rm   r,   r/   r.   r6   r   TARGET_TEMPERATURETURN_ONTURN_OFFrB   FAN_MODEr   r%   r'   r   r    rd   r4   r$   <module>r      s      ! ' ) ) :  5 N N 6 


H
%llHMM8==9
$	$77:N:V:VVYmYvYvv"%9%B%BB 
!

!'2
!HP
!	
!h-m h-V.!3 .:&/ &r4   