#Does HA have some method for templating
1 messages · Page 1 of 1 (latest)
@slender furnace
Let's do it here
Like, these weather providers have forecast, usually in something like temperature_2d
Buienradar has one entity description for every metric for every day
key="temperature_1d",
translation_key="temperature_1d",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
),
SensorEntityDescription(
key="temperature_2d",
translation_key="temperature_2d",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
),
SensorEntityDescription(
key="temperature_3d",
translation_key="temperature_3d",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
),
SensorEntityDescription(
key="temperature_4d",
translation_key="temperature_4d",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
),
SensorEntityDescription(
key="temperature_5d",
translation_key="temperature_5d",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
),
SensorEntityDescription(
key="mintemp_1d",
translation_key="mintemp_1d",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
),
SensorEntityDescription(
key="mintemp_2d",
translation_key="mintemp_2d",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
),
SensorEntityDescription(
key="mintemp_3d",
translation_key="mintemp_3d",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
),```
And Accuweather now has a
self._attr_name = f"{description.name} {forecast_day}d"
Which makes the code a lot cleaner
So I was thinking, why can't we have translation placeholders for these small things
Also with the added problem that Lokalize doesn't like all the references to itself
"name": "Condition 1d",
"state": {
"clear": "[%key:component::buienradar::entity::sensor::condition::state::clear%]",
"cloudy": "[%key:component::buienradar::entity::sensor::condition::state::cloudy%]",
"fog": "[%key:component::buienradar::entity::sensor::condition::state::fog%]",
"rainy": "[%key:component::buienradar::entity::sensor::condition::state::rainy%]",
"snowy": "[%key:component::buienradar::entity::sensor::condition::state::snowy%]",
"lightning": "[%key:component::buienradar::entity::sensor::condition::state::lightning%]"
}
},
"condition_2d": {
"name": "Condition 2d",
"state": {
"clear": "[%key:component::buienradar::entity::sensor::condition::state::clear%]",
"cloudy": "[%key:component::buienradar::entity::sensor::condition::state::cloudy%]",
"fog": "[%key:component::buienradar::entity::sensor::condition::state::fog%]",
"rainy": "[%key:component::buienradar::entity::sensor::condition::state::rainy%]",
"snowy": "[%key:component::buienradar::entity::sensor::condition::state::snowy%]",
"lightning": "[%key:component::buienradar::entity::sensor::condition::state::lightning%]"
}
},```
Like Lokalize is having issue with showing this correctly, I mean it still works (-ish) but it's not ideal
and now buienradar has this, but we have way more weather processors
so being able to just have something like
"name": "Condition {day}d"
}```