qJake / HADotNet.CommandCenter

📱 A web-based, wall-mountable command center for Home Assistant.
https://hacc.dev
Apache License 2.0
158 stars 11 forks source link

Impossible to add tile #89

Closed sr-as2 closed 4 years ago

sr-as2 commented 4 years ago

Hi, hacc version 1.0.16

I can only add these tiles: Navigation, Blank and Date tile And i can't access to admin/technical, it's a 404

My Settings page is empty, i try to add a token but it doesn't work:

fail: HADotNet.CommandCenter.Controllers.AdminController[0] Invalid system settings entered, or unable to reach Home Assistant with the specified information. System.Exception: Unexpected response code 502 from Home Assistant API endpoint /api/discovery_info. at HADotNet.Core.BaseClient.Get[T](String path) at HADotNet.Core.Clients.DiscoveryClient.GetDiscoveryInfo() at HADotNet.CommandCenter.Controllers.AdminController.Settings() in /src/HADotNet.CommandCenter/Controllers/AdminController.cs:line 66 fail: HADotNet.CommandCenter.Controllers.AdminController[0] Saving system settings failed. System.NullReferenceException: Object reference not set to an instance of an object. at HADotNet.CommandCenter.Controllers.AdminController.Settings(SystemSettings newSettings) in /src/HADotNet.CommandCenter/Controllers/AdminController.cs:line 99

For my docker: Server: Docker Engine - Community Engine: Version: 19.03.8 API version: 1.40 (minimum version 1.12) Go version: go1.12.17 Git commit: afacb8b7f0 Built: Wed Mar 11 01:24:36 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683

Supervisor version 214, Home Assistant 0.107.7

qJake commented 4 years ago

@sr-as2 What are you entering for the settings? You generated a long-lived access token, I'm assuming, and what base URL are you using?

sr-as2 commented 4 years ago

I start grom the beginning :

Create a LLT, add it in the /Admin/Settings <img width="434" alt="HA1" src="https://user-images.githubusercontent.com/48023575/78755180-0b8cc500-7979-11ea-8de4-b4ac0bc707b4.PNG">

Clik Save settings and have an error:

HA2

I try with "Override Asset Base URL" empty and with my base url, but it's the same. I show you the log when i clik Save Settings:

info: HADotNet.CommandCenter.Middleware.HAClientInitialization[0] HA connection is not initialized, redirecting user to settings area... fail: Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery[7] An exception was thrown while deserializing the token. Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted. ---> System.Security.Cryptography.CryptographicException: The key {ab3ac303-ac96-4a7f-bcc3-ea52abdad1b5} was not found in the key ring. at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte[] protectedData, Boolean ignoreRevocationErrors, Boolean& requiresMigration, Boolean& wasRevoked) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData) at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken) --- End of inner exception stack trace --- at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken) at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.GetCookieTokenDoesNotThrow(HttpContext httpContext)

qJake commented 4 years ago

@sr-as2 Do you have the HTTP component configured in Home Assistant?

Mine looks like this, yours should look similar:

http:
  server_port: 8123
  base_url: https://my-custom-domain.com:443
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem

This (especially the base_url) is required by HACC.

sr-as2 commented 4 years ago

My conf: http: base_url: https://_mydomain_.fr.to

I set the LLT and impossible to save:

fail: HADotNet.CommandCenter.Controllers.AdminController[0] Saving system settings failed. System.NullReferenceException: Object reference not set to an instance of an object. at HADotNet.CommandCenter.Controllers.AdminController.Settings(SystemSettings newSettings) in /src/HADotNet.CommandCenter/Controllers/AdminController.cs:line 99

I have an httpS url for external and a http only for internal. I have a reverse proxy that maps my external url to my local server adress 192.168.0.2:8123

qJake commented 4 years ago

@sr-as2 I published a new 1.0.17 preview build last night. I altered some of this logic - I'm wondering if you try again with the new version, are there any new/different messages in the log? Or could you post the full log?

sr-as2 commented 4 years ago

Last post was done with 1.0.17

qJake commented 4 years ago

@sr-as2 Just released 1.0.18, can you try again and post any relevant logs if things don't go right?

sr-as2 commented 4 years ago

Yeah ! Great it's working! Thank you @qJake !

qJake commented 4 years ago

Awesome! Glad we were able to resolve it!