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?