Add service integration.reload

thanks, though still somewhat confused because I dont see a ‘network request line’, a column called ‘Name’ is displayed, in which a line ‘reload’ appears upon reloading…
clicking reload, makes the right field show General, Response headers, and Request headers. Under General, I can see the Request URL, under Response headers the content-type is shown, and under Request Headers the authorization is displayed.

Which makes it possible indeed to collect all necessary field for the rest_command:

rest_command:
  reload_ikea:
    url: https://mydomain.duckdns.org:port/api/config/config_entries/entry/3770284redacted51/reload
    method: POST
    headers:
      authorization: !secret api_bearer_token
      content-type: application/json

Also, the post by @Henk72 contains 1 significant typo, that caused my mishaps unto now :blush:

the [Config Entry] should be the data in the top line, ‘entry_id’ field in the config/.storage/core.config_entries and not the Identity field.

thanks!

update

to make it a bit more flexible, I use a template in the rest_command url (stored in secrets) and an input_select:

  select_integration:
    name: 'Select Integration:'
    options:
      - Gdacs
      - Ikea
      - Ipp
      - Life360
      - Luftdaten Rotterdam P
      - Luftdaten Rotterdam T
      - Luftdaten Tilburg P
      - Luftdaten Tilburg T
      - Owntracks
      - Philips Hue 1
      - Philips Hue 2
      - Plugwise
      - Plex
      - Synology Dsm
      - Weatherbit
    initial: Weatherbit

and:

script:
  reload_integration:
    alias: Reload integration
    mode: restart
    sequence:
      service: rest_command.reload_integration
      data:
        entry_id: >
          {% set mapper =
            {'Gdacs':'058redacted18a',
             'Ikea':'37redacted1951',
             'Ipp':'99redacted716',
             'Life360':'2aredactede7c',
             'Luftdaten Rotterdam P':'c6aredacted1',
             'Luftdaten Rotterdam T':'01redacted12e',
             'Luftdaten Tilburg P':'9redacted09c',
             'Luftdaten Tilburg T':'85redacted1bf8',
             'Owntracks':'6b2042redacted22a',
             'Philips Hue 1':'7afbredactedc5',
             'Philips Hue 2':'aredacted31e',
             'Plugwise':'474redacted412',
             'Plex':'dd13e18redacted4e05',
             'Synology Dsm':'fd8redacted367',
             'Weatherbit':'79aredacted5c'} %}
          {% set state = states('input_select.select_integration') %}
          {% set id = mapper[state] if state in mapper %}
          {{id}}

rest_command:
  reload_integration:
    url: !secret reload_integration_url #https://mydomain.duckdns.org:port/api/config/config_entries/entry/37redacted1951/reload
    method: POST
    headers:
      authorization: !secret api_bearer_token
      content-type: application/json
    payload: >
      {{entry_id}}

in secrets, have the url be:

reload_integration_url: https://mydomain.org:port/api/config/config_entries/entry/{{entry_id}}/reload

Lovelace:

    input_select.select_integration:
      templates:
        entity_picture: >
          var path = '/local/images/integrations/';
          return state.includes('Luftdaten')
                 ? path + 'luftdaten.png'
                 : state.includes('Philips') ? path + 'hue.png'
                 : path + state.toLowerCase() + '.png';

only thing is I dont see a confirmation box yet, so not sure if everything works :wink: no errors either :wink:

update
can confirm the above setup to work meanwhile, so for the time being this will do.

12 Likes