Multiple input numbers entities with a min-max in common

Yes, I was gonna do that in config files, I prefer that way, I feel to have more control.
Your code throw me the error Integration error: action - Integration ‘action’ not found
It could be an indentation error, but I’m just starting with this and I really can’t see the problem.

What if I want those values to also change based on a MQTT values?

Thanks a lot!

Do you have the MQTT integration installed and configured to connect to your MQTT broker?

I do and I’m already using it.

Then I’m not sure why the automation produced this error:

Integration error: action - Integration ‘action’ not found

I entered the automation’s code on my system and it saved it without producing an error.

Post your automation’s code.

Here it is:


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

#automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
#input_number: !include_dir_merge_list input_numbers  
input_number:
  setpoint_amministrazione:
    name: "Setpoint amministrazione"
    initial: 24
    min: 24
    max: 28
    step: 0.5


alias: example
trigger:
  - platform: state
    entity_id:
      - setpoint_amministrazione
    to:
condition: []
action:
  - service: mqtt.publish
    data:
      topic: office/setpoints/amministrazione
      payload: "{{ trigger.to_state.state }}"

mqtt:
#    light: !include_dir_merge_list lights/  #!include lights.yaml
#    cover: !include cover.yaml
    switch: !include switch.yaml
#    button: !include buttons.yaml
    sensor: !include_dir_merge_list sensors

OK, now the mistake is visible. You can’t simply drop an automation into configuration.yaml like that.

You should uncomment this line:

#automation: !include automations.yaml

For organization purposes, it’s best to store automations in a separate file.

I suggest you remove your automation, restart Home Assistant, then use the visual Automation Editor to create the automation.

When you’re in the Automation Editor, creating a new automation, switch the Editor into YAML mode, delete whatever you see displayed, then copy-paste the example into the Editor. click the Save button and it should save it without any errors.

Mmm…I will do, but why?

With all due respect, it’s becoming apparent to me that you are a beginner because you are making fundamental errors while attempting to compose a basic automation. That’s why I recommend you use the Automation Editor. In visual mode, it guides you to avoid making basic errors. For example, this is an invalid entity_id

  - platform: state
    entity_id:
      - setpoint_amministrazione

I have not seen the code for automation.set_temp_slider but I know for a fact that there’s no such service call as setpoint_amministrazione.set_value. The correct name is input_number.set_value. Once again, the Automation Editor, in visual mode, would have helped you avoid making that mistake.

I’m definitely a beginner, sorry for not have pointed that out in the beginning.
About the second error, I’ve just realized that was an old one (I’ve removed it from my post i guess just as you were posting your reply, sorry).

I got the error: I didn’t realize that your code was an automation.
I’ve put it under the automation and doesn’t throw any error now.
Thanks!

automation:
    alias: example
    trigger:
      - platform: state
        entity_id:
          - setpoint_amministrazione
        to:
    condition: []
    action:
      - service: mqtt.publish
        data:
          topic: office/setpoints/amministrazione
          payload: "{{ trigger.to_state.state }}"

No problem. Just follow my instructions posted here. You want your system to store automations in a separate file (automations.yaml). When you create automations with the Automation Editor, they will be automatically stored in that file.

  • Use the Automation Editor in visual mode to help avoid making basic errors whe creating modifying automations.

  • Use the Automation Editor in YAML mode for copy-pasting examples from the forum or when you become more familiar with the correct syntax for entities, service calls, Home Assistant’s scripting, etc.

The latest example you posted still has the wrong entity_id (it should be input_number.setpoint_amministrazione). You are also still saving the automation in configuration.yaml which isn’t the best long-term strategy for organization.

1 Like

Thanks a lot, it works!!!

I use to put everything in the configuration.yaml file at first and then, when everything works, I move the code in the different files (as I just did!).
This because sometimes I use wrong indentation or…I don’t know what else and the code works in configuration.yaml but not in the single files, so first I solve the code errors (if there are) and then I move the code.
I guess that I can start writing the code directly in separate files!

Now…if you still have a bit of patience: how can I change that value from MQTT?

That’s a time-consuming way to compose error-free automations.

If you compose your automations in the Automation Editor, it will help you avoid making errors. Any errors you do make will be reported the moment you attempt to save the file. After you have saved it, you can switch the Editor to YAML mode and see the error-free YAML that was produced (a faster, better way for you to learn correct YAML syntax).

I know, but I had problems everywhere, not only in the automation! Buuuut I think that I will use the automation editor (I didn’t know it existed before you told me :see_no_evil:), it surely help!

Is it possible to use a variable for min and max of all the setpoints?

I don’t see anything in Input Number’s documentation indicating that’s possible.

If the YAML configuration of your 15 Input Numbers contains a lot of duplication, you can use the YAML feature called ‘Anchors and Aliases’ to minimize duplication. Here’s an example of its use for reducing the configuration of multiple light entities:

1 Like

. Thanks! .

TLDR: Kind of… If you use Template numbers in conjunction with Input numbers.