home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.56k stars 30.74k forks source link

Why do you restart Home Assistant? #39033

Closed balloob closed 4 years ago

balloob commented 4 years ago

People talk about how they want to have the Home Assistant restart button front and center in the UI. As less and less things actually require a restart, I want to use this issue to see why people are still restarting that often.

foxy82 commented 4 years ago

For me at the moment it is these three in this order: 1) Template entities 2) light.group, etc entities 3) Changes to Alexa config 4) Integrations that aren't defined by the UI yet.

dshokouhi commented 4 years ago

Notify services require a restart, like logging into mobile app.

fi-sch commented 4 years ago
  1. When doing changes in sensors setup (especially using templates).
  2. When doing changes in integrations setup (e.g. HomeKit or iOS).
thijsdejong commented 4 years ago

Configuration changes

dmulcahey commented 4 years ago

I generally put off trying new stuff until I upgrade to avoid restarts. The template entities all look interesting but I have avoided them because they aren’t configurable from the UI or hot reloadable at this moment. There is a WTH about the utility integrations not being usable from the UI as well. TBH, I didn’t even know about most of them and seeing that WTH was an aha! moment of sorts.

Olen commented 4 years ago
timmo001 commented 4 years ago

For me it's usually something broke over time without reason (or logs) and a restart usually always fixes the problem.

I'd like a solution where you can reload individual integrations which might help track down the issue. Usually it's the case that the logs are flooded at startup so anything with an issue that isn't front and center, gets lost or cleared in the UI

Olen commented 4 years ago

Reloading/restarting individual integrations would be great. Not all integrations are very good at reconnecting to remote services they depend on on certain errors, or they just keep on failing if they have failed once, because some internal state is wrong.

McGiverGim commented 4 years ago

Usually add/modify sensors and integrations.

fi-sch commented 4 years ago
  • Changes to recorder and influxdb (which entities to include/exclude)

Oh yes, that one! It's so annoying when you notice that some wicked entity popped up in your recorder data!

KennethLavrsen commented 4 years ago

I have to restart after having removed a device from .storage/core.device_registry

When that bug gets fixed I will need to restart 20% less often I would say.

(sorry could not help it)

bdraco commented 4 years ago

Ones I am working though

I use these....

..and collected from this issue:

... and from other PRs/issues


Ones that can use the new helper but I won't likely get to before 0.115

