Binary sensor threshold with variable threshold


Hi. I’m testing the threshold binary sensor but I cannot modify the threshold value by means of the interface with an input_number entity because there is not a service to change this value.
For example, with the climate platform I have an automation that can modify the thermostat (service set_temperature). Also, the generic thermostat has a user interface to modify it manually.
Is there any way I can modify the threshold that does not imply to reconfigure HA?

If it’s not then I would make some automations with templates to solve this.

Thank you.


Could anyone write the code of a service that modifies the threshold of a threshold binary_sensor?

I think it’s easy if we copy, for example, the code of the service input_number.set_value.


Hi all,

Has anyone asked if the limits of a threshold binary sensor could be changed without restarting HA?

I’m going to reformulate the feature request in a way I think it could be more easy to implement and much more useful. Imagine a config like this:

# Example configuration.yaml entry
    min: 10
    max: 100
    step: 5
    icon: mdi:water-percent
  - platform: threshold
    entity_id: sensor.high_humidity
    upper_entity: input_number.humidity_threshold
    hysteresis: 0.5
    device_class: moisture

If you could specify an upper or lower with an entity, instead of a fixed value, in the threshold you could modify it very easily with an input_number. This saves a lot of template programing for doing a very common task.

Please, vote if you think this is useful.

Thanks HA community!