Setting input min and max number using another input number

i want to ask, how to set input min and max number using another input number.

i already try like this from template

but i don’t know why input_number.input_max_watt_penggunaan don’t change value max like
input_number.input_watt_rumah

image

thankyou in advance

Here are the available service calls for Input Number.

Your example uses a service call that doesn’t exist (input_number.set_range). There’s no service call to set the value of an Input Number’s min and max options.

oh, that means I should use set_value according to the example you gave, right?, but I still can’t. Am I wrong?

Wrong.

As I explained in my previous post:

Ahh, okeiii thankyou very muchh

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.

okeiii donee

While I wouldn’t recommend doing so for most users… If you absolutely need dynamic max, min, or step variables you can use a Template Number entity instead of an Input Number helper.

Maybe can you give me the example what should I do? Because I’m beginner in using home assistant, thankyouu

To avoid the dreaded XY problem, it might be more beneficial for you if you explain what you are trying to accomplish in a broader sense rather than asking about a specific method. There may be more appropriate integrations or other tools than number-type entities.

Describe the end goal.

I need to make 2 input number :

  1. Max_watt_house
  2. Max_watt_use

I want to give limit for the input Max_watt_use which is 90% of the Max_watt_house

In example if the user input 1000 for Max_watt_house. Then when the user want to input Max_watt_use there is limit, so the user only can input 0-900 for the Max_watt_use

I don’t know what you did, but it didn’t put a Solution tag anywhere.

However, it no longer matters because, as long as you don’t mind changing at least one of the two Input Numbers to a Template Number, you’ll get the ability to adjust its min/max values.

I leave you in the capable hands of Didgeridrew.

Step 1: Set up an Input Number to use as a place to store the state of your Template number. For purposes of the rest of this example I will use input_number.max_watt_save. When you set up your helper, set the min and max to the widest acceptable limits that you would ever use. Remember, this is just a storage helper.

Step 2: Set up your Template number in your configuration.yaml or templates.yaml file.

template:
  - number:
      - name: Max Watt Use
        state: "{{ states('input_number.max_watt_save') }}"
        set_value:
          - service: input_number.set_value
            data:
              value: "{{ value }}"
            target:
              entity_id: input_number.max_watt_save
        step: 1
        min: 0
        max: "{{ states('input_number.input_watt_house') | int * 0.9 }}"
        availability: "{{ states('input_number.input_watt_house') | is_number }}"

Can you please check my code, maybe there is something wrong? Because it doesn’t work. I code this in configuration.yaml which is in studio code server

because when input_max_watt_penggunaan > input_watt_rumah does not appear red against input_max_watt_penggunaan

image

I don’t understand what you mean by the above statement.

Things to check…

Did you restart/reload HA so your number entity gets instantiated?
The entity you will want to use in the frontend will be number.max_watt_use, not input_number.input_max_watt_penggunaan. You have set input_max_watt_penggunaan
to be your storage helper…

Haiiii, sorry for late reply… Thankyouu, it works, it’s my fault, i use the wrong helper in my overview, thankyou once againn

Hai, sorry, i want to ask again. i don’t why sometime when i change input_watt_rumah the slider max watt use change to input number like this

Try setting the mode of the number entity to the kind you want using Manual Customization.

sorry, i can’t get display mode setting

I don’t understand what you are talking about… Manual customization is something you do in your configuration.yaml file.

  1. Open your configuration.yaml file
  2. Find the homeassistant: configuration key. If you don’t have one, add it.
  3. Under the homeassistant: key add your customization. It should look something like:
homeassistant:
  customize:
    number.max_watt_use:
      mode: slider