I am trying to get a webhook to turn on and change the RGB color of a light entity.
Currently the automation is:
alias: 1 Test Bulb 1 Webhook
description: ""
trigger:
- platform: webhook
allowed_methods:
- POST
- PUT
local_only: false
webhook_id: "-webhook_id"
condition: []
action:
- service: light.turn_on
data:
rgb_color: "{{ value_json.data[rgb].val }}"
entity_id: light.test_bulb_1
mode: single
and the webhook is:
curl -X POST -H "Content-Type: application/json" -d '{"rgb":[255,0,0]}' http://homeassistant.local:8123/api/webhook/-webhook_id
Without the rgb_color: “{{ value_json.data[rgb_color].val }}” line it turns the light on when the webhook is sent in a terminal.
With that line in place, the light does not come on and the trace gives me this:
Executed: March 8, 2024 at 4:34:00 PM
this:
entity_id: automation.1_test_bulb_1_webhook
state: 'on'
attributes:
id: '1709930669830'
last_triggered: '2024-03-08T21:33:40.282485+00:00'
mode: single
current: 0
friendly_name: 1 Test Bulb 1 Webhook
last_changed: '2024-03-08T21:32:49.353065+00:00'
last_updated: '2024-03-08T21:33:40.288174+00:00'
context:
id: 01HRFZRV1SVM0GTT3B7GBWC62K
parent_id: null
user_id: null
trigger:
platform: webhook
webhook_id: '-webhook_id'
json:
rgb:
- 255
- 0
- 0
query:
__type: <class 'multidict._multidict.MultiDictProxy'>
repr: <MultiDictProxy()>
description: webhook
id: '0'
idx: '0'
alias: null
So the data is there, I just can’t get it to create the correct
rgb_color:
- 255
- 0
- 0
code in the automation when triggered. Any help?