diff --git a/HA_Chat/.dockerignore b/HA_Chat/.dockerignore new file mode 100644 index 0000000..fe1152b --- /dev/null +++ b/HA_Chat/.dockerignore @@ -0,0 +1,30 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md +!**/.gitignore +!.git/HEAD +!.git/config +!.git/packed-refs +!.git/refs/heads/** \ No newline at end of file diff --git a/HA_Chat/Controllers/WeatherForecastController.cs b/HA_Chat/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..e2cfa6e --- /dev/null +++ b/HA_Chat/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace HA_Chat.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} diff --git a/HA_Chat/Dockerfile b/HA_Chat/Dockerfile new file mode 100644 index 0000000..5d43cc6 --- /dev/null +++ b/HA_Chat/Dockerfile @@ -0,0 +1,29 @@ +# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +# This stage is used when running from VS in fast mode (Default for Debug configuration) +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base +USER $APP_UID +WORKDIR /app +EXPOSE 8080 + + +# This stage is used to build the service project +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["HA_Chat.csproj", "."] +RUN dotnet restore "./HA_Chat.csproj" +COPY . . +WORKDIR "/src/." +RUN dotnet build "./HA_Chat.csproj" -c $BUILD_CONFIGURATION -o /app/build + +# This stage is used to publish the service project to be copied to the final stage +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./HA_Chat.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration) +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "HA_Chat.dll"] \ No newline at end of file diff --git a/HA_Chat/HA_Chat.csproj b/HA_Chat/HA_Chat.csproj new file mode 100644 index 0000000..a0c88ad --- /dev/null +++ b/HA_Chat/HA_Chat.csproj @@ -0,0 +1,16 @@ + + + + net9.0 + enable + enable + Linux + . + + + + + + + + diff --git a/HA_Chat/HA_Chat.http b/HA_Chat/HA_Chat.http new file mode 100644 index 0000000..bc8752b --- /dev/null +++ b/HA_Chat/HA_Chat.http @@ -0,0 +1,6 @@ +@HA_Chat_HostAddress = http://localhost:5208 + +GET {{HA_Chat_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/HA_Chat/HA_Chat.sln b/HA_Chat/HA_Chat.sln new file mode 100644 index 0000000..7870481 --- /dev/null +++ b/HA_Chat/HA_Chat.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35527.113 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HA_Chat", "HA_Chat.csproj", "{50BD86BA-2EC0-4CC0-8C24-A27411B68325}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4B4215C3-813B-4F2A-A0C8-4836A29D686D}" + ProjectSection(SolutionItems) = preProject + ..\README.md = ..\README.md + ..\repository.yaml = ..\repository.yaml + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {50BD86BA-2EC0-4CC0-8C24-A27411B68325}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {50BD86BA-2EC0-4CC0-8C24-A27411B68325}.Debug|Any CPU.Build.0 = Debug|Any CPU + {50BD86BA-2EC0-4CC0-8C24-A27411B68325}.Release|Any CPU.ActiveCfg = Release|Any CPU + {50BD86BA-2EC0-4CC0-8C24-A27411B68325}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/HA_Chat/Program.cs b/HA_Chat/Program.cs new file mode 100644 index 0000000..0989786 --- /dev/null +++ b/HA_Chat/Program.cs @@ -0,0 +1,21 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi +builder.Services.AddOpenApi(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.MapOpenApi(); +} + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/HA_Chat/Properties/launchSettings.json b/HA_Chat/Properties/launchSettings.json new file mode 100644 index 0000000..bfca692 --- /dev/null +++ b/HA_Chat/Properties/launchSettings.json @@ -0,0 +1,22 @@ +{ + "profiles": { + "http": { + "commandName": "Project", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5208" + }, + "Container (Dockerfile)": { + "commandName": "Docker", + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "environmentVariables": { + "ASPNETCORE_HTTP_PORTS": "8080" + }, + "publishAllPorts": true, + "useSSL": false + } + }, + "$schema": "https://json.schemastore.org/launchsettings.json" +} \ No newline at end of file diff --git a/HA_Chat/WeatherForecast.cs b/HA_Chat/WeatherForecast.cs new file mode 100644 index 0000000..c53eb57 --- /dev/null +++ b/HA_Chat/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace HA_Chat +{ + public class WeatherForecast + { + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} diff --git a/HA_Chat/appsettings.Development.json b/HA_Chat/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/HA_Chat/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/HA_Chat/appsettings.json b/HA_Chat/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/HA_Chat/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..d4e7532 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Home Assistant public add-on repository. diff --git a/repository.yaml b/repository.yaml new file mode 100644 index 0000000..113d568 --- /dev/null +++ b/repository.yaml @@ -0,0 +1,3 @@ +name: Spiderink Add-ons +url: https://git.spiderink.co.za/Public/HA_Addons +maintainer: Mark Schroeder \ No newline at end of file