added van_weather

This commit is contained in:
2026-02-04 18:46:30 -05:00
parent 89e37249af
commit 557c1a4d5d
6 changed files with 348 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
{ pkgs, ... }:
{
users = {
users.hass = {
@@ -21,6 +22,7 @@
victron_modbuss = "!include ${./home_assistant/victron_modbuss.yaml}";
battery_sensors = "!include ${./home_assistant/battery_sensors.yaml}";
gps_location = "!include ${./home_assistant/gps_location.yaml}";
van_weather = "!include ${./home_assistant/van_weather_template.yaml}";
};
};
recorder = {
@@ -71,6 +73,10 @@
unifi-discovery # for ubiquiti integration
];
extraComponents = [ "isal" ];
customComponents = with pkgs.home-assistant-custom-components; [
pirate-weather
];
};
esphome = {
enable = true;

View File

@@ -0,0 +1,15 @@
weather:
- platform: template
name: "Van Weather"
unique_id: van_weather_template
condition_template: "{{ states('sensor.van_weather_condition') }}"
temperature_template: "{{ states('sensor.van_weather_temperature') }}"
apparent_temperature_template: "{{ states('sensor.van_weather_apparent_temperature') }}"
humidity_template: "{{ states('sensor.van_weather_humidity') }}"
pressure_template: "{{ states('sensor.van_weather_pressure') }}"
wind_speed_template: "{{ states('sensor.van_weather_wind_speed') }}"
wind_bearing_template: "{{ states('sensor.van_weather_wind_bearing') }}"
visibility_template: "{{ states('sensor.van_weather_visibility') }}"
forecast_daily_template: "{{ state_attr('sensor.van_weather_forecast_daily', 'forecast') }}"
forecast_hourly_template: "{{ state_attr('sensor.van_weather_forecast_hourly', 'forecast') }}"
attribution_template: "Powered by Pirate Weather"

View File

@@ -0,0 +1,31 @@
{
pkgs,
inputs,
...
}:
{
systemd.services.van-weather = {
description = "Van Weather Service";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
environment = {
PYTHONPATH = "${inputs.self}/";
};
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.my_python}/bin/python -m python.van_weather.main";
EnvironmentFile = "/etc/van_weather.env";
Restart = "on-failure";
RestartSec = "5s";
StandardOutput = "journal";
StandardError = "journal";
NoNewPrivileges = true;
ProtectSystem = "strict";
ProtectHome = "read-only";
PrivateTmp = true;
ReadOnlyPaths = [ "${inputs.self}" ];
};
};
}