rroller / dahua

Dahua Camera and Doorbell Home Assistant Integration
MIT License
404 stars 82 forks source link

Illuminator support for IPC-HFW2439SP-SA-LED-S2 #427

Closed adobrotvorskiy closed 1 week ago

adobrotvorskiy commented 1 week ago

Hi! Thanks a lot for integration! Is it possible to add Illuminator support for IPC-HFW2439SP-SA-LED-S2? For now for this camera integration provides IR which it actually hasn't and Illuminator is unavailable.

I've tried API request for Ligthing_V2, and they work as described in integration: /cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][0][0].Mode=Manual&Lighting_V2[0][0][0].MiddleLight[0].Light=39 switches illuminator on

/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][0][0].Mode=Off&Lighting_V2[0][0][0].MiddleLight[0].Light=39 switches illuminator off

Also if in the light.py line 27 is commented if coordinator.supports_illuminator(): switch for illuminator becomes available and it works. It switches illuminator on and off. But for some reason when I switch it on it returns to off after little delay (illuminator still lights on until switch will be manually turned on and then off).

I will appreciate a lot if it can be resolved. Thanks in advance.

adobrotvorskiy commented 1 week ago

Managed to fix it. Added check for Lighing_V2 support and API call if it supported in init.py After that all works for me.

Also edit check for infrared light support. IPC-HFW2439SP-SA-LED-S2 has no infrared light but it was found by integration.