Hello,
i have two foscam cams, i can enable/disable motion detection but i want to send a notification with notify.notify after executing a script and checking the state.
This is my current situation:
/config/switches.yaml
- platform: command_line
switches:
foscam_ingresso_motion:
command_on: 'curl -k "http://xxx.xxx.xxx.xxx:XXXXX/cgi-bin/CGIProxy.fcgi?usr=XXXXXX&pwd=XXXXXX&cmd=setMotionDetectConfig&isEnable=1&linkage=15&snapInterval=1&sensitivity=1&triggerInterval=0&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&area0=1023&area1=1023&area2=1016&area3=992&area4=960&area5=896&area6=896&area7=768&area8=768&area9=768"'
command_off: 'curl -k "http://xxx.xxx.xxx.xxx:XXXXX/cgi-bin/CGIProxy.fcgi?usr=XXXXXX&pwd=XXXXXX&cmd=setMotionDetectConfig&isEnable=0"'
command_state: 'curl -k --silent "http://xxx.xxx.xxx.xxx:XXXXX/cgi-bin/CGIProxy.fcgi?usr=XXXXXX&pwd=XXXXXX&cmd=getMotionDetectConfig" | grep -oP "(?<=isEnable>).*?(?=</isEnable>)"'
value_template: '{{ value == "1" }}'
foscam_corridoio_motion:
command_on: 'curl -k "http://xxx.xxx.xxx.xxx:XXXXX/cgi-bin/CGIProxy.fcgi?usr=XXXXXX&pwd=XXXXXX&cmd=setMotionDetectConfig&isEnable=1&linkage=15&snapInterval=1&sensitivity=1&triggerInterval=0&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&area0=1023&area1=1023&area2=1023&area3=1023&area4=1023&area5=783&area6=527&area7=775&area8=771&area9=768"'
command_off: 'curl -k "http://xxx.xxx.xxx.xxx:XXXXX/cgi-bin/CGIProxy.fcgi?usr=XXXXXX&pwd=XXXXXX&cmd=setMotionDetectConfig&isEnable=0"'
command_state: 'curl -k --silent "http://xxx.xxx.xxx.xxx:XXXXX/cgi-bin/CGIProxy.fcgi?usr=XXXXXX&pwd=XXXXXX&cmd=getMotionDetectConfig" | grep -oP "(?<=isEnable>).*?(?=</isEnable>)"'
value_template: '{{ value == "1" }}'
/config/shell_commands.yaml
foscam_corridoio_turn_off: 'curl -k "http://xxx.xxx.xxx.xxx:XXXXX/cgi-bin/CGIProxy.fcgi?usr=XXXXXX&pwd=XXXXXX&cmd=ptzGotoPresetPoint&name=AtHome"'
foscam_corridoio_turn_on: 'curl -k "http://xxx.xxx.xxx.xxx:XXXXX/cgi-bin/CGIProxy.fcgi?usr=XXXXXX&pwd=XXXXXX&cmd=ptzGotoPresetPoint&name=Sorveglianza"'
foscam_ingresso_turn_off: 'curl -k "http://xxx.xxx.xxx.xxx:XXXXX/cgi-bin/CGIProxy.fcgi?usr=XXXXXX&pwd=XXXXXX&cmd=ptzGotoPresetPoint&name=AtHome"'
foscam_ingresso_turn_on: 'curl -k "http://xxx.xxx.xxx.xxx:XXXXX/cgi-bin/CGIProxy.fcgi?usr=XXXXXX&pwd=XXXXXX&cmd=ptzGotoPresetPoint&name=Sorveglianza"'
/config/scripts.yaml
foscam_all_off:
alias: "Disarm Home Cams"
sequence:
- service: switch.turn_off
data:
entity_id: switch.foscam_ingresso_motion
- service: shell_command.foscam_ingresso_turn_off
- service: switch.turn_off
data:
entity_id: switch.foscam_corridoio_motion
- service: shell_command.foscam_corridoio_turn_off
**- CHECK STATE CAM 1 WITH CURL > notify.notify ( <isEnable>1</isEnable> or <isEnable>0</isEnable> )**
**- CHECK STATE CAM 2 WITH CURL > notify.notify ( <isEnable>1</isEnable> or <isEnable>0</isEnable> )**
foscam_all_on:
alias: "Arm Home Cams"
sequence:
- service: switch.turn_off
data:
entity_id: switch.foscam_ingresso_motion
- service: shell_command.foscam_ingresso_turn_on
- service: switch.turn_on
data:
entity_id: switch.foscam_ingresso_motion
- service: switch.turn_off
data:
entity_id: switch.foscam_corridoio_motion
- service: shell_command.foscam_corridoio_turn_on
- service: switch.turn_on
data:
entity_id: switch.foscam_corridoio_motion
**- CHECK STATE CAM 1 WITH CURL > notify.notify ( <isEnable>1</isEnable> or <isEnable>0</isEnable> )**
**- CHECK STATE CAM 2 WITH CURL > notify.notify ( <isEnable>1</isEnable> or <isEnable>0</isEnable> )**
Thank you in dvance