Templating changes in 2021.10.0

Just the topic here

FWIW, as a general note of interest, the PR for is_numeric indicates the function was introduced as a companion for the process of converting a numeric string to a number. It includes an example showing its use with float (convert to float only if the value is numeric).

Just one more tool to guard against edge-cases.

Nope, I have to disagree here. There are numerous ways to fix that, better to avoid it in the first place.

  • Donā€™t set a warning, if it doesnā€™t come from core
  • If you need to set it, show where it is coming from, ideally explain it: ā€œThis warning is set by the addOn/custom component/whatever XX.ā€
  • Set a realistic timetable and work with it. One or two months to update the addOns/CC without setting a warning. So all developers have time to adjust. After that two months of warnings (like it is). Keep the user in mind, not the developer! It scares people, if they get warnings. :wink:

All in all, I can sum it up again to communication. It is what Iā€™m alway saying: hire someone that orders the communication and knows how to speak with the general public. What weā€™re doing here is talking on a high level, with code examples and things like that.

These changes affect users, most of them not very knowledgeable. An thatā€™s the way poeple should be. They want to use a system, not look for a warning here and an error message there. As a normal user I couldnā€™t care less, if this is set by an addOn or the core. I donā€™t want it to happen at all! And if there is a warning, I want to know why and where. I donā€™t want to go to the forum and search in threads like this one to find a solution, that is not very user friendly and not very ā€œsolutionyā€. Or is wait and see if maybe an addOn is the reason, but it has to be updated, maybe, or not, orā€¦ a good answer for a normal user?! I donā€™t think so!

And letā€™s be honest, streaming a launch party isnā€™t the way to make good communication. You set roadmaps, where interested users can see what is going in the future. And where developers can check, if something isnā€™t right. What we see here is developers thinking of changes, make them, and let others (like the suporting people in a forum) care of the rest. Why even thinking about how things turn out? This is the approach of a developer guided company, and that shouldnā€™t even be a point of discussion. If you want to run a business, you have to look at your customers/users. And that brings us back to communication. But Iā€™m starting to going in circles hereā€¦ :slight_smile:

1 Like

You donā€™t know that information. Itā€™s MQTT discovery. Sorry, but you donā€™t understand how this works, so this statement is not accurate. It would literally say ā€œMQTTā€ and youā€™d be back here with the same question. MQTT is a bridge between a component and HA, HA only knows about MQTT, it does not know what sets the MQTT topics.

MQTT Is a part of core. See previous response.

What your asking for is 100% not possible.

Roadmaps are set. These are on the roadmapsā€¦ People donā€™t want to use the tools that the devs use, which is github. Again, all explained many times before. Just because itā€™s not on these forums doesnā€™t mean itā€™s non-existent.

Youā€™re going in circles because you, like many, are unwilling to use the tools that HA provides for information.

The release party is a new and been going on since January to get people outside developers involved in the changes for each release. Iā€™m sorry that you donā€™t like that, but not everything in life is catered towards you. The release party seeā€™s thousands of views and many many many people like it. So, youā€™re welcome to sulk, but itā€™s not going to change anything.

You donā€™t understand my point. Iā€™m not unhappy with the release party, Iā€™m saying it should not be the way to communicate changes. Itā€™s a nice bonus for communication, but choosing it as the one way to communicate isnā€™t the right way. That is what Iā€™m saying.

And these are the most thruthful words Iā€™ve read in this thread. Fuck off users, we donā€™t care, we do it the way we want, good or bad, dump or not, it is our thing and we do as we choose.

Congratulations to such an insightful and understanding statement regarding user input! You couldnā€™t have made it clearer, how you (and maybe the developing team as well) sees us idiots, pumping money, time and heart in a project, where they have no influence or otherwise noteable voices to hear! :wink:

@finity See, yesterday I said it to you, and now Iā€™m exactly where you areā€¦ Havenā€™t thought it escaleted that quicklyā€¦ :rofl: :rofl: :rofl:

2 Likes

Same as above, you donā€™t get my point. It is exactly what Iā€™m complaining about. One needs to know the information, if it isnā€™t there, it should be part of the general change to develop a solution where this information IS present when a warning message is set. Easy as that. If you donā€™t have the information, donā€™t set a warning!

Or in short, donā€™t do half the job. The communication, and therefor to inform a user, must be part of the change. As I said, easy as that! :slight_smile:

Reading this, I just remember a joke:
A man is driving on the wrong side of a highway, there comes a message in the radio: ā€œBe careful, there is a wrong-way driver on the highway!ā€. ā€œOne?ā€ he asks, ā€œhundreds!ā€ā€¦ :slight_smile:

Maybe the thinking should go into another direction. If people are not using it, have we done this right? But it is always easier to pinpoint it to others than to yourself. I havenā€™t done anything wrong, the others are the idiots that canā€™t readā€¦ Maybe itā€™s just hidden that good?! But as I said numerous times, Iā€™m going in circles, as the statement above stands: ā€œā€¦it will not change anything!ā€

