because it is already declared in confiuration.yaml.
Though I’ve tried with and without that declaration. No diff.
But for a reason unknown to me, this sensor does not appear as an entity at all!
Other inclusions like mqtt work fine.
additional info:
If I create a helper of the type “template” thorough the UI, everything works fine. Prob is only when template sensor is created in yaml.
btw. where the HA stores these template helpers? can’t find them in any yaml in config dir.
Any idea is highly appreciated
I’m not new in HA but seems not long enough…
That’s because MQTT configuration is a dictionary, not a list. It’s supposed to work that way and is different by design.
I don’t use !include for template sensors like that so the suggestion was untested. I use !include_dir_merge_list and put all of my template config yaml files in their own subfolder.
also it matters where you put the “sensor_template.yaml” file. using include like that the file needs to be in the root config directory.
then in my config directory I have a sub-directory called “template_sensors” that contains all of my yaml files.
for example I have a file called 'template_binary_sensors.yaml in that directory above. It contains the following (truncated for example only):
######## TRGGER BASED BINARY SENSORS #################
- trigger:
- platform: state
entity_id: binary_sensor.i_am_in_bed
to: 'on'
for:
minutes: 2
id: in_bed
- platform: state
entity_id: binary_sensor.i_am_in_bed
to: 'off'
for:
minutes: 2
id: out_of_bed
binary_sensor:
- name: "I'm In Bed Delayed"
state: >
{% if trigger.id == 'in_bed' %}
on
{% else %}
off
{% endif %}
################### STATE BASED BINARY SENSORS #######################################################################
- binary_sensor:
- name: Everyone Home is in Bed
unique_id: everyone_home_is_in_bed
state: >
{% set wife_in_bed = is_state('binary_sensor.wife_is_in_bed', 'on') %}
{% set i_am_in_bed = is_state('binary_sensor.i_am_in_bed', 'on') %}
{% set wife_not_home = not is_state('person.wife', 'home') %}
{% set me_not_home = not is_state('person.me', 'home') %}
{{ (wife_in_bed or wife_not_home) and (i_am_in_bed or me_not_home) }}
.
.
.
I also have a template_sensors.yaml file with similar contents that also starts with “- sensor:” as the first line.
the “- trigger:”, “- binary_sensor:” and “- sensor:” is required on the first lines of those includes since they are in the !include for the template integration.