This is based on this Feature Request Topic 231940 tited “Add service integration.reload”. It’s a long read, but good info. Basically it describes attempts to reload an integration that has not loaded; this can now be done with Developer Tools > Services & details from the above post.
SUMMARY: I use the below locelave card to enter an entity from an integration I want to reload, and the below script to make the service call to reload it.
NOTE: 1st I tested this in “Developer tools > Services” using ‘sensor.processor_use’, from System Monitor Integration, with:
Actually I take it back. The correct entity did get pasted to the script with the card. I used a persistanct notification in the 1st part of the script to display the passed variable and it passed the correct one.
So the issue is with the service call and passing the variable. In any case I will take your recomendation and simplify the process but before I try it I suspect that the service call may not work. I will update this here after I get to try it.
Therefore I suspect that the 1st one, the “Unknown error” method recv’d a string but not in a valid format ¯\(ツ)/¯
The service call may not support passing variables at all. The Developer Tools > Service method does not accept templates so this most likely is the case here also.
UPDATE: per solution provided below the correct use of the reload service call is with an ‘entity_id’ & providing an actual ‘entity_id’ in the input_text helper OR use an ‘entry_id’ with an integration ‘entry_id’ as described in the Feature Request post referenced above.
All your speculations are way off base. Look at the error in your logs to see what’s really happening. All data sections allow templates in the backend. Templates are not allowed in the frontend.
I have upated the initial post and no longer try to pass a variable from the frontend to the script. I was already made aware of this and was working towards the solution. I appreciate your response but please provide me some guidance on why the service call is not working.
This will not error if done correctly. You said it has an unknown error. That error is not
That error comes from not having the exterior quotes.
We need the error from
Keep in mind, you’re using entry_id which specifically requires an entry_id, not an entity_id. The error will most likely tell you this but we need to see that error.
Ok, now I think we are getting somewhere with your last point. But the error condition:
‘Error running action expected str for dictionary value @ data[‘entry_id’]. Got None’ :
Comes from another attempt: no longer relevant.
But your last point is where I miss-used “entry_id” instead of using “entity_id”. I will give that a try and hopefully that will resolve the issue. I will update this once I do.
Your suggestion on use of “entity_id” instead of “entry_id” pointed to the soluton: I used “entity_id” instead and it solved my issue & the reload of the integration was successful. With response: “Triggered Reload Integration”. I will have to wait to try this with an integration that has actually failed to verify.
FYI: My input_text contains an entity_id from System Monitor (specifically ‘sensor.processor_use’). I used this to test the service call.
The use of “entry_id” is discussed in the post I originally reference as well as the use of “entity_id”. Thought the “entry_id” needs a GUID identifier and not an entity_id. See Use of entry_id. I was not sending the right data for “entry_id”. When I changed it to “entity_id” and provided ‘sensor.processor_use’ it worked.
Although this referenced use in the post may be outdated ¯\(ツ)/¯
Thanks for your help.
Below are my updated card & script YAML that worked for me:
not sure why this is still an issue, but in the thread you linked from, I had posted the following script long time ago.
Its using a set of preset integrations alright, and that makes it easier than a text input I guess (albeit you need to do some preliminary work to find these):
reload_integration:
mode: restart
sequence:
service: homeassistant.reload_config_entry
data:
entry_id: >
{% set integrations =
{'AirVisual':'5eb8f23656691419057af661ce89dd6f',
'Gdacs':'a498806f5e7396c4a02fa6ab705544ab',
'Philips Hue 1':'7afbac0fccdd4e478fcd82fae86fabc5',
'Philips Hue 2':'fcb64edfc5ac2edbb656607d5193b583',
'Philips Hue 3':'bcd626bb51d4b44c34e4789fa0fa3f0a',
'Plugwise':'474a410dc55f45ad8124f87f62baa412',
'Plex':'a6e0ee41f708bdf1749de50a6b809c55',
'Spotify':'13936aa9fa5111ea8a76e12e5f5341bb',
'Synology':'8bda1afcdfb45a1f2aa57c8e9bfce47c',
'Tahoma':'1b61a0e84a7db5eb684a01e8d665a55f',
'Xbox':'e8cd7b63b43040dd0c7e86ddf685abe6',
'Z-Wave':'62213aa5a398677a26e1a3354a861183'} %}
{% set state = states('input_select.integration') %}
{% set id = integrations[state] if state in integrations %}
{{id}}
tbh, I find the tap_action you use a bit too aggressive. What if you incidentally select and you made a mistake…
just add a button in that same entities card for the script
Thanks, not an issue, just me learning from it all… I probably posted this in the wrong area.
I agree with you on the tap_action, I just wanted to test this out then never got to update that with a button.
I had seen this post before with the select and it is the better way to go. Just wanted something quick and dirty with the focus on trying an entity_id rather than the entry_id; even though I made the mistake of using entry_id for the service call.