Using Google Home with IFTTT to turn off my TV

Hi, I just got my Google Home 2 days ago and shortly found out about home assistant afterwards. I’ve been playing around with it and decided I wanted to create a voice command to shut off my smart TV. It’s an LG WebOS.

I’ve been able to remotely shut it off using the services part of Home Assistant, but whenever I use IFTTT it never works? I’m using the exact same parameters.

My IF statement is to use Google assistant and say “Turn my TV off” which THEN triggers the Maker applet.

In maker, my URL is http://REDACTED_IP:8123/api/services/media_player/turn_off?api_password=REDACTED

The method is POST
Content type is application/json
Body is {“entity_id” : “media_player.living_room_tv”}

I’m not sure what I’m doing wrong. Any help would be appreciated. Thanks!

Did you try other services on that media_player? like volumne_up or down? see if it works? Your logic looks fine unless there’s something very small that we couldn’t see :slight_smile:

I’d try it via any Rest Client like Postman to see if you can do it… if it works there, it should work on IFTTT. I had one that sent a notification to Google Home via HA Rest API like yours.

Do you have the ports forwarded on your router to the Home Assistant server? Maybe a dumb question but I’m hitting all bases starting at 1st.

edit: sorry I re-read the post and took note of the phrase “remotely shut it off”…

I agree, your logic looks ok. Sorry for the misinterpretation.

I just tried other media devices and nothing seems to be getting a response from IFTTT

I don’t think I’m familiar with Postman. What is it and how do I set it up?

It’s a Chrome Rest client app… which allow you to test Rest API

Totally misread that, thanks. I got a 503 server error for any kind of communication call with HA. I’m just going to uninstall and do a fresh start

Alright here’s the sequence of error messages that pop when I try to send it with Postman

INFO:homeassistant.components.http:Serving /api/services/media_player/turn_on to (auth: True) ERROR:aiohttp.server:Error handling request Traceback (most recent call last): File "C:\Users\Shane\AppData\Roaming\.homeassistant\deps\aiohttp\", line 417, in start resp = yield from self._request_handler(request) File "C:\Users\Shane\AppData\Roaming\.homeassistant\deps\aiohttp\", line 289, in _handle resp = yield from handler(request) File "C:\Users\Shane\AppData\Local\Programs\Python\Python36-32\lib\asyncio\", line 213, in coro res = yield from res File "C:\Users\Shane\AppData\Local\Programs\Python\Python36-32\lib\asyncio\", line 213, in coro res = yield from res File "C:\Users\Shane\AppData\Local\Programs\Python\Python36-32\lib\site-packages\homeassistant\components\http\", line 58, in ban_middleware_handler return (yield from handler(request)) File "C:\Users\Shane\AppData\Local\Programs\Python\Python36-32\lib\site-packages\homeassistant\components\http\", line 424, in handle result = yield from result File "C:\Users\Shane\AppData\Local\Programs\Python\Python36-32\lib\site-packages\homeassistant\components\", line 313, in post data = json.loads(body) if body else None File "C:\Users\Shane\AppData\Local\Programs\Python\Python36-32\lib\json\", line 354, in loads return _default_decoder.decode(s) File "C:\Users\Shane\AppData\Local\Programs\Python\Python36-32\lib\json\", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\Shane\AppData\Local\Programs\Python\Python36-32\lib\json\", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Problem with JSOn data? [quote=“Convour, post:8, topic:18310”]
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Here’s my quick test in Postman

Set the header:

Here’s the body that has the data:

Have you tried exposing your devices using the emulated hue component?

This is far simpler than having a request go out of your network to an external system, come back to your network, and then do something.