Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

home-assistant port doesn't do anything unless config is set #82076

Closed
Radvendii opened this issue Mar 8, 2020 · 3 comments
Closed

home-assistant port doesn't do anything unless config is set #82076

Radvendii opened this issue Mar 8, 2020 · 3 comments
Labels
0.kind: bug 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Comments

@Radvendii
Copy link
Contributor

Describe the bug
If you set services.home-assistant.port = 4000 but you don't set services.home-assistant.config to anything, then nothing changes. You still have to access it on port 8123

To Reproduce
Steps to reproduce the behavior:

  1. set
services.home-assistant = {
  enable = true;
  port = 4000;
};
  1. sudo nixos-rebuild switch
  2. check localhost:4000 and localhost:8123

Expected behavior
I will see the landing page on localhost:4000, and not on localhost:8123

Metadata

  • system: "x86_64-linux"
  • host os: Linux 5.4.23, NixOS, 20.09pre215947.82b54d49066 (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.3
  • channels(root): "nixos-20.09pre215947.82b54d49066"
  • channels(qolen): "home-manager, nixos-20.09pre215947.82b54d49066"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module: home-assistant
@matt-snider
Copy link
Contributor

I can reproduce this issue with the following test. The test hangs while waiting for the port. I see the issue, which is caused primarily by the configuration.yaml file only being overwritten when cfg.config != null.

# nixos/tests/home-assistant-bug.nix
# run with: nix-build nixos/tests/home-assistant-bug.nix
import ./make-test-python.nix ({ pkgs, ... }:
{
  name = "home-assistant";

  nodes = {
    hass =
      { pkgs, ... }:
      {
        services.home-assistant = {
          enable = true;
          port = 4000;
        };
      };
  };

  testScript = ''
    start_all()
    hass.wait_for_unit("home-assistant.service")
    with subtest("Check that Home Assistant's web interface and API can be reached"):
        hass.wait_for_open_port(4000)
        hass.succeed("curl --fail http://localhost:4000")
  '';
})

matt-snider added a commit to matt-snider/nixpkgs that referenced this issue Mar 13, 2020
…viour

If the `config` option is not set, the `port` option has no effect. This
is caused by the condition `cfg.config != null` not passing, resulting
in the default `configuration.yaml` file not being overwritten.

If `time.timeZone` isn't set, it also appears to cause home-assistant to
error out.

Another issue is that the `defaultConfig` doesn't currently set `frontend`
which means in the minimal setup with just `port` set, we still won't be able
to reach the frontend.
@stale

This comment was marked as outdated.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 9, 2020
@mweinelt
Copy link
Member

The services.home-assistant.port option was removed in 59a367b in time for NixOS 22.05.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
3 participants