Skip to content

Instantly share code, notes, and snippets.

@danielkec
Last active October 17, 2022 00:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielkec/ed81587f224763e23c296568f06dedb6 to your computer and use it in GitHub Desktop.
Save danielkec/ed81587f224763e23c296568f06dedb6 to your computer and use it in GitHub Desktop.
Homeassistant rest_command example

RESTful Command

https://www.home-assistant.io/integrations/rest_command/

configuration.yaml -- bez placeholderu

rest_command:
  hellstorm_stream_request:
    url: http://192.168.10.148/api/v1/replaceAndPlay 
    method: POST
    headers:
      accept: "application/json"
    content_type:  'application/json; charset=utf-8'      
    payload: '{"service": "webradio", "type": "webradio", "title": "Hellstormovo bezva radio!", "uri": "http://opml.radiotime.com/Tune.ashx?id=s14991"}'

configuration.yaml -- s placeholderem

rest_command:
  hellstorm_stream_request:
    url: http://192.168.10.148/api/v1/replaceAndPlay 
    method: POST
    headers:
      accept: "application/json"
    content_type:  'application/json; charset=utf-8'      
    payload: '{"service": "webradio", "type": "webradio", "title": "{{ STREAM_TITLE }}", "uri": "{{ STREAM_URL }}"}'

scripts.yaml

turn_on_hellstorm_radio:
  alias: 'Prehrat Helstormovo radio'
  sequence:
  - service: hellstorm_stream_request
    data:
      STREAM_TITLE: 'Hellstormovo bezva radio!'
      STREAM_URL: 'http://opml.radiotime.com/Tune.ashx?id=s14991'
  mode: single
  icon: hass:baby-carriage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment