Sonoff POW Tasmota TotalStartTime

I have the following sensor for importing the TotalStartTime into HA

  - platform: mqtt
    name: "Washing machine total start time"
    state_topic: "tele/sonoff_9/SENSOR"
    value_template: "{{value_json['ENERGY'].TotalStartTime }}"

This is shown in the frontend but I really just want year, day and month. Anyone knows how to alter this in a template?

try this:

{{value_json['ENERGY'].TotalStartTime.split('T').0 }}

1 Like

PERFECT!! :slight_smile: thanks
Can you explain what β€œsplit(β€˜T’).0” does?

is it possible to turn the date around? as 07.06.2019

Hi yes it splits the string around the β€˜T’ character, then the β€˜0’ outputs the 1st part of the split.

Jinja2 is what HA uses for things like this:

:slight_smile:

is it possible to turn the date around? as 07.06.2019

Maybe, I think HA has things built in to convert dates to a local format, but I’ve not used them myself.

thanks :slight_smile:

1 Like