How to List when creating a Template

Hi im not sure what to search so i thought id ask

I just want the below template to be in a list format so that each new sensor is on its own line?? Like below, which is from the developer section in HA.

Its for a mobile phone template widget

Laundry Humidity:78.7%
Laundry Temperature:21.7°C
Average House Humidity:74.14%
Fronius Live Power Flow kWh:-0.01kWh

If you want to point me in the right direction that would be great

{{ state_attr('sensor.laundry_climate_humidity', 'friendly_name')}}:{{ states('sensor.laundry_climate_humidity') }}{{ state_attr('sensor.laundry_climate_humidity', 'unit_of_measurement')}}
{{ state_attr('sensor.laundry_climate_temperature', 'friendly_name')}}:{{ states('sensor.laundry_climate_temperature') }}{{ state_attr('sensor.laundry_climate_temperature', 'unit_of_measurement')}}
{{ state_attr('sensor.average_whole_house_humidity', 'friendly_name')}}:{{ states('sensor.average_whole_house_humidity') }}{{ state_attr('sensor.average_whole_house_humidity', 'unit_of_measurement')}}
{{ state_attr('sensor.fronius_live_power_flow_kwh', 'friendly_name')}}:{{ states('sensor.fronius_live_power_flow_kwh') }}{{ state_attr('sensor.fronius_live_power_flow_kwh', 'unit_of_measurement')}}
1 Like

Context required.

On it’s own line where?

I have updated my original post, hopefully this helps

Not really. What is a phone template widget?

On android, you can create Widgets from the HA app…one of those is a template style widget.

I don;t know anything about that but when I want to separate lines in my telegram messages I just have to add two line breaks like this:

data:
  message: >
    {{ state_attr('sensor.laundry_climate_humidity', 'friendly_name')}}:{{ states('sensor.laundry_climate_humidity') }}{{ state_attr('sensor.laundry_climate_humidity', 'unit_of_measurement')}}

    {{ state_attr('sensor.laundry_climate_temperature', 'friendly_name')}}:{{ states('sensor.laundry_climate_temperature') }}{{ state_attr('sensor.laundry_climate_temperature', 'unit_of_measurement')}}

    {{ state_attr('sensor.average_whole_house_humidity', 'friendly_name')}}:{{ states('sensor.average_whole_house_humidity') }}{{ state_attr('sensor.average_whole_house_humidity', 'unit_of_measurement')}}

    {{ state_attr('sensor.fronius_live_power_flow_kwh', 'friendly_name')}}:{{ states('sensor.fronius_live_power_flow_kwh') }}{{ state_attr('sensor.fronius_live_power_flow_kwh', 'unit_of_measurement')}}

The link you supplied says you can use html tags.

Doesn’t that work?

1 Like

nah that doesnt work, looking into the HTML

1 Like

yeah cheers, didnt even think about this when i read it, slowly
im getting somewhere

thanks for this

Just cant align it left. It works in CSS, but when i add it to the template, donest want to align

<!DOCTYPE html>
<html>
<head>
<style>
div {
  text-align: left;
}
</style>
</head>
<body>

<div>
<b>
{{ state_attr('sensor.laundry_climate_humidity', 'friendly_name')}}:
</b> 
{{ states('sensor.laundry_climate_humidity') }}
{{ state_attr('sensor.laundry_climate_humidity', 'unit_of_measurement')}}

<p><b>{{ state_attr('sensor.laundry_climate_temperature', 'friendly_name')}}:
</b>
{{ states('sensor.laundry_climate_temperature') }}
{{ state_attr('sensor.laundry_climate_temperature', 'unit_of_measurement')}}

<p><b>{{ state_attr('sensor.average_whole_house_humidity', 'friendly_name')}}:
</b>
{{states('sensor.average_whole_house_humidity') }}
{{ state_attr('sensor.average_whole_house_humidity', 'unit_of_measurement')}}

<p><b>{{ state_attr('sensor.fronius_live_power_flow_kwh', 'friendly_name')}}: 
</b>
{{ states('sensor.fronius_live_power_flow_kwh') }}
{{ state_attr('sensor.fronius_live_power_flow_kwh', 'unit_of_measurement')}}
</div>

</body>
</html>
1 Like