Help with config yaml

Hi all, i’m trying to add the code below to my configuration.yaml to be able to control 2 blinds, but i get all kinds of errors when i restart HA.
I get why (kinda), but i just don’t know how to seperate them correctly.
Any help would be massively appreciated.

input_number:
  lounge_blinds:
    name: Lounge Blinds
    initial: 0
    min: 0
    max: 13
    step: 1

automation old:
  - alias: Send Lounge Blinds Value
    trigger:
      platform: state
      entity_id: input_number.lounge_blinds
    action:
      - service: mqtt.publish
        data_template:         
          topic: "shadePosition/loungeblinds"           
          payload_template: "{{ states('input_number.lounge_blinds')  | int }}"
          qos: 2
          retain: true  
  


input_number:
  bedroom_blinds:
    name: bedroom Blinds
    initial: 0
    min: 0
    max: 13
    step: 1

automation old:
  - alias: Send Bedroom Blinds Value
    trigger:
      platform: state
      entity_id: input_number.bedroom_blinds
    action:
      - service: mqtt.publish
        data_template:          
          topic: "shadePosition/bedroomblinds" 
          payload_template: "{{ states('input_number.bedroom_blinds')  | int }}"
          qos: 2
          retain: true  

When i save and restart with just the one instance, everything is good and i can control the blind with no problems, but when i add the other other blind i end up in all kinds of trouble lol

Thanks for taking the time to read this :slight_smile:

What errors? Without them we’re just going to be guessing?

Did you run a command line (not UI) config check after making those changes?

Yeah sorry, i’ll post up the errors later.
Thanks for your reply…this yaml stuff is a bit of a nightmare

Here is the error…

duplicated mapping key at line 163, column -107:
input_number:
^

You have two time input_number in your config

Yeah, but how can i integrate both sets of blinds without having duplicated keys ?

That error is telling you you have duplicate key - input_number.

Use one “key”, put all the elements under it.

input_number:
  lounge_blinds:
    name: Lounge Blinds
    initial: 0
    min: 0
    max: 13
    step: 1

  bedroom_blinds:
    name: bedroom Blinds
    initial: 0
    min: 0
    max: 13
    step: 1

automation old:
  - alias: Send Lounge Blinds Value
    trigger:
      platform: state
      entity_id: input_number.lounge_blinds
    action:
      - service: mqtt.publish
        data_template:         
          topic: "shadePosition/loungeblinds"           
          payload_template: "{{ states('input_number.lounge_blinds')  | int }}"
          qos: 2
          retain: true  

  - alias: Send Bedroom Blinds Value
    trigger:
      platform: state
      entity_id: input_number.bedroom_blinds
    action:
      - service: mqtt.publish
        data_template:          
          topic: "shadePosition/bedroomblinds" 
          payload_template: "{{ states('input_number.bedroom_blinds')  | int }}"
          qos: 2
          retain: true  

See also this section of the docs.

Thank you so much, it’s now working, and i actually understand it all now too.
Really appreciate it :smile:

Thanks for that, i’ll make sure to read it.
I appreciate your help :smile: