Trying to automate IPcamera floodlight

Hi,
I have a Dahua camera that has a floodlight that starts when the outside light falls below a certain level (or based on schedule). As I want to turn the floodlight only when motion is detected I’ve start playing with camera’s Web API.
Until now I’ve managed to create a switch that I can use to manually turn on/off the floodlight.
As this floodlight can be turned on/off from camera’s webpage etc I want to get the status of if from time to time. For this purpose I’ve created two different sensors: a binary one and a control one to validate that the GET command works fine.

Binary Sensor:

  - platform: rest
    resource: http://192.168.11.46/cgi-bin/configManager.cgi?action=getConfig&name=Lighting[0][3].Mode
    method: GET
    authentication: digest
    username: !secret dahua_user
    password: !secret dahua_pass
    name: dahua_floodlight_status
    device_class: light
    value_template: "{{ (value.split('='))[1] == 'Manual' }}"

Sensor:

  - platform: rest
     resource: http://192.168.11.46/cgi-bin/configManager.cgi?action=getConfig&name=Lighting[0][3].Mode
     method: GET
     authentication: digest
     username: !secret dahua_user
     password: !secret dahua_pass
     name: dahua_floodlight_status_full

When the floodlight is turned ON I get:

binary_sensor.dahua_floodlight_status	**State: off**

sensor.dahua_floodlight_status_full		**State: table.Lighting[0][3].Mode=Manual**

When the floodlight is turned OFF I get:

binary_sensor.dahua_floodlight_status	**State: off**

sensor.dahua_floodlight_status_full		**State: table.Lighting[0][3].Mode=Off** 

What I’m doing wrong?

Your value template needs to resolve to On not True.

@msp1974 I’ve tried also without device_class: light but the result is the same

I meant something like this…

  - platform: rest
    resource: http://192.168.11.46/cgi-bin/configManager.cgi?action=getConfig&name=Lighting[0][3].Mode
    method: GET
    authentication: digest
    username: !secret dahua_user
    password: !secret dahua_pass
    name: dahua_floodlight_status
    device_class: light
    value_template: "{{ 'On' if value.split('=')[1] == 'Manual' else 'Off' }}"

Thanks a lot @msp1974 , that was the problem.
It’s strange that at some point it came in my mind that maybe true/false values are not right but after reading Binary Sensor - Home Assistant I concluded that true/false is just fine

I’m trying to implement something like this. How did you manage to create the switch for the floodlight?

Try to integrate the camera using this HACS Addon