There’s nothing that will make that template fail. Check your logs for errors. You don’t need to switch the template over from legacy to the ‘new’ style. It should work out of the box without fail. Something else is causing the entity to no longer load.
Looking at that specific template, the only way it would fail is if your source sensor was missing. And even then, it wouldn’t fail, it would just be unknown until it was found again.
i reverted back to previous ha core version right now, but i will update it once again tommorrow. Meanwhile configuration of that sensor itself looks like this:
sensors:
- name: "Komfovent on off num"
address: 0
input_type: holding
data_type: uint16
scan_interval: 5
That’s not what I asked for. I’m very confident that your entity was not being created and you were looking at the template being the problem when you should have been looking at the source. So when you update, please look at developer tools → states page for your sensor.komfovent_on_off_num sensor and verify it’s working.
After the update, that sensor was showing numeric state as intended, but it seems that mapper didn’t map that next sensor based on numeric state, but i will double check that again.
Sorry, but a template wouldn’t just fail like that. I know I keep hammering on this, but did you look at the sensor in developer tools → states page? Or did you look at it elsewhere? If the entity_id changed, that template wouldn’t know about it. The entire UI hides the entity_id behind the friendly name except for the developer tools → states page. So that’s where you need to look.
Please show a screenshot with the entit_id. That’s still showing the friendly name, not the entity_id. Just take a screenshot of the entity and it’s states and attributes in the table, not in the set state area.
Remove that. You’ll probably find a related message in your logs.
Note that your sensor state is "unknown", not the "Unknown" fallback value from your template.
As another hint, it’s a bit dangerous using a reserved word like state for a variable in your template. It seems to work for me in the template editor, but can be a bit risky.
Please also paste your template into the template editor and see if it returns what you’d expect. Like this, which returns Unknown for me because I don’t have your sensor:
I have just upgraded Homeassistant Core from 2023.4.6 to 2023.5.3 and notice that the following sensor (example) show Unknown in the UI while the value_template shows the correct output “Result type: string” value in the Jinja2 template engine. I have experimented with new template format, adding device class etc. but can’t lay my hands on the necessary correction. I have reverted back to 2023.4.6 and all time (hr:min) outputs are shown again.
Any advice welcome!