home-assistant / iOS

:iphone: Home Assistant for Apple platforms
https://companion.home-assistant.io
Other
1.55k stars 302 forks source link

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

Open OGKevin opened 3 years ago

OGKevin commented 3 years ago

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

zacwest commented 3 years ago

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?

OGKevin commented 3 years ago

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 commented 3 years ago
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 commented 3 years ago

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 commented 3 years ago
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?

zacwest commented 3 years ago

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.

OGKevin commented 3 years ago

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 commented 3 years ago

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

jnwan commented 2 years ago

Have the same issue.

SerhiiAksiutin commented 2 years ago

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

wraith1385 commented 11 months ago

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.

SerhiiAksiutin commented 11 months ago

@wraith1385 was able to workaround it with the HA Helpers