
    8i                         S r SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJrJr  SS	KJr  SS
KJr  SSKJrJr  SSKJr  \R0                  " \5      r\" SS9rS\S\	S\SS4S jr " S S\5      rg)z Camera platform for Dyson cloud.    )CallableN)	timedelta)HomeAssistant)ConfigEntry)Camera)DEVICE_TYPE_360_EYEDEVICE_TYPE_360_HEURIST)DysonCloud360Eye)DysonDeviceInfo   )DATA_ACCOUNTDATA_DEVICES)DOMAIN   )minuteshassconfig_entryasync_add_entitiesreturnc           	      "  #    U R                   [           UR                     nU[           nU[           n/ nU HH  nUR
                  [        4;  a  M  UR                  [        [        XGR                  5      U5      5        MJ     U" US5        g7f)z%Set up Dyson fan from a config entry.TN)datar   entry_idr   r   product_typer   appendDysonCleaningMapEntityr
   serial)r   r   r   r   accountdevicesentitiesdevices           //config/custom_components/dyson_local/camera.pyasync_setup_entryr"      s      99V\223D< G< GH':&;;.Wmm4
 	  x&s   BBc                      ^  \ rS rSrSrS\S\4U 4S j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S jrS rSrU =r$ )r   (   z!Dyson vacuum cleaning map entity.r    device_infoc                 V   > [         TU ]  5         Xl        X l        S U l        S U l        g )N)super__init___device_device_info_last_cleaning_task_image)selfr    r%   	__class__s      r!   r(   DysonCleaningMapEntity.__init__+   s(    '#'     r   c                 4    U R                   R                   S3$ )zReturn entity name.z Cleaning Map)r*   namer-   s    r!   r2   DysonCleaningMapEntity.name2   s     ##(()77r0   c                 .    U R                   R                  $ )zReturn entity unique id.)r*   r   r3   s    r!   	unique_id DysonCleaningMapEntity.unique_id7   s       '''r0   c                     [         U R                  R                  41U R                  R                  SU R                  R                  U R                  R
                  S.$ )z!Return device info of the entity.Dyson)identifiersr2   manufacturermodel
sw_version)r   r*   r   r2   r   versionr3   s    r!   r%   "DysonCleaningMapEntity.device_info<   sU     $T%6%6%=%=>?%%**#&&33++33
 	
r0   c                     g)zReturn entity icon.zmdi:map r3   s    r!   iconDysonCleaningMapEntity.iconG   s     r0   c                     U R                   $ )z2Return cleaning map. Width and height are ignored.)r,   )r-   widthheights      r!   camera_image#DysonCleaningMapEntity.camera_imageL   s    {{r0   c                    [         R                  SU R                  R                  5        U R                  R                  5       nSnU H  nUR                  S:  d  M  Un  O   Uc  [         R                  S5        SU l        gX R                  :X  a  [         R                  S5        gX l        U R                  R                  U R                  R                  5      U l
        g)zCheck for map update.z"Running cleaning map update for %sNg        zNo cleaning history found.z'Cleaning task not changed. Skip update.)_LOGGERdebugr*   r2   r)   get_cleaning_historyarear+   get_cleaning_mapcleaning_idr,   )r-   cleaning_tasks	last_tasktasks       r!   updateDysonCleaningMapEntity.updateP   s    :D<M<M<R<RS::<	"Dyy3 		 #
 MM67'+D$000MMCD#, ll33$$00
r0   )r)   r*   r,   r+   )NN)__name__
__module____qualname____firstlineno____doc__r
   r   r(   propertystrr2   r6   dictr%   rB   rG   rS   __static_attributes____classcell__)r.   s   @r!   r   r   (   s    +/ o  8c 8 8 (3 ( ( 
T 
 
 c  
 
r0   r   )rY   typingr   loggingdatetimer   homeassistant.corer   homeassistant.config_entriesr   homeassistant.components.camerar   libdyson.constr   r	   libdyson.cloud.cloud_360_eyer
   libdyson.cloudr   cloud.constr   r   constr   	getLoggerrU   rJ   SCAN_INTERVALr"   r   rA   r0   r!   <module>rl      st    &    , 4 2 G 9 * 3 


H
%"%'
''2'HP'	'$>
V >
r0   