Hello,
I have - maybe - a simple question
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 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
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!