Hi all,
i wanted to calculate the absolute humidity of multiple sensors (based on zigbee-flashed LYWSD03MMC), but not use the thermal comfort via HACS.
A quick seach of the internet an the homeassistant community resulted in a neat sensor template.
The strange thing is: Having it in the configuration.yaml everything seems to be fine, splitting it into sensor.yaml results in no entity, but also no error.
There may be a very simple solution; you would be great to share it with me.
Working (sensor in configuration.yaml):
# 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: !include sensor.yaml
template:
- sensor:
- name: "Absolute Luftfeuchtigkeit TEMP 2"
unit_of_measurement: "g/m^3"
state_class: "measurement"
state: >
{{ ( 1000*e**(18.016-(4064.95/(float(states('sensor.temp_2_xiaomi_lywsd03mmc_temperatur_2'))+236.25)))*100/(461.66*(float(states('sensor.temp_2_xiaomi_lywsd03mmc_temperatur_2'))+273.15)) * float(states('sensor.temp_2_xiaomi_lywsd03mmc_luftfeuchtigkeit_2'))/100 | float) | round (2) }}
Not working (copy/paste from configuration.yaml and sensor.yaml)
configuration.yaml
# 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: !include sensor.yaml
sensor.yaml
template:
- sensor:
- name: "Absolute Luftfeuchtigkeit TEMP 2"
unit_of_measurement: "g/m^3"
state_class: "measurement"
state: >
{{ ( 1000*e**(18.016-(4064.95/(float(states('sensor.temp_2_xiaomi_lywsd03mmc_temperatur_2'))+236.25)))*100/(461.66*(float(states('sensor.temp_2_xiaomi_lywsd03mmc_temperatur_2'))+273.15)) * float(states('sensor.temp_2_xiaomi_lywsd03mmc_luftfeuchtigkeit_2'))/100 | float) | round (2) }}