iOS icon indicating copy to clipboard operation
iOS copied to clipboard

Calling the service to restart/reboot via shortcuts leads to timeout error, despite success.

Open OGKevin opened this issue 4 years ago • 12 comments

iOS device model, version and app version

Model Name: Iphone 11 pro Software Version: 14.0 App version: 2020.6.2 (1)

Home Assistant Core Version

0.116.2

Describe the bug When using the shortcuts app to call the service to either restart or reboot (the host of) homeassitant, the response leads to an error saying that the the app could not parse the response. Most likely due to the response taking too long.

Can this be fixed on the iOS side, by either assuming that long response time is considered ok for these 2 operations? Or does Home Assistent need to be tweaked to send faster response for these operations?

When calling the api directly

➜  ~ http 192.168.1.63:8123/api/services/homeassistant/restart Authorization:"Bearer ${HASSIO_TOKEN}"
HTTP/1.1 200 OK
Content-Encoding: deflate
Content-Length: 961
Content-Type: application/json
Date: Sun, 18 Oct 2020 13:09:58 GMT
Server: Python/3.8 aiohttp/3.6.2

It takes a while but there is an actual response. To Reproduce Create a shortcut like the following: IMG_448DEF7D7446-1 and execute it. Home assistant actually gets restarted/rebooted but the shortcut will always report error.

Expected behavior The execution results in a success.

Screenshots

IMG_BFFC6234B99E-1

Additional context

OGKevin avatar Oct 18 '20 13:10 OGKevin

I'm unable to reproduce this. When I call homeassistant.restart it returns immediately and then restarts:

2020-10-20 20:03:04.764121-0700 Extensions-Intents[53438:5387298] [Verbose] [com.apple.siri.extension] [CallService.swift:127] handle(intent:completion:) > Handling call service shortcut homeassistant, restart
…
2020-10-20 20:03:05.112073-0700 Extensions-Intents[53438:5386993] [Verbose] [main] [CallService.swift:130] handle(intent:completion:) > Successfully called service during shortcut

This is against 0.117 dev, so it's possible there's been a change there, but I wouldn't expect that to be the case. Can you tell me what installation method you're using for HA?

zacwest avatar Oct 21 '20 03:10 zacwest

Can you tell me what installation method you're using for HA?

I have it installed via docker on ubuntu

arch aarch64
chassis  
dev false
docker true
docker_version 19.03.12
hassio true
host_os Ubuntu 18.04.5 LTS
installation_type Home Assistant Supervised
os_name Linux
os_version 4.4.154-111-rockchip-g39b306a41b2d
python_version 3.8.5
supervisor 247
timezone Europe/Amsterdam
version 0.116.4
virtualenv false

OGKevin avatar Oct 21 '20 08:10 OGKevin

http post 192.168.1.63:8123/api/services/homeassistant/restart   0.24s user 0.06s system 2% cpu 10.353 total

there are times it takes a little bit longer tho.

OGKevin avatar Oct 21 '20 08:10 OGKevin

So what are the next steps here? Do I just need to accept the fact that my instance is slow and that is the problem?

OGKevin avatar Oct 29 '20 12:10 OGKevin

2020-10-30 11:23:11 ERROR (MainThread) [homeassistant.components.hassio.handler] Timeout on /homeassistant/restart request

Could be that my instance is just slow. How shall we proceed from here?

OGKevin avatar Oct 30 '20 10:10 OGKevin

Interesting, that timeout does look like it's being logged not in the app, right? I wonder if this is a difference in installation method. When the app talks directly to core it hears back right away, but this method is not working that way. You may need to talk to hassio/core authors to learn more about the difference in behavior here.

zacwest avatar Oct 30 '20 22:10 zacwest

Shall this issue be moved to https://github.com/home-assistant/core? Do you have the powers to move it? Or do I need to create a new one?

OGKevin avatar Oct 31 '20 00:10 OGKevin

Just to mention, the timeout is not always logged in hassio. Sometimes its just slow and it executes the reboot/restart.

OGKevin avatar Nov 04 '20 08:11 OGKevin

Have the same issue.

jnwan avatar Feb 14 '22 19:02 jnwan

Having the same issue for Home Assistant shortcuts running every BMW Connect action.

SerhiiAksiutin avatar Aug 04 '22 06:08 SerhiiAksiutin

Has there been any update on this issue. I have it when calling Scripts from a Shortcut. The Scripts complete correctly but error out in the Shortcut.

wraith1385 avatar Oct 25 '23 20:10 wraith1385

@wraith1385 was able to workaround it with the HA Helpers

SerhiiAksiutin avatar Oct 25 '23 21:10 SerhiiAksiutin