Write to Switch Status from http GET request

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

Many thanks

Are you using this?

If so, just call the update entity service when home assistant starts.

Thanks for your fast reply @tom_l

I created this:

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

HTTP GET Response:


<?xml version="1.0" encoding="UTF-8"?>
<RuleNotification xmlns="http://www.std-cgi.com/ver20/XMLSchema" version="2.0">
   <sid>1</sid>
   <RuleList>
      <RuleInfo>
         <ruleId>1</ruleId>
         <EventTriggerNotificationList>
            <EventTriggerNotification>
               <id>email</id>
               <notificationMethod>email</notificationMethod>
               <notificationRecurrence>beginning</notificationRecurrence>
            </EventTriggerNotification>
         </EventTriggerNotificationList>
      </RuleInfo>
      <RuleInfo>
         <ruleId>2</ruleId>
         <EventTriggerNotificationList>
            <EventTriggerNotification>
               <id>email</id>
               <notificationMethod>email</notificationMethod>
               <notificationRecurrence>beginning</notificationRecurrence>
            </EventTriggerNotification>
         </EventTriggerNotificationList>
      </RuleInfo>
   </RuleList>
</RuleNotification>

EDIT:
with help of @petro
this issue was solved

switch:
  - platform: command_line
    switches:
      cam_piscina_mail:
        friendly_name: Test button
        command_on: ...
        command_off: ...
        command_state: "/usr/bin/curl --digest -u user:pass -X GET http://X.X.X.X/ISAPI/Intelligent/channels/2/behaviorRule/1/notifications"
        value_template: '{{ value | regex_search("email", ignorecase=true)}}'