Skip to content

Commit

Permalink
Merge pull request #62 from qJake/project-updates
Browse files Browse the repository at this point in the history
Hass.io API fixes
  • Loading branch information
qJake authored Feb 8, 2020
2 parents f7571fa + 876f370 commit e53600b
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Docker/BuildHaccContainers.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$version = '1.0.3'
$version = '1.0.4'

function Test-ExitCode ([int] $Expected = 0)
{
Expand Down
4 changes: 3 additions & 1 deletion HADotNet.CommandCenter/Controllers/AdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ public async Task<IActionResult> Settings()
}

[HttpPost]
public async Task<IActionResult> Settings(SystemSettings newSettings)
public async Task<IActionResult> Settings([FromForm] SystemSettings newSettings)
{
try
{
if (ModelState.IsValid)
{
newSettings ??= new SystemSettings();

if (newSettings.IsHassIo)
{
newSettings.BaseUri = "http://hassio/homeassistant";
Expand Down
4 changes: 2 additions & 2 deletions HADotNet.CommandCenter/HADotNet.CommandCenter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<RuntimeIdentifiers>win10;alpine.3.10-x64;debian.10-arm</RuntimeIdentifiers>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<AssemblyVersion>1.0.3.0</AssemblyVersion>
<FileVersion>1.0.3.0</FileVersion>
<AssemblyVersion>1.0.4.0</AssemblyVersion>
<FileVersion>1.0.4.0</FileVersion>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Deterministic>false</Deterministic>
Expand Down
6 changes: 6 additions & 0 deletions HADotNet.CommandCenter/Views/Admin/Settings.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
}

<form class="ui form" asp-action="Settings" method="post">

<input type="hidden" asp-for="IsHassIo" />

@if (Model?.IsHassIo ?? false)
{
<div class="ui icon labeled info message">
Expand All @@ -59,6 +62,9 @@
</div>
</div>

<input type="hidden" asp-for="BaseUri" />
<input type="hidden" asp-for="AccessToken" />

<div class="ui grid">
<div class="row">
<div class="six wide computer twelve wide tablet sixteen wide mobile column">
Expand Down
1 change: 1 addition & 0 deletions HADotNet.CommandCenter/Views/Dashboard/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
window.ccOptions.autoReturn = @Model.CurrentPage.AutoReturnSeconds;
window.ccOptions.pageId = '@Model.CurrentPage.Name';
window.ccOptions.baseUrl = '@Model.SystemSettings.BaseUri';
window.ccOptions.socketUrl = '@(Model.SystemSettings.IsHassIo ? "http://hassio/homeassistant/websocket" : Model.SystemSettings.BaseUri)';
window.ccOptions.overrideAssetUrl = '@Model.SystemSettings.OverrideAssetUri';
window.ccOptions.token = '@Model.SystemSettings.AccessToken';
</script>
Expand Down
4 changes: 2 additions & 2 deletions HADotNet.CommandCenter/wwwroot/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,8 @@ class CommandCenter {
}
}
initUser() {
if (window.ccOptions.baseUrl) {
this.conn = new HAConnection(window.ccOptions.baseUrl);
if (window.ccOptions.socketUrl) {
this.conn = new HAConnection(window.ccOptions.socketUrl);
}
this.conn.OnConnectionStateChanged.on(state => {
if (state == HAConnectionState.Closed) {
Expand Down
2 changes: 1 addition & 1 deletion HADotNet.CommandCenter/wwwroot/js/app.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions HADotNet.CommandCenter/wwwroot/js/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ class CommandCenter

private initUser(): void
{
if (window.ccOptions.baseUrl)
if (window.ccOptions.socketUrl)
{
this.conn = new HAConnection(window.ccOptions.baseUrl);
this.conn = new HAConnection(window.ccOptions.socketUrl);
}

this.conn.OnConnectionStateChanged.on(state =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ declare interface ICcOptions
{
baseUrl: string;
overrideAssetUrl: string;
socketUrl: string;
token: string;
tilePadding: number;
tilePreviewPadding: number;
Expand Down

0 comments on commit e53600b

Please sign in to comment.