Please jump in and help if you can. (https://github.com/home-assistant/core/pull/39268 is a good example of how to add the reload service)


Notify platforms using YAML


Ones that might be able to use the new helper but unsure as they have platform and config entries (help wanted)


device_tracker platforms (likely won't make 0.115)


Ones that can't use the new helper and need a custom solution (help wanted)

pergolafabio commented 4 years ago

To enable debug mode for investigation of issues

roflmao commented 4 years ago

Configuration changes (yaml) and HACS updates

bdraco commented 4 years ago

For HACS updates that use config flows (won't work for yaml) we might be able to unload the config entry then from importlib import reload then reset up.

We would need to reload zeroconf and ssdp etc as well

dshokouhi commented 4 years ago

For HACS updates that use config flows (won't work for yaml) we might be able to unload the config entry then from importlib import reload then reset up.

We would need to reload zeroconf and ssdp etc as well

What about at taking it one step further and just reloading any non-core integration? Is that possible? I think that would solve a lot of the restarts for most people.

Mariusthvdb commented 4 years ago

for changing config settings for Lovelace in:

lovelace:
  mode: yaml
  resources: !include lovelace/resources.yaml
  dashboards:
    ui-settings:
      mode: yaml
      filename: ui-settings.yaml
      title: Settings
      icon: mdi:tools
      show_in_sidebar: true
      require_admin: true

which can not be reloaded by 'reload resources'

also, for correcting the ever changing unique id's of the iOS devices using browser-mod.

since you're talking about adding a restart button: why not have the system automatically sense these changes and selectively update these if and when they arise? (of course after a config check....)

would be so very cool not to have to restart the config for 1 template sensor ;-)

Olen commented 4 years ago

For the lovelace part, I would suggest using the following:

lovelace:
  mode: storage
  dashboards:
    home-dash:
      mode: yaml
      title: Home
      icon: fas:city
      show_in_sidebar: true
      filename: dash-home.yaml

This allows all resourecs to work directly by adding them in the GUI. So no need to restart anything.

Just hide the default generated dashboard ifrom the sidebar if you dont care about it.

Icexist commented 4 years ago

Any integration update. If I'm trying out a config or trying to get an integration to work, a restart is required. HACS updates.

Mariusthvdb commented 4 years ago

For the lovelace part, I would suggest using the following:


lovelace:

  mode: storage

  dashboards:

    home-dash:

      mode: yaml

      title: Home

      icon: fas:city

      show_in_sidebar: true

      filename: dash-home.yaml

This allows all resourecs to work directly by adding them in the GUI. So no need to restart anything.

Just hide the default generated dashboard ifrom the sidebar if you dont care about it.

Thanks for your suggestion, will check it out. But, I do need yaml mode for the main ui. Nothing default generated here I am afraid

noxhirsch commented 4 years ago

For me it's these things in this order:

  1. template sensors
  2. command line sensors
  3. REST sensors
  4. REST commands
  5. updating custom components via HACS
  6. adding/removing entities to/from recorder
  7. adding new integrations which don't have UI

I'm often working on these things, so I often have to reboot multiple times a day (of course not every day).

scstraus commented 4 years ago
  1. Adding secrets
  2. Adding/editing template sensors
  3. HACS or other custom component update via HACS which require it
  4. To generate new captcha for alexa_media_player
  5. Changing browser_mod device ID's in config when they change on the device
  6. Adding resources for custom lovelace cards or new integrations.
nickrout commented 4 years ago

Updates to HACS and updates to custom_components that HACS has updated is probably my main reason, but I'll keep an eye on my usage :)

Adminiuga commented 4 years ago
bdraco commented 4 years ago

Very much a rough draft (it works): https://github.com/home-assistant/core/pull/39075 . Calling the template.reload service will remove, and recreate all the template entities from configuration.yaml.

Mariusthvdb commented 4 years ago

+1 to @Adminiuga 's Ip ban list. 192.168.1.1 gets banned, and only deleting this file and restarting can solve it. Would be really nice to be able to go into the advanced settings, and as logged in admin push a Reset Ip Bans. Otoh, how to reach that if the instance gets a 401 error....

fjufju commented 4 years ago
cyberjunky commented 4 years ago

On Thu, Aug 20, 2020 at 9:44 AM Fumi Ju notifications@github.com wrote:

  • recorder
  • history
  • non-ui (yaml based) integrations
  • HACS updates

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/39033#issuecomment-677432177, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJR36KRYI3ZS63MGPE2RETSBTH4PANCNFSM4QEWPNVQ .

chemelli74 commented 4 years ago

Simone

lindsaymarkward commented 4 years ago

I'm very happy to see this, thanks. I'm in the same category that restarting is by far the most common reason I visit "Configuration". This is mostly for changes to configuration.yaml including adding new integrations, lights, templates, etc. but also when some integration is not working because the device is down/offline or something, and getting it back on doesn't restore it in HA. Restarting HA solves the problem.

Mariusthvdb commented 4 years ago

Yes! Great you mention that. Examples like Meteoalarm or the IKEA integration when it loses connection and even a restart of the hub doesn't help. Or Weatherbit (not core) which even has its own retry built in.

iMicknl commented 4 years ago

Mainly for HACS updates and sometimes for (custom) integrations that have errors which are resolved after a restart.

IsaacBreuer commented 4 years ago

Tamplates Genetic thermostat Hacs update

firstof9 commented 4 years ago

I'd like to add:

IsaacBreuer commented 4 years ago

Adding mqtt switches sensor etc that don't support discovery

Misiu commented 4 years ago
ghost commented 4 years ago
  1. Template Sensors
  2. MQTT Sensors
Peklaa commented 4 years ago

Great stuff! For me it's things like template sensors, template switches, command line switches that usually require a couple of tries before I have them error free and working the way I want. The integration that recently made me do a number of configuration.yaml edits was rfxtrx, because of how its configuration has changed.

bdraco commented 4 years ago

Great stuff! For me it's things like template sensors, template switches, command line switches that usually require a couple of tries before I have them error free and working the way I want. The integration that recently made me do a number of configuration.yaml edits was rfxtrx, because of how its configuration has changed.

The solution used for homekit will likely work for rfxtrx if the code owner is interested in implementing it.

Misiu commented 4 years ago

@bdraco I followed your steps and created https://github.com/home-assistant/core/pull/39548 which adds reload service to rpi_gpio. I'll be grateful if you could take a look at it. If this is really that simple I can take a look at other integrations.

Misiu commented 4 years ago
  • ping (it may make more sense to convert this from a legacy platform instead)

@bdraco what do you mean by that? ping recently got async support, icmplib, and reload support. I guess the ping device tracker could be converted to async, but not sure if I should rewrite this. BTW can a device tracker support reload service? The ping device tracker is missing that.

bdraco commented 4 years ago
  • ping (it may make more sense to convert this from a legacy platform instead)

@bdraco what do you mean by that? ping recently got async support, icmplib, and reload support. I guess the ping device tracker could be converted to async, but not sure if I should rewrite this.

ping is still using the legacy device tracker code. I'm not sure it can be converted to the newer method though since I haven't had time to dig in.

BTW can a device tracker support reload service? The ping device tracker is missing that.

Current device trackers cannot be reloaded. I don't think I'll be able to implement this before 0.115 beta

Misiu commented 4 years ago

@bdraco no worries :) I can't find words to describe how much I'm amazed by your work in this project. You are doing a tremendous job!

sophof commented 4 years ago

I would love to add the bayesian sensors to the list. They require a lot of fiddling generally, so I tend to have to restart a lot for them.

I have tried adding it myself, see: https://github.com/home-assistant/core/compare/dev...sophof:bayesian_reload

This works but the Issue is that I have no clue how to add the tests, I have been playing around but I can't get it to work. (this is actually always the issue for me, the code for tests always reads like Chinese to me and I can't find any documentation on it)

bdraco commented 4 years ago

I would love to add the bayesian sensors to the list. They require a lot of fiddling generally, so I tend to have to restart a lot for them.

I have tried adding it myself, see: dev...sophof:bayesian_reload

This works but the Issue is that I have no clue how to add the tests, I have been playing around but I can't get it to work. (this is actually always the issue for me, the code for tests always reads like Chinese to me and I can't find any documentation on it)

