Need to invert Binary Ping Sensor connectivity status

I have the following in my config.yaml for a very basic test for WAN connectivity, and also firewall status.

  - platform: ping
    name: WAN Status
    host: 8.8.8.8
    scan_interval: 60

  - platform: ping
    name: Firewall Status
    host: mail.ru
    scan_interval: 60

I have "mail.ru’ blocked in my network firewall, so if this site fails a ping, that tells me that the firewall is online. I need to invert the status, as it currently shows “Disconnected” when the firewall is enabled. I would like it to show “Enabled” when the ping fails, and “Disabled” when the ping succeeds. I would also like the WAN ping test to show "Up’ if the ping succeeds, and “Down” if it fails. I have read various posts about using a template, but I can’t seem to make it work just right. Any help would be appreciated!

Use a template binary sensor

Thanks- I tried, but still no luck. Can anyone give me a little guidance on what I am doing wrong? Here is my current config.yaml code:

binary_sensor:
  - platform: ping
    name: wan_status
    host: 8.8.8.8
    scan_interval: 60

  - platform: ping
    name: firewall_status
    host: mail.ru
    scan_interval: 60

And my sensors.yaml code:

  - platform: template
    sensors:
      wan_status:
          friendly_name: WAN Status
          entity_id:
            - sensor.wan_status
          value_template: >-
            {%- if is_state("sensor.wan_status", "on") -%}
            Up
            {%- else -%}
            Down
            {%- endif -%}

  - platform: template
    sensors:
      firewall_status:
          friendly_name: Firewall Status
          entity_id:
            - binary_sensor.wan_status
          value_template: >-
            {%- if is_state("binary_sensor.firewall_status", "on") -%}
            Disabled
            {%- else -%}
            Enabled
            {%- endif -%}

I may be way off base here, but I am still new to HA, so please bear with me. Do I even have the correct code in the right places? This seems like such a simple thing to do, but I am having no luck.

Got it working! How can I make the icons change color based on the status?

In config.yaml:

binary_sensor:
  - platform: ping
    name: wan_status
    host: google.com
    scan_interval: 10

  - platform: ping
    name: firewall_status
    host: mail.ru
    scan_interval: 10

In sensors.yaml:

  - platform: template
    sensors:
      wan_status:
          friendly_name: WAN Status
          entity_id:
            - binary_sensor.wan_status
          value_template: >-
            {%- if is_state("binary_sensor.wan_status", "on") -%}
            Up
            {%- else -%}
            Down
            {%- endif -%}

  - platform: template
    sensors:
      firewall_status:
          friendly_name: Firewall Status
          entity_id:
            - binary_sensor.firewall_status
          value_template: >-
            {%- if is_state("binary_sensor.firewall_status", "on") -%}
            Offline
            {%- else -%}
            Online
            {%- endif -%}

In customize.yaml:

sensor.wan_status:
    icon: mdi:wan

sensor.firewall_status:
  icon: mdi:security-network