One of the first things I did nearly two years ago in HA was my garden irrigation. We have plenty of rain here at the moment so I am not currently using it but other people it seems, are.
Yesterday I saw someone posted that it had broken in a small easily fixed way after upgrading to v0.103.
I’m just wondering if this is a (un)known breaking change because I didn’t see anything about it and in any case I thought everything passed between scripts were strings.
TypeError: can only concatenate str (not "int") to str
And that changing it to
cycle: '1'
fixes the problem.
Maybe you’ll say it is just something that has been rectified and that I shouldn’t have been doing that way in the first place (which I suppose could be a fair comment). But I’m interested if something changed?
Anyway as I said I haven’t checked this directly but the original post is here: My Garden Irrigation
I can’t tell if you’re saying you’re actually getting a TypeError, or if you’re just worried that you might run into a problem.
The value passed into the script, given the way you’re calling it, will be an int. However, once you do {{ cycle }}, that will return a string, which will be substituted into the larger string. I don’t see where you are or will have a problem.
I’d have to look at the code. I see reference to a file named garden_irrigation.yaml, but the topic is too long for me to try and find it. If you can point me at it maybe I can explain why they got that TypeError.
You can find it on my GitHub (which is a snapshot of some of my code at a moment in time purely as a convenient way to share it, not a true ‘live’ repository).
Interesting.
I can’t check now to be 100% sure but think I probably used ‘+’ instead of ‘~’ a lot in that package and there are a few other people using it as well so I’m surprised the error hasn’t come up before now…
If you called the script with cycle as a string, it would not have caused an exception.
Bottom line, you can’t concatenate a str and an int using +. In Jinja you can do it with ~, which means convert the operands to str first, then concatenate. This is not new, no matter how “lucky” you might have been before.
In DevTools it works, thank You.
But in code switching to entity_id do not help. Still the same error. Moreover, I double checked in backup and previously, when it worked, I had entity.