Can someone help with the following template please:
I’ve got a sensor with an attribute which contains the unix time when the shutter has been executed last time.
It’s possible to convert / and show the output in a template?
Invalid config for [template]: [value_template] is an invalid option for [template]. Check: template->sensor->0->value_template. (See /config/packages/esprolluik.yaml, line 1).
Did you try reading the error message and the documentation?
You’re using the modern format (template: at the top level), so you use state not value_template.
Both of your templates are unlikely to do what you want: I’m guessing you’ve copy/pasted them without understanding?
Your first post template only returns true or false depending if your UNIX timestamp is in the past or future. If that is what you want, it would be better to define a binary sensor.
Your second post template has other errors in it. You seem to be trying to convert the difference between two times into a date?
no, what I want to achieve with “somfy normal date sensor” is a convert from the unix time (somfy unix date sensor) to a readable date/time (so day, month, year, hour and minute).
Ok seems like I’m mixing templates, very confusing
but when i check configuration on developer tools, got this error:
Configuration invalid!
Invalid config for [sensor.template]: [states] is an invalid option for [sensor.template]. Check: sensor.template->sensors->unixtime_normtime->states. (See ?, line ?).
When try same code in different way in dev.tools template, it’s workig:
Secondly, a sensor with device_class: timestamp must have a state that is either a datetime object or an ISO8601 string (docs). The timestamp in your error message is neither of those, nor is it produced by the sensor configuration you posted.
Soo… a have a value of time (unix time) from weather station which is sended in HA trought mqtt (sensor.mqttunixtime) and it’s ok.
I want to transform this value in standard time (just hh:mm:ss) trought another sensor (sensor.unixtime_normtime) and shown in HA.
Thank’s!