I would argue that part of being a user of HA is at least to know whatā€™s going in your system.
If value_json.currentZ doesnā€™t ring a bell to you, you probably lost control, and thatā€™s exactly what those new warnings are trying to address.

Pick your MQTT explorer, check the config topics and find out which device is sending you wrong values, likely since a long time.

New templating changes doesnā€™t make it easy to be true, but Iā€™ll try and want to understand because Iā€™ve couple of them.
How can I solve below template warning?

        attribute_templates:
          updated: >
            {{ as_timestamp(states.energy_teller_consumption.last_updated) | timestamp_custom('%Y-%m-%d %H:%M', true) }}
Template warning: 'as_timestamp' got invalid input 'None' when rendering template '{{ as_timestamp(states.energy_teller_consumption.last_updated) | timestamp_custom('%Y-%m-%d %H:%M', true) }}' but no default was specified. Currently 'as_timestamp' will return 'None', however this template will fail to render in Home Assistant core 2021.12

Thank you! :wink:

Let me see if I understand you correctlyā€¦

So, as users we are supposed to read every bit of code in a custom integration (and apparently submit it to memory) or we have ā€œlost controlā€ of our systems?

Really!?

What about HA core? is that our responsibility to dig into the code and understand everything in there as well?

we might as well all be developers if that is what you are implying.

And apologies if I misundertood something.

1 Like

The point is that the original warning message contain no information that the error is mqtt related.
Paddy has right to extent: messages stored in logs are one of weakest points of HA since I remember. Especially considering that HA is under constant development thus full of issues.
This problem is well known since multiple times discussed on that forum. Cannot say if this situation is improving but from time to time I can see questions from users about particular log record which indeed says nothing about the source. Only most experienced forum members are able to decode the log entry (probably because they experienced something similar so are able to connect those facts)

As for example from my log:

2021-10-08 17:20:41 WARNING (MainThread) [homeassistant.components.mqtt] JSON result was not a dictionary

At least I may suppose itā€™s related to mqtt (so no template related making it OT, sorry for it, but it proves my point). But WTH there is no information about related entity? Is it really so hard to add such info?

Youā€™re at least supposed to check your MQTT messages to determine where it comes from, so that to know where to report the issue, yes, donā€™t you agree?

Thatā€™s an easy one. If itā€™s not in your code, the only way I can think of that a template is pushed to HA is MQTT.

I agree with you that it would be extremely easy to include the entity_id on that one (and others).

Itā€™s your assumption (maybe true in case of HA). Regardless users skill this is not what can be confidently identified this way based on the warning message. Potentially there might be other components or even parts of single component communicate with each other causing such a message.

You are able to make a qualified guess. But most users are not. Which is the Paddyā€™s point.

Ah yes, solve breaking changes with more breaking changes.

My man, 1000s of people use the current tools and enjoy them. Literally a small handful of people on these forums donā€™t use them and complain about them. You are in the minority here.

The blog post has all the breaking changes. The release party is an in depth breakdown of each change and how it affects HA. All the information in the release party and blog is scattered across issues, PRs, and discussions on GitHub. The team takes that information and consolidates it for you, the user. Iā€™m sorry itā€™s not up to your standard. Youā€™re welcome to volunteer and help get that information across to the users in a better fashion.

Provide a default value for as_timestamp.

You should know that the reason you got the warning message isnā€™t simply because you didnā€™t provide a default value. You got a warning because states.energy_teller_consumption.last_updated was None and as_timestamp cannot convert None to a timestamp.

Why is it None? Because states.energy_teller_consumption.last_updated is an invalid entity reference. If itā€™s a sensor entity then it should be this:

states.sensor.energy_teller_consumption.last_updated
         ^
         |
 You overlooked to include this

The warning coming from the setup of mqtt discovery is a bit of a chicken-egg scenario. Home assistant is built in a way to have a fast startup. The more questions that home assistant setup asks, the slower the system is when it restarts. At that point during startup, the system does not know what itā€™s creating because it hasnā€™t been created yet. At best, you could get a topic if a topic was supplied, however, it will be the config topic and not the topic the sensor itself uses. Again, pretty useless for the user. The only logical solution here is to wait for a fix to the custom integration, addon, or device.

Hypothetically, even if you had the sensor information thatā€™s failing, what could you do? You canā€™t fix it because itā€™s coming from the integration, addon, or device, you have to wait for an update.

EDIT: I also want to point out that, even if you had the entity information thatā€™s being created, the developer whoā€™s fixing the issue doesnā€™t need it. They just need the template thatā€™s failing, which is already supplied in the warning.

I feel so stupid sometimes!
I really overlooked this one, as I do have 6 same kind of sensors which are ok, including the sensor part.
Iā€™m mixing up things. Iā€™ll come back later with a better, real example. :wink:

Create a new topic. This topic is for discussing the recent changes to several functions. General template debugging is best handled in a separate topic.