Small project share:
Wanted to skip the hassle of visiting the path steps config -> server control -> reload
every time
So I made a HA Webhook with the reload
and restart
service of HA and called this with JavaScript inside a browser bookmark that is sitting in the browser bookmark bar right above my HA page.
Webhooks config in “automations”:
- alias: Reload automations
initial_state: 'on'
trigger:
platform: webhook
webhook_id: 'reload-automations'
action:
- service: automation.reload
- alias: Restart Homeassistant
initial_state: 'on'
trigger:
platform: webhook
webhook_id: 'restart-homeassistant'
action:
- service: homeassistant.restart
Bookmark code (not usable):
(function() {
fetch('http://homeassistant.local:8123/api/webhook/reload-automations', {
method: 'POST'
})
.catch((error) => {
alert(error);
});
}());
Bookmark code (usable)
note: javascript:
is importend to add
javascript:(function()%7B(function()%20%7Bfetch('http%3A%2F%2Fhomeassistant.local%3A8123%2Fapi%2Fwebhook%2Freload-automations'%2C%20%7Bmethod%3A%20'POST'%7D).catch((error)%20%3D%3E%20%7Balert(error)%3B%7D)%3B%7D())%7D)()
You can replace an existing bookmark-url with above code and rename the url in above encoded code with appropriate url.