Hello,
Merci pour ton retour !
En effet, la partie TIMER est dispo pour l’enregistrement pur et le ftp par exemple.
Je suis en train de me demander si VL ça ne serait pas pour le son (volume).
Via l’interface, on peut activer ou non le son mais pas de manière schedulé (avantage implicite de l’utilisation des APIs ?
)
J’ai réussi à contrôler le schedule de mes caméras suivant mes besoins et également récupéré les états (people detection et status de la caméra en soit) donc nickel
.
Je suis sous Home Assistant (
) mais je vous fournis malgré tout le code que j’ai fait qui peut sûrement être compris et réadapté suivant les contraintes de jeedom en modulant un peu la syntaxe.
Très probablement optimisable (je suis un peu une bille pour le json, jinja and co…)
sensor:
# Schedule Mode (Global)
- platform: template
sensors:
reolink_schedule_mode_global:
value_template: >-
{% if (states.sensor.reolink_schedule_mode_cam_1.state == "Home" and
states.sensor.reolink_schedule_mode_cam_2.state == "Home" and
states.sensor.reolink_schedule_mode_cam_3.state == "Home" and
states.sensor.reolink_schedule_mode_cam_4.state == "Home") %}
Home
{% elif (states.sensor.reolink_schedule_mode_cam_1.state == "Out" and
states.sensor.reolink_schedule_mode_cam_2.state == "Out" and
states.sensor.reolink_schedule_mode_cam_3.state == "Out" and
states.sensor.reolink_schedule_mode_cam_4.state == "Out") %}
Out
{% elif (states.sensor.reolink_schedule_mode_cam_1.state == "Disable" and
states.sensor.reolink_schedule_mode_cam_2.state == "Disable" and
states.sensor.reolink_schedule_mode_cam_3.state == "Disable" and
states.sensor.reolink_schedule_mode_cam_4.state == "Disable") %}
Disable
{% else %}
Unknown
{% endif %}
# Schedule Mode (Camera 2 > Channel 1)
- platform: rest
name: reolink_schedule_mode_cam_2
resource: http://IPNVR:80/api.cgi?cmd=GetEmailV20&channel=1&user=USER&password=PASS
method: GET
json_attributes_path: "$.[]value['Email'][schedule][table]"
json_attributes:
- AI_PEOPLE
- AI_VEHICLE
- MD
- VL
value_template: >-
{% if value_json[0].value.Email.schedule.table.AI_PEOPLE == "111111110000000000001111111111110000000000001111111111110000000000001111111111110000000000001111111111110000000000001111111111110000000000001111111111110000000000001111" %}
Home
{% elif value_json[0].value.Email.schedule.table.AI_PEOPLE == "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" %}
Out
{% elif value_json[0].value.Email.schedule.table.AI_PEOPLE == "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" %}
Disable
{% else %}
Unknown
{% endif %}
scan_interval: 30
# People Detection (Camera 3 > Channel 2)
- platform: rest
name: reolink_people_cam_3
resource: 'http://IPNVR:80/api.cgi?cmd=GetAIState&channel=2&user=USER&password=PASS
method: GET
json_attributes_path: "$.[]value['people']"
json_attributes:
- alarm_state
value_template: "{{ value_json[0].value.people.alarm_state }}"
scan_interval: 5
# Status (Camera 1 > Channel 0)
- platform: rest
name: reolink_status_cam_1
resource: http://IPNVR:80/api.cgi?cmd=GetChannelstatus&channel=0&user=USER&password=PASS
method: GET
json_attributes_path: "$.[]value['status'][0]"
json_attributes:
- name
- channel
- online
value_template: >-
{% if value_json[0].value.status[0].online == 1 %}
Online
{% else %}
Offline
{% endif %}
scan_interval: 30
rest_command:
reolink_cam_1_email_in:
method: POST
content_type: 'application/json'
url: http://IPNVR:80/cgi-bin/api.cgi?user=USER&password=PASS
payload: '
[{
"cmd": "SetEmailV20",
"action": 0,
"param":
{
"channel": 0,
"Email":
{
"schedule":
{
"channel": 0,
"table":
{
"AI_PEOPLE": "111111110000000000001111111111110000000000001111111111110000000000001111111111110000000000001111111111110000000000001111111111110000000000001111111111110000000000001111",
"AI_VEHICLE": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"MD": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"VL": "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
}
}
}
}
}]'
# FTP (Camera 3 > Channel 2)
reolink_cam_3_ftp_out:
method: POST
content_type: 'application/json'
url: http://IPNVR:80/cgi-bin/api.cgi?user=USER&password=PASS
payload: '
[{
"cmd": "SetFtpV20",
"action": 0,
"param":
{
"channel": 0,
"Ftp":
{
"schedule":
{
"channel": 2,
"table":
{
"AI_PEOPLE": "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
"AI_VEHICLE": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"MD": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"TIMING": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
}
}
}
}]'