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

Data template help - processing arrays with variables

$
0
0

@atca wrote:

I have a logitech media player which takes JSON RPC api requests. Service call works fine from Hass.io service UI

entity_id: “media_player.sbhifi_touch”
command: “playlist”
parameters: [“play”,“iplayer://live?dash=dash://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/dash/uk/dash_full/ak/bbc_6music.mpd”]

With the player, playing the music successfully :slight_smile:

I am trying to convert this to an automation called by a webhook whereby the URL is passed in as a trigger.event.data.parameter

How can I create an automation template to make the following service request?

My current version which works for most commands is as follows. But the parameters array screws it up.

- id: 04727b5d6a074b6494859a35676ac4fc
  alias: IFTTT Squeezebox
  trigger:
  - platform: event
    event_type: ifttt_webhook_received
    event_data:
      action: 'call_service_squeezebox'
  action:
  - service_template: '{{ trigger.event.data.service }}'
    data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'
      command: '{{ trigger.event.data.command }}'
      parameters: '{{ trigger.event.data.parameters }}'

The above works for most my commands other than this playlist command. It seems to fall apart because parameters takes and array of “play” and the $URL.

How can I pass the array with one static item and one variable into the automation??

Thanks -

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 101645

Trending Articles



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