Skip to content

Commit

Permalink
Logging and proj folder support for add-ons
Browse files Browse the repository at this point in the history
  • Loading branch information
helto4real committed May 24, 2020
1 parent 7b1bff5 commit 9508bed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/DaemonRunner/DaemonRunner/HassioConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ public class HassioConfig
[JsonPropertyName("log_level")]
public string? LogLevel { get; set; }

[JsonPropertyName("project_folder")]
public string? ProjectFolder { get; set; }

[JsonPropertyName("log_messages")]
public bool? LogMessages { get; set; }

[JsonPropertyName("generate_entities")]
public bool? GenerateEntitiesOnStart { get; set; }
}
10 changes: 10 additions & 0 deletions src/DaemonRunner/DaemonRunner/Service/RunnerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ public static async Task Run(string[] args)
{
Environment.SetEnvironmentVariable("HASS_GEN_ENTITIES", hassAddOnSettings.GenerateEntitiesOnStart.ToString());
}
if (hassAddOnSettings.LogMessages is object && hassAddOnSettings.LogMessages == true)
{
Environment.SetEnvironmentVariable("HASSCLIENT_MSGLOGLEVEL", "Default");
}
if (hassAddOnSettings.ProjectFolder is object &&
string.IsNullOrEmpty(hassAddOnSettings.ProjectFolder) == false)
{
Environment.SetEnvironmentVariable("HASS_RUN_PROJECT_FOLDER", hassAddOnSettings.ProjectFolder);
}

// We are in Hassio so hard code the path
Environment.SetEnvironmentVariable("HASS_DAEMONAPPFOLDER", "/config/netdaemon");
}
Expand Down

0 comments on commit 9508bed

Please sign in to comment.