@@ -120,6 +120,7 @@ def __init__(self, hass: HomeAssistant, events: list, address: str, port: int, r
120
120
self .events : list = events
121
121
self ._supports_coaxial_control = False
122
122
self ._supports_disarming_linkage = False
123
+ self ._supports_event_notifications = False
123
124
self ._supports_smart_motion_detection = False
124
125
self ._supports_lighting = False
125
126
self ._supports_floodlightmode = False
@@ -247,6 +248,13 @@ async def _async_update_data(self):
247
248
self ._supports_disarming_linkage = False
248
249
_LOGGER .info ("Device supports disarming linkage=%s" , self ._supports_disarming_linkage )
249
250
251
+ try :
252
+ await self .client .async_get_event_notifications ()
253
+ self ._supports_event_notifications = True
254
+ except ClientError :
255
+ self ._supports_event_notifications = False
256
+ _LOGGER .info ("Device supports event notifications=%s" , self ._supports_event_notifications )
257
+
250
258
# Smart motion detection is enabled/disabled/fetched differently on Dahua devices compared to Amcrest
251
259
# The following lines are for Dahua devices
252
260
try :
@@ -261,7 +269,7 @@ async def _async_update_data(self):
261
269
262
270
is_flood_light = self .is_flood_light ()
263
271
_LOGGER .info ("Device is a floodlight=%s" , is_flood_light )
264
-
272
+
265
273
self ._supports_floodlightmode = self .supports_floodlightmode ()
266
274
267
275
try :
@@ -320,6 +328,7 @@ async def _async_update_data(self):
320
328
asyncio .ensure_future (self .client .async_get_config_lighting (self ._channel , self ._profile_mode )))
321
329
if self ._supports_disarming_linkage :
322
330
coros .append (asyncio .ensure_future (self .client .async_get_disarming_linkage ()))
331
+ if self ._supports_event_notifications :
323
332
coros .append (asyncio .ensure_future (self .client .async_get_event_notifications ()))
324
333
if self ._supports_coaxial_control :
325
334
coros .append (asyncio .ensure_future (self .client .async_get_coaxial_control_io_status ()))
@@ -546,7 +555,7 @@ def is_doorbell(self) -> bool:
546
555
""" Returns true if this is a doorbell (VTO) """
547
556
m = self .model .upper ()
548
557
return m .startswith ("VTO" ) or m .startswith ("DH-VTO" ) or (
549
- "NVR" not in m and m .startswith ("DHI" )) or self .is_amcrest_doorbell () or self .is_empiretech_doorbell () or self .is_avaloidgoliath_doorbell ()
558
+ "NVR" not in m and m .startswith ("DHI" )) or self .is_amcrest_doorbell () or self .is_empiretech_doorbell () or self .is_avaloidgoliath_doorbell ()
550
559
551
560
def is_amcrest_doorbell (self ) -> bool :
552
561
""" Returns true if this is an Amcrest doorbell """
@@ -584,7 +593,7 @@ def supports_illuminator(self) -> bool:
584
593
IPC-HDW3849HP-AS-PV does
585
594
"""
586
595
return not (
587
- self .is_amcrest_doorbell () or self .is_flood_light ()) and "table.Lighting_V2[{0}][0][0].Mode" .format (
596
+ self .is_amcrest_doorbell () or self .is_flood_light ()) and "table.Lighting_V2[{0}][0][0].Mode" .format (
588
597
self ._channel ) in self .data
589
598
590
599
def is_motion_detection_enabled (self ) -> bool :
@@ -660,7 +669,7 @@ def is_illuminator_on(self) -> bool:
660
669
def is_flood_light_on (self ) -> bool :
661
670
662
671
if self ._supports_floodlightmode :
663
- #'coaxialControlIO.cgi?action=getStatus&channel=1'
672
+ # 'coaxialControlIO.cgi?action=getStatus&channel=1'
664
673
return self .data .get ("status.status.WhiteLight" , "" ) == "On"
665
674
else :
666
675
"""Return true if the amcrest flood light light is on"""
0 commit comments