Hello, I can't get the timestamp converted, can someone help me?

Hello, I can’t get the timestamp converted, can someone help me?

my json file

	
events	
0	
tournament	
name	"Super Lig"
slug	"super-lig"
category	
name	"Turkey"
slug	"turkey"
sport	
name	"Football"
slug	"football"
id	1
id	46
flag	"turkey"
alpha2	"TR"
uniqueTournament	
name	"Süper Lig"
slug	"super-lig"
category	
name	"Turkey"
slug	"turkey"
sport	
name	"Football"
slug	"football"
id	1
id	46
flag	"turkey"
alpha2	"TR"
userCount	90154
hasPositionGraph	true
id	52
hasEventPlayerStatistics	true
displayInverseHomeAwayTeams	false
priority	310
id	62
roundInfo	
round	15
customId	"blbsclb"
status	
code	0
description	"Not started"
type	"notstarted"
winnerCode	0
homeTeam	
name	"Trabzonspor"
slug	"trabzonspor"
shortName	"Trabzonspor"
gender	"M"
sport	
name	"Football"
slug	"football"
id	1
userCount	67063
nameCode	"TRA"
national	false
type	0
id	3051
subTeams	[]
teamColors	
primary	"#0099ff"
secondary	"#990000"
text	"#990000"
awayTeam	
name	"Fenerbahçe"
slug	"fenerbahce"
shortName	"Fenerbahçe"
gender	"M"
sport	
name	"Football"
slug	"football"
id	1
userCount	124645
nameCode	"FEN"
disabled	false
national	false
type	0
id	3052
subTeams	[]
teamColors	
primary	"#000066"
secondary	"#ffff00"
text	"#ffff00"
homeScore	{}
awayScore	{}
time	{}
changes	
changeTimestamp	0
hasGlobalHighlights	false
id	10433943
startTimestamp	1671980400
slug	"fenerbahce-trabzonspor"
finalResultOnly	false
1	
tournament	
name	"Super Lig"
slug	"super-lig"
category	
name	"Turkey"
slug	"turkey"
sport	
name	"Football"
slug	"football"
id	1
id	46
flag	"turkey"
alpha2	"TR"
uniqueTournament	
name	"Süper Lig"
slug	"super-lig"
category	
name	"Turkey"
slug	"turkey"
sport	
name	"Football"
slug	"football"
id	1
id	46
flag	"turkey"
alpha2	"TR"
userCount	90154
hasPositionGraph	true
id	52
hasEventPlayerStatistics	true
displayInverseHomeAwayTeams	false
priority	310
id	62
roundInfo	
round	15
customId	"llbsqlb"
status	
code	0
description	"Not started"
type	"notstarted"
winnerCode	0
homeTeam	
name	"Galatasaray"
slug	"galatasaray"
shortName	"Galatasaray"
gender	"M"
sport	
name	"Football"
slug	"football"
id	1
userCount	127279
nameCode	"GAL"
national	false
type	0
id	3061
subTeams	[]
teamColors	
primary	"#ff9900"
secondary	"#ff0000"
text	"#ff0000"
awayTeam	
name	"İstanbulspor"
slug	"istanbulspor"
shortName	"İstanbulspor"
gender	"M"
sport	
name	"Football"
slug	"football"
id	1
userCount	5890
nameCode	"IAS"
national	false
type	0
id	3066
subTeams	[]
teamColors	
primary	"#ffde00"
secondary	"#000000"
text	"#000000"
homeScore	{}
awayScore	{}
time	{}
changes	
changeTimestamp	0
hasGlobalHighlights	false
id	10433874
startTimestamp	1671980400
slug	"istanbulspor-galatasaray"
finalResultOnly	false

my sensor configuration

- platform: rest
  name: event_time
  json_attributes:
    - events
    - startTimestamp
  resource: http://www.xxxxx.de/lig_fik.json
  value_template: "{{ value_json.events[1].startTimestamp}}"
- platform: template
  sensors:
    tarih:
      friendly_name: "tarih"
      value_template: "{{ as_timestamp(state_attr('sensor.event_time', 'startTimestamp'), now() )  |timestamp_custom('%Y-%m-%dT%H:%M:%S+00:00', true, now() ) }}"
      icon_template: mdi:timer

I can’t get the game date

Assuming the rest sensor kicks back 1671980400
Then below gives: 2022-12-25T16:00:00+01:00.

{{ 1671980400 | timestamp_local }}

You can btw use rest to create the sensor directly
RESTful - Home Assistant (home-assistant.io)

EDIT: I am in CET timezone hence my ‘local’ differs

is the my sensor configuration correct or

?? empty ??

You have one rest senor and one template sensor, from what I can read and if you have written it properly based on json data… the rest sensor should show the timestamp as a state (!), being 1671980400. The template should then work with the example I gave

{{ states('sensor.event_time') | timestamp_local }}

and please post a json file, the above is not json format.
Working with JSON - Learn web development | MDN (mozilla.org).)

1 Like