How to combine two value templates in one

Hello,
I have - maybe - a simple question :slight_smile:
How can I combine two value templates into one:
1:
value_template: β€˜{{ (states.sensor.sonoff_pow_r2_uptime.state) }}’
2:
value_template: ’ {{ value[0] }}{{ value[1] }}{{ value[2] }}{{ value[3] }}’
I will be grateful for any help
Regards

There must be more to the story you haven’t mentioned :slight_smile: because otherwise, why would this not work:

value_template: '{{ (states.sensor.sonoff_pow_r2_uptime.state) }} {{ value[0] }}{{ value[1] }}{{ value[2] }}{{ value[3] }}'

Although I’m not sure where the variable value comes from.

Ok, I’ll try to tell more :slight_smile:
I have MQTT sensor:

- platform: mqtt
name: sonoff_pow_r2_uptime
state_topic: "SONOFF_Pow_R2/STATE"
value_template: '{{ value_json.Uptime}}'
icon: mdi:timer 

I it has a value like: 0T02:38:58
I want to cut it to display like this: 02:38:58

value_template: "{{ value_json.Uptime.split('T')[1] }}"
1 Like

Thanks! It works!