# Call-Service error. extra keys not allowed

**URL:** <https://discourse.nodered.org/t/call-service-error-extra-keys-not-allowed/79582>\
**Category:** General\
**Tags:** home-assistant\
**Created:** [4 July 2023 23:40 UTC](https://discourse.nodered.org/t/call-service-error-extra-keys-not-allowed/79582 "2023-07-04T23:40:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![SuperJonotron](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@SuperJonotron](https://discourse.nodered.org/u/SuperJonotron)\
**Post date:** [4 July 2023 23:40 UTC](https://discourse.nodered.org/t/call-service-error-extra-keys-not-allowed/79582/1 "2023-07-04T23:40:17Z")

</div>

I have been trying to figure out how to trigger a home assistant automation that takes in a variable. I can trigger an automation that just triggers with no extra data options but once I try to add a variable in the data section, I get the error:

> "Call-service error. extra keys not allowed @ data['url']"

I cannot figure out what is wrong with the message or how to get this to work

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/c/1c11ebfe138e2b22382ac462927ab246b6b92ca2.png)

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![michaelblight](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/michaelblight/32/445_2.png) [@michaelblight](https://discourse.nodered.org/u/michaelblight)\
**Post date:** [5 July 2023 06:01 UTC](https://discourse.nodered.org/t/call-service-error-extra-keys-not-allowed/79582/2 "2023-07-05T06:01:48Z")

</div>

Use "turn\_on" rather than "trigger" in the service call.

---

<div class="post-metadata">

**Author:** ![SuperJonotron](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@SuperJonotron](https://discourse.nodered.org/u/SuperJonotron)\
**Post date:** [5 July 2023 13:52 UTC](https://discourse.nodered.org/t/call-service-error-extra-keys-not-allowed/79582/3 "2023-07-05T13:52:58Z")

</div>

turn\_on has no effect, same error.

---

<div class="post-metadata">

**Author:** ![SuperJonotron](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@SuperJonotron](https://discourse.nodered.org/u/SuperJonotron)\
**Post date:** [5 July 2023 14:18 UTC](https://discourse.nodered.org/t/call-service-error-extra-keys-not-allowed/79582/4 "2023-07-05T14:18:18Z")

</div>

I'm not sure if this is a node-red or HA configuration issue so for completeness, here is the HA automation I am trying to pass in the url to for review:

```auto
alias: NodeRedPlayVideo
description: ""
trigger: []
condition: []
action:
  - service: androidtv.adb_command
    data_template:
      entity_id: media_player.android_tv
      command: >
        am start -a android.intent.action.VIEW -c
        android.intent.category.BROWSABLE -d "{{ url }}"
    alias: Play Video
mode: single

```

---

<div class="post-metadata">

**Author:** ![michaelblight](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/michaelblight/32/445_2.png) [@michaelblight](https://discourse.nodered.org/u/michaelblight)\
**Post date:** [6 July 2023 04:47 UTC](https://discourse.nodered.org/t/call-service-error-extra-keys-not-allowed/79582/5 "2023-07-06T04:47:01Z")

</div>

My bad - "automation.turn\_on" just enables an automation, I was getting confused with "script.turn\_on". Any reason why you're using an automation rather than a script? But yes, it should be "automation.trigger", but you pass the variables like this:

```auto
service: automation.trigger
data:
  variables:
    new_value: 13
target:
  entity_id: automation.bump

```

Where my "bump" automation is defined like this:

```auto
alias: Bump
description: ""
trigger: []
condition: []
action:
  - service: input_number.set_value
    data:
      value: "{{ new_value }}"
    target:
      entity_id: input_number.mb_test_number_1
mode: single

```

---

<div class="post-metadata">

**Author:** ![SuperJonotron](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@SuperJonotron](https://discourse.nodered.org/u/SuperJonotron)\
**Post date:** [6 July 2023 23:40 UTC](https://discourse.nodered.org/t/call-service-error-extra-keys-not-allowed/79582/6 "2023-07-06T23:40:27Z")

</div>

I'm not using scripts for any reason other than i'm very new to HA and trying to pick through all the documentation and yaml is not easy to figure out.

I'm trying to understand what you're even doing with these and I can't seem to figure out what is happening or where one even would put these scripts and how to call them form node-red.

Are you showing two versions of the same solution? Are these interlinked somehow? I can't seem to see any way these two are associated with the variables so i'm definitely missing something in the core of this process.

---

<div class="post-metadata">

**Author:** ![SuperJonotron](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@SuperJonotron](https://discourse.nodered.org/u/SuperJonotron)\
**Post date:** [7 July 2023 00:37 UTC](https://discourse.nodered.org/t/call-service-error-extra-keys-not-allowed/79582/7 "2023-07-07T00:37:06Z")

</div>

After a lot of trial and error, I think I finally figured out what was wrong. I at least got node-red to be able to send calls with variables. I did use your example as my starting point so thanks for getting me pointed in the right direction.

At the end of the day, the entire problem stemmed from just having to encode the variables in json from node-red like this:

> {  
> "variables": {  
> "new\_value": "13"  
> }  
> }

I didn't get that from any docs or other forum post, just randomly tried it after I got it working in HA first so I knew that the rest was something wrong on node-red.

---

<div class="post-metadata">

**Author:** ![michaelblight](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/michaelblight/32/445_2.png) [@michaelblight](https://discourse.nodered.org/u/michaelblight)\
**Post date:** [7 July 2023 03:20 UTC](https://discourse.nodered.org/t/call-service-error-extra-keys-not-allowed/79582/8 "2023-07-07T03:20:28Z")

</div>

You'd probably be better off asking HA-related questions on the [HA forum](https://community.home-assistant.io/), even if using Node Red. Automations in HA are normally for when you want something to happen automatically (eg. reacting to switching on a light), whereas scripts are for when the want to run things 'manually'. Having said that, if you're using NR, you would not generally need to use HA automations or scripts, as it can be done in NR. I use NR with HA and have no active HA automations or scripts - it's all in NR. There are some things that are more straightforward to code in an HA automation, but I prefer to have everything in one place.

---

<div class="post-metadata">

**Author:** ![SuperJonotron](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@SuperJonotron](https://discourse.nodered.org/u/SuperJonotron)\
**Post date:** [7 July 2023 03:24 UTC](https://discourse.nodered.org/t/call-service-error-extra-keys-not-allowed/79582/9 "2023-07-07T03:24:30Z")

</div>

I agree but in this case, my original HA automation actually was fine and the whole problem I was experiencing was with the NR json format in the call service block. Not a syntax I could find documented anywhere so this did appear to be the right place for it.

Maybe I'll eventually find a way to get the same functionality out of NR for ADB commands but for now, it seemed simpler just to move my complex logic out of HA and let NR just send my final result to HA to deal with the ADB side.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 July 2023 03:25 UTC](https://discourse.nodered.org/t/call-service-error-extra-keys-not-allowed/79582/10 "2023-07-21T03:25:12Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
