I’m trying to store the current volume level for my google home devices before I broadcast a message to restore it to the previous level afterwards. But somehow this doesn’t work. I get the message the volume set expects a float.
Could it be that the input helper for number is not a float?
The error message I get is :
2021-01-21 19:56:19 ERROR (MainThread) [homeassistant.components.script.var_test] var test: Error executing script. Invalid data for call_service at pos 4: expected float for dictionary value @ data['volume_level']
2021-01-21 19:56:19 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139884269493984] expected float for dictionary value @ data['volume_level']
As you stated the key is a float, but by putting double quotes around the template you turned it into a string I believe. Remove the double quotes and try that FWIW. Also, some key:value pairs will only accept a float, not a template, so not sure this will fix it. You could also try service_data: then your template.
HA stores all values as strings, you then have to convert them
Recently HA has been trying to ‘interpret’ dimensions from the values stored and convert them back but there are sometimes issues
You should always test in the template editor.
The question I have here from the above is how did you set up the input number and what it’s step value is compared to the values displayed in the template edit (you say you always test to) ie does it show 3.00 or just 3.0.?
You should know that marking your own post as the Solution is reserved for the situation where you actually solved it yourself.
It’s the custom of this community to mark the first post that offers, or leads to, a solution to the problem. Many people offered assistance and at least one of their responses provided a solution. That’s the post that should be marked with the Solution tag.
I’m trying to find my way in this forum. If there is common decency on how to tag a solution I’ll oblige. But for now, I don’t even know what : ‘So move the solution !’ even means…
Taras already explained.
Each topic can have only one solution.
You can tick any post in the thread as the solution.
You did none of the work but ticked your own post as the solution.
Think about that.
If everyone ticked their own posts as solutions then why are the rest of us here ?
Besides it’s just polite to acknowledge someone’s efforts
Find the post that helped you most and tick that.
ie Move the ‘solution’
I really think you are too much after that solution tick. Let them do what they like, who cares. It’s not a lie that that post leads to the final solution for someone who doesn’t want to read the entire thread.
No, I didn’t even know I was in the running, Taras gave the full explanation and gave the most guidance. I have no problem with him or anyone else for that matter taking the win.
Let me actually read the thread again.
Back in a moment.
Edit: No, I definitely do not deserve the solution, but outline for me why you think, anyone but Taras, does ?
For me it’s not about winning, it’s about somebody coming to this thread and finding the solution as fast as possible. If you summarize in a post the solution and mark it, it’s ok to me. It’s not a matter of who deserves it or who doesn’t, it’s about putting things as simple as possible for other people who haven’t necessarily followed the whole thread or aren’t willing to.