#HA 2023.8.1 it is not possible to create a template sensor
1 messages · Page 1 of 1 (latest)
This is my configuration.yaml file:
# 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
sensor:
- platform: template
sensors:
H_meter2:
friendly_name: "H meter 2"
value_template: "{{ states('sensor.ltst_2_as_humidity') | float(0) }}"
template:
- sensor:
- name: "T meter 2"
state_class: "measurement"
unit_of_measurement: "W"
state: "{{ states('sensor.ltst_2_as_temperature') | float(0) }}"
The template sensors in my configuration.yaml files were tested Ok in template tool, but they do not even show up in the Development Tool --> States.
After restarting HA, no errors appear related to template sensors.
I appreciate any help
You're unnecessarily using two different formats to create two template sensors, but the only thing I see obviously wrong is that you're using a capital letter in the slug for the first sensor. It should be all lowercase
Otherwise, check the log
Hi @tiny vault , thanks for youur reply.
I tried only one of the template configurations at the time.
The FIRST one with:
sensor:
- platform: template
sensors:
h_meter2:
friendly_name: "H meter 2"
value_template: "{{ states('sensor.ltst_2_as_humidity') | float(0) }}"
RESULT:it did not work, and it does not show up in the Development tool --> STATES
The log does not indicate any problem/error with template sensor.
Settings -> System ->log, I will attache file.
NOTE: I appreciate any help
Sorry. Do you know how to attach a file ??????
With the SECOND one with:
template:
- sensor:
- name: "T meter 2"
state_class: "measurement"
unit_of_measurement: "W"
state: "{{ states('sensor.ltst_2_as_temperature') | float(0) }}"
RESULT:it did not work, and it does not show up in the Development tool --> STATES
The log does not indicate any problem/error with template sensor.
Settings -> System ->log, I will attache file.
NOTE: I appreciate any help to solve this problem, and to indicate how to attach a file to this chat.
You can't attach files, what do you want to attach?
Hi @deep shard ,
I want to attach the log for the test i did.
Do you know how to show such information here ?
Please use a code share site to share code or logs, for example:
- https://dpaste.org/ (select YAML for the language, and consider picking a longer expiry)
- http://pastie.org/ (select YAML for the language)
- https://paste.debian.net/ (you guessed it, select YAML as the language)
Please don't use Pastebin, since it can randomly add spaces to the main view. Please also don't share text as images since it makes it harder for people to help you. Remember that others may have colour blindness, impaired vision, etc.
logs are text, put them on a code sharing file
I tried, but it is too long
Thanks for the info.
Please find one of the logs here:
https://dpaste.org/K6e85
there is nothing in this log related to your template sensor
Yes, I confirm it was my observtion.
It looks like that HA is not rendering the sensor configuration when it restarts.
Any idea?
what are you trying to do anyway? Adding state class to your sensors?
as you are only outputting the state of another sensor
and is this your complete configuration.yaml?
I want to add a calculated sensor.
As first step, I comfigured a simle one, just showing the value of another device entity.
But, none of my tries have worked for that simple sensor, using legacy or modern styles.
This is my whole configuration.yaml file, testing the moderm style:
# 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
template:
- sensor:
- name: "T meter 2"
unit_of_measurement: "°C"
device_class: temperature
state: "{{ states('sensor.ltst_2_as_temperature') | float(0) }}"