Skip to content

Commit

Permalink
Merge pull request #6 from timia2109/feature/restructure
Browse files Browse the repository at this point in the history
Fix HASS
  • Loading branch information
timia2109 authored Apr 3, 2024
2 parents 01a23e3 + a8719e1 commit f947a3e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion HomeAssistant/HassExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using DisplayUtil.Template;
using DisplayUtil.Utils;
using NetDaemon.Client.Extensions;
using NetDaemon.Client.Settings;
Expand All @@ -19,7 +20,7 @@ public static IHostApplicationBuilder AddHassSupport(this IHostApplicationBuilde

builder.Services
.AddHomeAssistantClient()
.AddScoped<HassTemplateExtender>();
.AddScoped<ITemplateExtender, HassTemplateExtender>();

// Hack: Initialize Hass Model
var extensionType = typeof(DependencyInjectionSetup);
Expand Down
2 changes: 1 addition & 1 deletion HomeAssistant/HassHostedService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public Task StartAsync(CancellationToken cancellationToken)

private async Task OnConnection(IHomeAssistantConnection connection)
{
logger.LogInformation("Hass Connection initialized");
await cacheManager.InitializeAsync(_cancellationTokenSource.Token);
logger.LogInformation("Hass Connection initialized");
}

public Task StopAsync(CancellationToken cancellationToken)
Expand Down
2 changes: 1 addition & 1 deletion Template/TemplateRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public async Task<Stream> RenderToStreamAsync(string content)
{
var template = Scriban.Template.Parse(content);
var rendered = await template.RenderAsync(contextProvider
.GetTemplateContext());
.GetTemplateContext(EnrichScope.ScreenRendering));

var memoryStream = new MemoryStream();
memoryStream.Write(Encoding.UTF8.GetBytes(rendered));
Expand Down

0 comments on commit f947a3e

Please sign in to comment.