Mapping values are not allowed here

I’m getting this error:
17-02-07 18:29:51 ERROR (Thread-1)

[homeassistant.util.yaml] mapping values are not allowed here
in "/home/homeassistant/.homeassistant/alexa.yaml", line 83, column 18

Line 83 is service: media_player.volume_set.

SetVolumeIntent:
  action:
    service: media_player.volume_set
      entity_id: media_player.yamaha_receiver
      volume_level: >-
        {%- if Level|int in range(10,81) -%}
          {%- set n = Level|float -%}
          {{ (1.0-( n / 100.0 )) | round(0.00) }}
        {%- endif -%}
  speech:
    type: plaintext
    text: OK

I pasted the code into http://www.yamllint.com/ and got the same unhelpful error. What could be wrong?

Try this:

SetVolumeIntent: 
  action: 
    entity_id: media_player.yamaha_receiver
    service: media_player.volume_set
    volume_level: |-
        {%- if Level|int in range(10,81) -%}
          {%- set n = Level|float -%}
          {{ (1.0-( n / 100.0 )) | round(0.00) }}
        {%- endif -%}
  speech: 
    text: OK
    type: plaintext

Hmm, that shifted the error down. It appears that this line:

service: media_player.volume_set

is causing the problem.

Is it the same error though? It validated ok.

bah, missing a line:

SetVolumeIntent:
  action:
    service: media_player.volume_set
    data_template: <-----------------------------------MISSING
      entity_id: media_player.yamaha_receiver
      volume_level: >-
        {%- if Level|int in range(10,81) -%}
          {%- set n = Level|float -%}
          {{ (1.0-( n / 100.0 )) | round(0.00) }}
        {%- endif -%}
  speech:
    type: plaintext
    text: OK

I was wondering about that. I saw the volume level and it looked like a data template to me but I haven’t really access the media players programmatically so I thought maybe it was something I hadn’t learned yet.

I’m always afraid to open my mouth and look foolish but in this case it would have helped. LOL

Yeah, i’m learning this. I’m not really sure what is a yaml requirement and what is a HA requirement. I usually see code and attempt to replicate it. I probably should sit down and actually learn yaml. I usually learn by doing though.

That’s how I’ve been doing it. Also when it comes to templates, this is a big help:

http://jinja.pocoo.org/docs/2.9/templates/