Availability template in RESTful Sensor

Add to RESTful Sensor availability template like in Template Sensor

availability [template] (optional, default: true)

Defines a template to get the available state of the component. If the template returns true, the device is available. If the template returns any other value, the device will be unavailable. If not configured, the component will always be available.

Reason: my rest sensors receive information from other servers behind the vpn connection. But if something wrong with internet or vpn I have many errors in HA log. With this feature it would be possible use ping sensor for checking connection and disable updates if it isn’t reachable.

Yep this would be really handy. Unfortunately I have to do this at the moment:

    value_template: >
      {% if value_json is defined %}
        {{ value_json|selectattr('complete', 'false')|map(attribute='name')|list|length == 0 }}"
      {% else %}
      {% endif %}