I know, that in much like the web languages I am used to, there are ways to write sub files and have them all loaded in a main file saving you form having 1 main file with 1 trillion lines of code.
I see stuff like script: !include scripts.yaml
but I’m not sure how exactly how to name the include files. For instance:
tysensors:
count_sensor:
friendly_name: "Since Day 0"
value_template: "{{ states('sensor.count_sensor') | int + 1 }}"
initial: 4
count_sensor2:
friendly_name2: "Count"
value_template2: "{{ states('sensor.count_sensor2') | int + 1 }}"
initial2: 1
light:
- platform: switch
name: "Dummy Light"
entity_id: switch.dummy_light
- platform: switch
name: "Bed Time"
entity_id: switch.bed_time
- platform: switch
name: "Tally Up"
entity_id: switch.tally_up
switch:
- platform: template
switches:
dummy_light:
friendly_name: "Dummy Light Switch"
value_template: "{{ is_state('input_boolean.dummy_light_state', 'on') }}"
turn_on:
service: input_boolean.turn_on
target:
entity_id: input_boolean.dummy_light_state
turn_off:
service: input_boolean.turn_off
target:
entity_id: input_boolean.dummy_light_state
bed_time:
friendly_name: "Bed Time Light Switch"
value_template: "{{ is_state('input_boolean.bed_time_state', 'on') }}"
turn_on:
service: input_boolean.turn_on
target:
entity_id: input_boolean.bed_time_state
turn_off:
service: input_boolean.turn_off
target:
entity_id: input_boolean.bed_time_state
tally_up:
friendly_name: "Tally Up"
value_template: "{{ is_state('input_boolean.tally_up_state', 'on') }}"
turn_on:
service: input_boolean.turn_on
target:
entity_id: input_boolean.tally_up_state
turn_off:
service: input_boolean.turn_off
target:
entity_id: input_boolean.tally_up_state
# YAML for the Template Sensor (in templates.yaml or configuration.yaml)
input_boolean:
dummy_light_state:
name: Dummy Light State
initial: off
bed_time_state:
name: Bed Time State
initial: off
tally_up_state:
name: Tally Up State
initial: offpe or paste code here
I would really like to clean that up into 2 or 3 files.
As you can tell I am pretty new to YAML so any pointers on anything in that example I could have done cleaner would also be helpful to me.
Oh, also, are there any good linters for YAML out there? tried a few that seemed to confuse me more than help me learn.