AWALO
December 17, 2021, 3:02pm
1
Hello
I’m trying to read the current measured temperature from FRITZDect 301.
Here’s my configuration.yaml:
sensor:
- platform: template
sensors:
temp_bad_eg:
friendly_name: "Temp_Bad_EG"
unit_of_measurement: '°C'
value_template: "{{ state_attr('climate.hz_bad_eg', 'temperature') }}"
Sensor works fine, but displays the target temperature value instead of the current measured temperature.
Does someone know which attribute I have to read to get the right value?
Thanks
AWALO
December 18, 2021, 1:31pm
2
I’ve solved this issue now,
after reading the code sensor.py in its repository:
"""Support for AVM FRITZ!SmartHome temperature sensor only devices."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from datetime import datetime
from typing import Final
from pyfritzhome.fritzhomedevice import FritzhomeDevice
from homeassistant.components.climate.const import PRESET_COMFORT, PRESET_ECO
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ENERGY_KILO_WATT_HOUR,
This file has been truncated. show original
Solution: use current_temperature instead of temperature.
sensor:
- platform: template
sensors:
temp_bad_eg:
friendly_name: "Temp_Bad_EG"
unit_of_measurement: '°C'
value_template: "{{ state_attr('climate.hz_bad_eg', 'current_temperature') }}"
Question to admin: should I delete this post when solved?