Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 110528

Rest resource template with sensor value in url - unsplash

$
0
0

I’m trying to get a random unsplash photo using a sensor value that sets a theme. However, it seems resource doesn’t accept sensors. Is there a solution for this problem?

Thank you for helping me.

rest:
  - resource: https://api.unsplash.com/photos/random?query=wallpaper,{{ states('sensor.background_theme') | urlencode }}&orientation=landscape&client_id=apikey
    scan_interval: 1800
    method: GET
    headers:
      Content-Type: application/json
    sensor:
      name: "Unsplash Background"
      unique_id: unsplash_background
      json_attributes:
        - urls
      value_template: >
        {% if value_json and and value_json.urls and value_json.urls.full %}
          {{ value_json.urls.full }}
        {% endif %}

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 110528

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>