Hello everyone,
I have a switch to turn on and off some rules of a camera motion detector .
I’m able to do an http get request and receive the info about motion rules but I need somes ifs to do the decision.
This is specially important when HA reboots or there is a power failure, because status is lost.
I tought about an automation where the trigger is home assistant startup; then make the get request.
I dont know what to do afterwards. Where can I write the ifs? And then write the the switch status?
Event HA startup -> GET request -> IF’s -> Force switch status
switch:
- platform: rest
resource: http://192.168.XX.XX/ISAPI/Intelligent/channels/2/behaviorRule/1/notifications
state_resource: http://192.168.XX.XX/ISAPI/Intelligent/channels/2/behaviorRule/1/notifications
method: put
name: Test Button
body_on: '' -> I was using a curl calling -d @config/curl_requests/motion_on.xml
body_off: '' -> Same here
is_on_template: templating xml file (GET response bellow)
username: xxxxxx
password: xxxxxx
headers:
Content-Type: application/xml
verify_ssl: true