
    jg                     *    d Z ddlmZ  G d de      Zy)a  
 Python module to interface with Tuya WiFi smart devices

 Author: JonesMeUp
 Tested: LSC-Bell 8S(AKV300_8M)
 Note: Without hack the device can't be used offline. 
       With hack the DoorbellDevice is useless.
        
 For more information see https://github.com/jasonacox/tinytuya
    https://github.com/jasonacox/tinytuya/issues/162 

Offline Device
    This DoorbellDevice works only if the device is online. Most stay
    offline to preserve the battery.

 Local Control Classes
    DoorbellDevice(...)
        See OutletDevice() for constructor arguments

 Functions
    DoorbellDevice:
        set_basic_indicator(bool):
        set_volume(1-10):
        set_motion_area(x,y,lenX, lenY)
        set_motion_area_switch(bool)
   )Devicec                      e Zd ZdZi dddddddd	d
dddddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*Zi dddddddd	d
dddddddddd d!d"d#d+d$d,d%d-d&d.d'd/d(Zd5d0Zd6d1Zd7d2Zd8d3Z	y4)9DoorbellDevicez1
    Represents a Tuya based Video-Doorbell.
    101basic_indicator103
basic_flip104	basic_osd106motion_sensitivity108basic_nightvision109	sd_storge110	sd_status111	sd_format115movement_detect_pic117sd_format_state134motion_switch136doorbell_active150record_switch151record_mode154doorbell_pic155doorbell_ring_exist156chime_ring_tunechime_ring_volumebasic_device_volumechime_settingsmotion_area_switchmotion_areaalarm_message)157160165168169185r.   r/   r0   r1   r2   c                 <    | j                  dt        |      |       y)z Set the basic incicator e   N	set_valuebool)selfvalnowaits      L/DATA/.local/lib/python3.12/site-packages/tinytuya/Contrib/DoorbellDevice.pyset_basic_indicatorz"DoorbellDevice.set_basic_indicatorP   s    sDIv.    c                 X    |dk  rd}|dkD  rd}| j                  dt        |      |       y)z Set the doorbell volume    
      N)r7   int)r9   volr;   s      r<   
set_volumezDoorbellDevice.set_volumeT   s.    7C8CsCHf-r>   c                 F   |dk  rd}|dk  rd}|dkD  rd}|dkD  rd}|dk  rd}|dk  rd}|dkD  rd}|dkD  rd}||z   dkD  rd}d}||z   dkD  rd}d}dt        |      z   dz   t        |      z   dz   t        |      z   dz   t        |      z   d	z   }| j                  d
||       y)z& set the area of motion detection [%]     d      K   z{"num":1,"region0":{"x":z,"y":z,"xlen":z,"ylen":z}}   N)strr7   )r9   xyxlenylenr;   datas          r<   set_motion_areazDoorbellDevice.set_motion_area\   s    7A7As7As7AA:tA:t#:ct#:ctT63;14T63;14)#a&08Q?
J3t9TU__`cdh`iijnnsD&)r>   c                 <    | j                  dt        |      |       y)z) use the area of motion detection on/off    Nr6   )r9   useArear;   s      r<   set_motion_area_switchz%DoorbellDevice.set_motion_area_switcho   s    sDM62r>   N)TF)rA   F)rG   rG   2   rH   F)FF)
__name__
__module____qualname____doc__DPS_2_STATE
DPS_2_FUNCr=   rE   rR   rV    r>   r<   r   r       s    | 	{ 	#	
 	" 	{ 	{ 	{ 	$ 	  	 	  	 	} 	~  	$!" 	 #$ #$#/K2 | 	{ 	#	
 	" 	{ 	 	 	} 	$ 	  	" 	$ 	 	#  	}!J&/.*&3r>   r   N)r[   corer   r   r^   r>   r<   <module>r`      s   6 Q3V Q3r>   