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

Update Picture Image URL From Template Updated From Rest Sensor

$
0
0

Hello! I have the following configuration:
This rest sensor gets a value from an API that will be used as the index value needed for an image URL:

sensor:
  - platform: rest
    name: "History Index"
    resource: "http://192.168.1.199:1888/v2/api/image-history?count=true"
    method: GET
    value_template: "{{ value_json.Response}}"
    scan_interval: 30

Thes template uses the rest sensor to construct an image URL used as the path to latest image with the dynamic image index added to path, obtained from the rest sensor:

template:
  - sensor:
      - name: "Latest Image"
        state: "http://192.168.1.199:1888/v2/api/image/thumbnail/{{ states('sensor.history_index') | int }}"

The result of the following in the Template tab of developer tools is:
{{ states("sensor.latest_image") | string }}

I am attempting to get this path into a picture card, unsuccessfully, using the states template syntax. It appears that is null once used within the card.
Anyone have experience with something similar?
Thanks in advance!

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105523

Trending Articles



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