#############################################
# HOME ASSISTANT SYSTEM UPTIME SENSORS
# V1.2 2025-11-26
# - System Monitor removed from YAML (must be added via UI)
# - Template sensors only
#############################################

#############################################
# TEMPLATE SENSORS (Home Assistant Core uptime)
#############################################
template:
  - sensor:
      - name: Home Assistant Core Uptime
        unique_id: ha_core_uptime_seconds
        icon: mdi:timer-outline
        unit_of_measurement: seconds
        state: >
          {% set start = states('sensor.uptime') %}
          {% if start in ['unknown', 'unavailable', 'none', ''] %}
            unknown
          {% else %}
            {{ (as_timestamp(now()) - as_timestamp(start)) | int }}
          {% endif %}
