Passing entities/arguments to scripts

I have a scenario where I need to hide the control when the device is offline. To achieve that, I have created an automation and script. When I am trying the pass entities via arguments to scripts, nothing is happening. I found the same has been asked several times in the forums, but I can’t find a correct answer. The following is the automation

- id: '1535532363836'
  alias: Startup Visibility - rPi
  trigger:
  - event: start
    platform: homeassistant
  condition: []
  action:
  - data_template:
      input_device: "{{ device_tracker.rpi }}"
      input_entity: pi_info
    service: script.hide_control

and script.yaml

hide_control:
  alias: "Hide Controls"
  sequence:
    - service: group.set_visibility
      data_template:
        entity_id: "group.{{ 'input_entity' }}"
        visible: >
          {% if is_state( "{{ input_device }}", 'home') %}
            True
          {% elif is_state( "{{ input_device }}", 'not_home') %}
            False
          {% else %}
            False
          {% endif %}

I am basically put all the controls relevant to rpi in a group and make it is invisible when the controls are no longer available due to offline.

Try:

hide_control:
  alias: "Hide Controls"
  sequence:
    - service: group.set_visibility
      data_template:
        entity_id: "group.{{ input_entity }}"
        visible: "{{ is_state(input_device, 'home') }}"