UTC to local time for a sensor to tts automation

They all return either unavailable or none.

Fix the sensor first then, what does dev tools|states say the state is?

Without any added states it returns:

2022-05-07T02:24:00+00:00

With the first added it shows unavailable with the second added it returns none.

I can’t work out what you mean by “added states”. The entity has a state. It is shown in the “States” tab in Developer Tools.

In the original sensor the date and time is returned in UTC. If I add the first time stamp it returns unavailable if I add the integration 2nd time stamp with H and M it returns none. Is that clearer?

Are you using the template tab or the states tab?

The templates tab. The states tab returns the correct date and time.

Thank you for finally answering that question.

You are mistyping something I think. Copy what you typed in the templates tab and paste it here inside code tabs, ie three backticks ``` before and after the code, and on separate lines

Good morning the value is {{ states('sensor.jewish_calendar_upcoming_candle_lighting') | as_timestamp | timestamp_custom('%H:%M') }}

I obviously don’t have your sensor, but

{{'2022-05-07T02:24:00+00:00'|as_timestamp}}

gives

1651890240.0

which is a timestamp.

Further

{{'2022-05-07T02:24:00+00:00'|as_timestamp}}
{{'2022-05-07T02:24:00+00:00'|as_timestamp|timestamp_custom('%H:%M')}}

Gives

1651890240.0
14:24

Nickrout is leading you through the process of proving that the templates will report none if the sensor’s value cannot be converted to a timestamp or the sensor doesn’t exist.

The value you posted can be converted so the remaining reason is the sensor doesn’t exist. Ensure its spelling is correct because if you supply the states() function with a misspelled entity_id, it will produce the results you get.

For example, your sensor doesn’t exist on my system so when I test the following templates, they all fail to produce the desired result.


NOTE

I just checked the documentation for the Jewish Calendar integration and the sensor’s name is sensor.upcoming_candle_lighting.

Correct the sensor’s name in your template and it should work.

Below is the updated sensor name which still returns a value of none:

 {{ states('sensor.upcoming_candle_lighting') | as_timestamp | timestamp_custom('%H:%M') }}

Post screenshots of Developer Tools > States showing the details of both sensors (or whichever one truly exists).