I set scan_interval to zero and it seems to do the trick? Am I breaking something?
sensor:
- platform: command_line
command: 'curl -X POST -d "{\"Username\": \"xxxx\", \"Password\" : \"xxxxxxxxxxxxxx\" }" http://192.168.x.xxx:9000/api/auth'
name: "PortainerToken"
scan_interval: 0
value_template: "{{value[8:184]}}" #remove first 8 characters and keep the next 176
rest_command:
plextraktsync:
url: http://192.168.x.xxx:9000/api/endpoints/1/docker/containers/xxxxxxxxxxxxxxxxxxxxx/start
method: POST
headers:
Authorization: "{{states('sensor.portainertoken')}}"
# scan_plex_tv_shows:
# url: "http://192.168.x.xxx:xxxxxxx/library/sections/1/refresh?X-Plex-Token=xxxxxxxxx"
The output of the command_line is an auth token, which stored as a sensor, which used in a rest_command.
I then use an automation to manually reload it and run the rest_command
alias: Sync Plex & Trakt
description: ''
trigger:
- platform: time
at: '06:00'
condition: []
action:
- service: command_line.reload
data: {}
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: rest_command.plextraktsync
data: {}
mode: single