Hi,
Is there a way to trigger an automation when a Hassio addon stops or starts?
I was looking for a way to check the status of installed/ running Hassio addons but couldn’t find any info or examples.
Cheers.
1 Like
Found an answer on the Discord channel.
You can use the Homeassistant Rest API to check the status of a running addon.
Example:
http://hassio:8123/api/hassio/addons/addon_slug_name/info
Then you can simply extract the state attribute value from the result.
Hope this helps someone.
1 Like
silvrr
January 8, 2019, 3:57pm
3
@Kanishkaz were you able to get this into a sensor on the front end? If so can you share your config?
I ended up moving NodeRed into a separate docker container outside of Hassio, so I’m not using the sensor anymore.
But, this is what I had in my config at the time:
- platform: command_line
name: Node-Red Status
command: !secret node_sensor
value_template: '{{ value_json.data.state }}'
Unfortunately, I don’t have a copy of the secret. But I believe it’s just the following url with my credentials.
http://hassio:8123/api/hassio/addons/addon_slug_name/info
You should be able to get the slug name by running the command “hassio su info” in ssh.
Hope that helps.
Hey there, does this method still work? I can’t get it to work…
edit: nevermind, got it to work. If anyone reading this in the future is still interested, i can clean up my config files an share them
tomtom17
(Thomas Roche)
May 20, 2020, 7:50pm
6
Hi,
Could you share your config ?
I don’t get it to work.
THX
Hi,
Unfortunately I don’t use this automation anymore, so I don’t have it in my config.
But I think you can find the slug name by using the following command in the terminal:
ha addons
You can still use the REST API call I have included in my previous example. You just need to make sure you also pass in an Authorization header with a token.
Here’s another example I found from a different user.
SVNKoch
(Sven Koch)
October 20, 2022, 9:33am
9
For anyone stumbling across this like me:
Nowadays there is a binary sensor which can tell you if an addon is running. You just have to enable it.
Go to Settings > Devices > Addon in question > Sensors > Running
> Advanced Options > Enable.
Using the not_running
trigger you can trigger on an addon stopping.
Feature was added here:
home-assistant:dev
← home-assistant:addon-started
opened 05:19PM - 20 Oct 21 UTC
<!--
You are amazing! Thanks for contributing to our project!
Please, DO N… OT DELETE ANY TEXT from this template! (unless instructed).
-->
## Breaking change
<!--
If your PR contains a breaking change for existing users, it is important
to tell them what breaks, how to make it work again and why we did this.
This piece of text is published with the release notes, so it helps if you
write it towards our users, not us.
Note: Remove this section if this PR is NOT a breaking change.
-->
## Proposed change
<!--
Describe the big picture of your changes here to communicate to the
maintainers why we should accept this pull request. If it fixes a bug
or resolves a feature request, be sure to link to that issue in the
additional information section.
-->
![image](https://user-images.githubusercontent.com/15093472/138140777-9c06d98e-3f08-4a4f-9c6a-e069e8be586b.png)
## Type of change
<!--
What type of change does your PR introduce to Home Assistant?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [x] New feature (which adds functionality to an existing integration)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- Link to documentation pull request:
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [x] The code change is tested and works locally.
- [x] Local tests pass. **Your PR cannot be merged unless tests pass**
- [x] There is no commented out code in this PR.
- [x] I have followed the [development checklist][dev-checklist]
- [x] The code has been formatted using Black (`black --fast homeassistant tests`)
- [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
If the code communicates with devices, web services, or third-party tools:
- [ ] The [manifest file][manifest-docs] has all fields filled out correctly.
Updated and included derived files by running: `python3 -m script.hassfest`.
- [ ] New or updated dependencies have been added to `requirements_all.txt`.
Updated by running `python3 -m script.gen_requirements_all`.
- [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
- [ ] Untested files have been added to `.coveragerc`.
The integration reached or maintains the following [Integration Quality Scale][quality-scale]:
<!--
The Integration Quality Scale scores an integration on the code quality
and user experience. Each level of the quality scale consists of a list
of requirements. We highly recommend getting your integration scored!
-->
- [ ] No score or internal
- [ ] 🥈 Silver
- [ ] 🥇 Gold
- [ ] 🏆 Platinum
<!--
This project is very active and we have a high turnover of pull requests.
Unfortunately, the number of incoming pull requests is higher than what our
reviewers can review and merge so there is a long backlog of pull requests
waiting for review. You can help here!
By reviewing another pull request, you will help raise the code quality of
that pull request and the final review will be faster. This way the general
pace of pull request reviews will go up and your wait time will go down.
When picking a pull request to review, try to choose one that hasn't yet
been reviewed.
Thanks for helping out!
-->
To help with the load of incoming pull requests:
- [ ] I have reviewed two other [open pull requests][prs] in this repository.
[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone
<!--
Thank you for contributing <3
Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/en/development_checklist.html
[manifest-docs]: https://developers.home-assistant.io/docs/en/creating_integration_manifest.html
[quality-scale]: https://developers.home-assistant.io/docs/en/next/integration_quality_scale_index.html
[docs-repository]: https://github.com/home-assistant/home-assistant.io
2 Likes
I’m new to Home Assistant and came across this thread when trying to find a trigger for an addon stopping. I didn’t the find feature to enable the binary sensor for that purpose. There is only a watchdog feature but no sensor that comes with it.
I also didn’t find this:
Has this feature been taken out of Home Assistant again or am I just not seeing where I can enable it? Under “entities” there is only a sensor for an addon update.
Hey, instructions above a bit unclear
Go to Settings > Devices & services > Devices > filter devices by supervisor , enter “addon device” from supervisor > enable running sensor
4 Likes
Thanks a lot! I was struggling to find this feature.
1 Like
colinnz
(Colin)
July 8, 2024, 2:51am
14
Just seen this. Thanks for taking the time to document this.
thargy
(Craig Dean)
October 20, 2024, 4:44pm
15
Sadly this no longer works, at least for ESPHome
.
The esphome_running
entity remains in the running
state even when stopping the addon, never mind when restarting it