#NEWLINE# def test_device_tracker_test1_nearest_after_test2_in_ignored_zone( self ) : #NEWLINE# #INDENT# 'Test for tracker states.' #NEWLINE# self . hass . states . set ( 'device_tracker.test1' , 'not_home' , { #NEWLINE# #INDENT# 'friendly_name' : 'test1' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . hass . pool . block_till_done ( ) #NEWLINE# self . hass . states . set ( 'device_tracker.test2' , 'not_home' , { #NEWLINE# #INDENT# 'friendly_name' : 'test2' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . hass . pool . block_till_done ( ) #NEWLINE# assert proximity . setup ( state . hass , { #NEWLINE# #INDENT# 'proximity' : { #NEWLINE# #INDENT# 'zone' : 'home' , #NEWLINE# 'ignored_zones' : { 'work' } , #NEWLINE# 'devices' : { 'device_tracker.test1' , 'device_tracker.test2' } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . hass . states . set ( 'device_tracker.test1' , 'not_home' , { #NEWLINE# #INDENT# 'friendly_name' : 'test1' , #NEWLINE# 'latitude' : 20.1 , #NEWLINE# 'longitude' : 10.1 , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . hass . pool . block_till_done ( ) #NEWLINE# state = self . hass . states . get ( 'proximity.home' ) #NEWLINE# assert ( state . attributes . get ( 'nearest' ) == 'test1' ) #NEWLINE# assert ( state . attributes . get ( 'dir_of_travel' ) == 'unknown' ) #NEWLINE# self . hass . states . set ( 'device_tracker.test2' , 'not_home' , { #NEWLINE# #INDENT# 'friendly_name' : 'test2' , #NEWLINE# 'latitude' : 10.1 , #NEWLINE# 'longitude' : 5.1 , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . hass . pool . block_till_done ( ) #NEWLINE# state = self . hass . states . get ( 'proximity.home' ) #NEWLINE# assert ( state . attributes . get ( 'nearest' ) == 'test2' ) #NEWLINE# assert ( state . attributes . get ( 'dir_of_travel' ) == 'unknown' ) #NEWLINE# self . hass . states . set ( 'device_tracker.test2' , 'work' , { #NEWLINE# #INDENT# 'friendly_name' : 'test2' , #NEWLINE# 'latitude' : 12.6 , #NEWLINE# 'longitude' : 7.6 , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . hass . pool . block_till_done ( ) #NEWLINE# state = self . hass . states . get ( 'proximity.home' ) #NEWLINE# assert ( state . attributes . get ( 'nearest' ) == 'test1' ) #NEWLINE# assert ( state . attributes . get ( 'dir_of_travel' ) == 'unknown' )