Added here https://github.com/home-assistant/core/pull/39771

sophof commented 4 years ago

I would love to add the bayesian sensors to the list. They require a lot of fiddling generally, so I tend to have to restart a lot for them. I have tried adding it myself, see: dev...sophof:bayesian_reload This works but the Issue is that I have no clue how to add the tests, I have been playing around but I can't get it to work. (this is actually always the issue for me, the code for tests always reads like Chinese to me and I can't find any documentation on it)

Added here #39771

Thanks! And since your test is remarkably similar to what I already had, I think I understand what I did wrong as well :)

DanielWe2 commented 4 years ago

I think the influxdb should be added to the list. Everytime a new sensor gets added (For example an esphome sensor using the UI) and if i want to push it's data to influx db I have to add it to influxdb include configuration and restart Home Assisant. (The same for recorder but that is already listet somewhere in this issue).

DanielWe2 commented 4 years ago

Also: What about the customize configuration? For example if I change the device_class of a binary_sensor it needs a restart. (I would like that change that using the UI btw.)

firstof9 commented 4 years ago

Customize can already be reloaded. If you modify via the UI, it reloads automatically when you press Save

Misiu commented 4 years ago

@DanielWe2 take a look at my PR: https://github.com/home-assistant/core/pull/39548 You should be able to create a similar PR for influxdb. It's just a matter of adding setup_reload_service(hass, DOMAIN, PLATFORMS) to setup_platform and services.yaml.