SunRay
SunRay




GET /api/v1/sun-exposure/days/{YYYY-MM-DD}?lat={lat}&lon={lon}

https://sunray.global/api/v1/sun-exposure/days/2026-03-21?lat=47.136111&lon=9.156667

const today = new Date().toLocaleDateString('en-CA');
fetch(`https://sunray.global/api/v1/sun-exposure/days/${today}?lat=47.136111&lon=9.156667`, {
  headers: { "Authorization": "Bearer YOUR_API_KEY" }
})
  .then(r => r.json())
  .then(console.log);


sensor:
  - platform: rest
    name: "SunRay Tagesdaten"
    resource_template: >
      {% set datum = now().strftime('%Y-%m-%d') %}
      https://sunray.global/api/v1/sun-exposure/days/{{ datum }}?lat=47.136111&lon=9.156667
    headers:
      Authorization: "Bearer YOUR_API_KEY"
    scan_interval: 86400

curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://sunray.global/api/v1/sun-exposure/days/2026-03-21?lat=47.136111&lon=9.156667"