Entity Not Created when Creating a Template Switch and Sensor

I am creating two separate entities, one a switch and one a sensor. Here is the template.yaml

# Define template switches
switch:
  - platform: template
    switches:
      office_shower:
        friendly_name: "Office Shower"
        value_template: "{{ is_state('input_boolean.hot_shower', 'on') }}"
        turn_on:
          service: input_boolean.turn_on
          target:
            entity_id: input_boolean.hot_shower
        turn_off:
          service: input_boolean.turn_off
          target:
            entity_id: input_boolean.hot_shower

# Define template binary sensors
binary_sensor:
  - platform: template
    sensors:
      wind_gust_above_10_mph:
        friendly_name: "Wind Gust Above 10 mph"
        value_template: "{{ states('sensor.bennett_ranch_sensors_wind_gust') | float > 10 }}"

In configuration.yaml I have the following code:

template: !include template.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include sensors.yaml

I’ve reloaded the configuration and restared HA. The entities will not appear. There are no errors and no logs showing something is off with the yaml file.

Any ideas?

So you created, e.g, template.yaml in the root of your HA config?

That doesn’t go in your template file, that goes in configuration.yaml

1 Like

And if you’re going to continue using legacy template format, this should also be in configuration.yaml (or included in a separate file from the binary_sensor: key).

You’re mixing up modern and legacy formats for template sensors essentially.

1 Like