{ config, ... }: let folderPath = config.services.home-assistant.configDir; filePath = "${folderPath}/dayOfWeek.json"; in { services.homeAssistantConfig = { sensor = [{ platform = "file"; name = "day_of_week"; file_path = filePath; value_template = "{{ value_json.dayOfWeek }}"; }]; homeassistant = { whitelist_external_dirs = [ folderPath ]; customize."sensor.day_of_week" = { icon = "mdi:calendar-today"; friendly_name = "Wochen Tag"; }; }; group = { overview.entities = [ "sensor.day_of_week" ]; }; }; systemd.services.dayOfWeek = { enable = true; before = [ "home-assistant.service" ]; wantedBy = [ "home-assistant.service" ]; serviceConfig = { User = "hass"; Type = "oneshot"; }; description = "set day of wek for homeassistant"; script = # sh '' date +'{"dayOfWeek":"%A"}' >> ${filePath} ''; }; systemd.timers.dayOfWeek = { enable = true; wantedBy = [ "multi-user.target" ]; timerConfig = { OnCalendar = "00:01:00"; Persistent = "true"; }; }; }