jeppper
(Jeppper)
1
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
jeppper
(Jeppper)
3
PERFECT!! 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:
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.