Using Call Service Node to set the volume of a TV

I’m bashing my head against the wall simply trying to set the volume of my TV. Everything otherwise is working great. Using the Call Service Node, with Doman: media_player, Service: volume_set with my entity. I seem to be screwing up the Data field. Can’t figure it out. I’ve tried a hundred different ways, but always get an API error on that node. I can’t find any specific documentation on the “volume_set” service.

With the Data field above, I get an error:

image

Ideally, instead of passing 0.25 like I am here, I want to pass the value I have in the incoming msg.payload field. I tried using {{payload}} like I found somewhere else, but that didn’t work either.

What the heck am I doing wrong?!

Do you have a payload coming into the call-service node that has msg.payload.data set to an empty object?

Hey, thanks. I’m pretty sure my payload data is valid. But to take that out of the equation, I’ve tried (as seen in my screenshot) to hard-code the value. I used the 0.25 with and without quotes. Can’t even get that to work. I know it’s something simple. Maybe has something to do with using the volume_set service, but not passing the right data…got me!?

Put the debug before the call service node and lets se what the message looks like

Again, I’m not currently even using the message input. I have just hard-coded a value.

edit: Figured it out! It was a simple thing…see the original screenshot above and now see this one.

I had the “J: expression” selected for the Data instead of the “{} JSON” type. That was all. Once I figured that out through a whole bunch of trial and error, that was it. I just couldn’t understand why I was getting a call service error about not providing the ‘volume_level’ key, even though I was. I was just using the wrong syntax.

Now with that fixed, I replaced my hard-coded value with “{{payload}}” and that also works great now.

This all now results in a Nod-Red flow that when my noisy furnace kicks on, the TV volume will increase by 3 clicks. When the furnace turns off, the volume will decrease by 3 clicks. Working great now.

Thanks for the help!