Template sensor using an input text as parameter

Hi guys,

I want to have a binary sensor that is on if a person is at work and off if he is not. But i want the script to be based on an input text parameter.

I created an input text parameter:
input_text.parameter_main_mobile_device equal to device_tracker.samsung_z_fold

The template sensor that i created is the following:

platform: template
sensors:
  person_work:
    friendly_name: "Person Work"
    icon_template: hass:account-multiple-check
    value_template: >-
      {{ is_state('input_text.parameter_main_mobile_device', 'work') }}

But the sensor is always off. Can you please help me?

    value_template: >-
      {{ is_state(states('input_text.parameter_main_mobile_device'), 'work') }}

Also, that should be a binary sensor.

platform: template
binary_sensors:
  person_work:
    friendly_name: "Person Work"
    icon_template: hass:account-multiple-check
    value_template: "{{ is_state(states('input_text.parameter_main_mobile_device'), 'work') }}"

Or better still, in modern configuration:

template:
  - binary_sensor:
      - name: "Person Work"
        icon: hass:account-multiple-check
        state: "{{ is_state(states('input_text.parameter_main_mobile_device'), 'work') }}"
1 Like