@@ -170,7 +170,7 @@ async def async_get_lighting_v2(self) -> dict:
170
170
table.Lighting_V2[0][2][0].PercentOfMaxBrightness=100
171
171
table.Lighting_V2[0][2][0].Sensitive=3
172
172
"""
173
- url = "http://{0}/cgi-bin/configManager.cgi?action=getConfig&name=Lighting_V2[0][0][0] " .format (
173
+ url = "http://{0}/cgi-bin/configManager.cgi?action=getConfig&name=Lighting_V2" .format (
174
174
self ._address_with_port
175
175
)
176
176
return await self .api_wrapper ("get" , url , headers = HEADERS )
@@ -194,10 +194,11 @@ async def async_get_machine_name(self) -> dict:
194
194
)
195
195
return await self .api_wrapper ("get" , url , headers = HEADERS )
196
196
197
- async def async_common_config (self ) -> dict :
197
+ async def async_common_config (self , profile_mode ) -> dict :
198
198
"""
199
199
async_common_config will fetch the status of the IR light (InfraRed light) and motion detection status (if it is
200
200
enabled or not)
201
+ profile_mode: = 0=day, 1=night, 2=normal scene
201
202
202
203
Example response:
203
204
table.Lighting[0][0].Correction=50
@@ -206,8 +207,8 @@ async def async_common_config(self) -> dict:
206
207
table.Lighting[0][0].Mode=Auto
207
208
table.Lighting[0][0].Sensitive=3
208
209
"""
209
- url = "http://{0}/cgi-bin/configManager.cgi?action=getConfig&name=MotionDetect&action=getConfig&name=Lighting[0][0 ]" .format (
210
- self ._address_with_port
210
+ url = "http://{0}/cgi-bin/configManager.cgi?action=getConfig&name=MotionDetect&action=getConfig&name=Lighting[0][{1} ]" .format (
211
+ self ._address_with_port , profile_mode
211
212
)
212
213
return await self .api_wrapper ("get" , url , headers = HEADERS )
213
214
@@ -301,7 +302,8 @@ async def async_set_service_set_channel_title(self, channel: int, text1: str, te
301
302
if "OK" not in value and "ok" not in value :
302
303
raise Exception ("Could not set text" )
303
304
304
- async def async_set_service_set_text_overlay (self , channel : int , group : int , text1 : str , text2 : str , text3 : str , text4 : str ):
305
+ async def async_set_service_set_text_overlay (self , channel : int , group : int , text1 : str , text2 : str , text3 : str ,
306
+ text4 : str ):
305
307
""" async_set_service_set_text_overlay sets the video text overlay """
306
308
text = '|' .join (filter (None , [text1 , text2 , text3 , text4 ]))
307
309
url = "http://{0}/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[{1}].CustomTitle[{2}].Text={3}" .format (
@@ -321,23 +323,40 @@ async def async_set_service_set_custom_overlay(self, channel: int, group: int, t
321
323
if "OK" not in value and "ok" not in value :
322
324
raise Exception ("Could not set text" )
323
325
324
- async def async_set_lighting_v2 (self , enabled : bool , brightness : int ) -> dict :
326
+ async def async_set_lighting_v2 (self , enabled : bool , brightness : int , profile_mode : str ) -> dict :
325
327
"""
326
328
async_set_lighting_v2 will turn on or off the white light on the camera. If turning on, the brightness will be used.
327
329
brightness is in the range of 0 to 100 inclusive where 100 is the brightest.
328
330
NOTE: this is not the same as the infrared (IR) light. This is the white visible light on the camera
331
+
332
+ profile_mode: 0=day, 1=night, 2=scene
329
333
"""
330
334
331
335
# on = Manual, off = Off
332
336
mode = "Manual"
333
337
if not enabled :
334
338
mode = "Off"
335
- url = "http://{0}/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][0 ][0].Mode={1 }&Lighting_V2[0][0 ][0].MiddleLight[0].Light={2 }" .format (
336
- self ._address_with_port , mode , brightness
339
+ url = "http://{0}/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][{1} ][0].Mode={2 }&Lighting_V2[0][{3} ][0].MiddleLight[0].Light={4 }" .format (
340
+ self ._address_with_port , profile_mode , mode , profile_mode , brightness
337
341
)
338
342
_LOGGER .debug ("Turning light on: %s" , url )
339
343
return await self .api_wrapper ("get" , url , headers = HEADERS )
340
344
345
+ async def async_get_video_in_mode (self ) -> dict :
346
+ """
347
+ async_get_video_in_mode will return the profile mode (day/night)
348
+ 0 means config for day,
349
+ 1 means config for night, and
350
+ 2 means config for normal scene.
351
+
352
+ table.VideoInMode[0].Config[0]=2
353
+ table.VideoInMode[0].Mode=0
354
+ table.VideoInMode[0].TimeSection[0][0]=0 00:00:00-24:00:00
355
+ """
356
+
357
+ url = "http://{0}/cgi-bin/configManager.cgi?action=getConfig&name=VideoInMode" .format (self ._address_with_port )
358
+ return await self .api_wrapper ("get" , url , headers = HEADERS )
359
+
341
360
async def async_set_coaxial_control_state (self , dahua_type : int , enabled : bool ) -> dict :
342
361
"""
343
362
async_set_lighting_v2 will turn on or off the white light on the camera.
0 commit comments