Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to launch any service since last Home Assistant update #276

Open
bchevreau opened this issue May 21, 2024 · 26 comments
Open

Unable to launch any service since last Home Assistant update #276

bchevreau opened this issue May 21, 2024 · 26 comments

Comments

@bchevreau
Copy link

It appears all my buttons have stopped working. The app seems connected (it finds all my entities) but none of the services are fired: light toggles and so on simply don't do anything and display the exclamation point error /!\ when pressed.

I will gladly provide logs and such if you indicate me how I can do so.

@roscocheeta
Copy link

Potentially try closing the Stream Deck software and restarting it as a temporary workaround.

I've osberved a similar issue, that after a period of time (random) or after an HA update, the Stream Deck button(s) will stop working (similar to what @bchevreau explained above).

Even when I hit reconnect on the plugin configuration the result doesn't change. I have to restart entire Stream Deck app to get things working again.

@roscocheeta
Copy link

I would also add, that I can't see a specific log file output for this particular plugin, so can't troubleshoot further. Be nice to include that in the future (as time permits).

@bchevreau
Copy link
Author

have to restart entire Stream Deck app to get things working again.

Thanks a lot for this, I didn't even think of just hard stopping Stream Deck ! Well it's not ideal but it definitely works, so at least I have a workaround.

I do agree that logs would be a great addition to ensure we can debug and give you some clear feedback!

@miquellaboria
Copy link

I have a new Steam Deck and services are not fired.

I try to restart computer, and unplug stream deck but actions not working…

How can I restart entire App? How can I do?

Thanks!

@bchevreau
Copy link
Author

I feel like the situation worsened a LOT in the past few weeks following 2023.5 updates. I know some changes were made to the way calls are made, and integrations needed to make async calls now, a lot of integrations were not working because of this. Could that be related @cgiesche ?

I have to shut down and restart streamdeck almost every hour now to be able to use it... which makes it kinda unusable if I'm being honest. Any way we can help or test for you?

@bchevreau
Copy link
Author

I have a new Steam Deck and services are not fired.

I try to restart computer, and unplug stream deck but actions not working…

How can I restart entire App? How can I do?

Thanks!

You need to go to system tray then right-click > quit there as shown below:

image

@cgiesche
Copy link
Owner

cgiesche commented May 29, 2024

The communication between my plugin and home assistant is using a web socket connection and home asaistants web socket api which is already asynchronous.

I will update my home assistant and my Streamdeck today and check if something breaks. "Unfortunately" I have no problems with the connection at all.

Are some of you using a WiFi connection? Maybe networking hickups cause the websocket connection to break (which then should automatically be reestabliahed, but does not seem to happen if I understand correctly). When I remove my lan cable, the connection gets lost but is reesablished as soon as I plug it in again...

@cgiesche
Copy link
Owner

I would also add, that I can't see a specific log file output for this particular plugin, so can't troubleshoot further. Be nice to include that in the future (as time permits).

My plugin is kind of "locked in" by the elgato stream deck application (which is good for security reasons) so that logging is not as straight forward as it would be in under normal conditions. However, there seems to be an elgato-way-of-logging which i will try to add in a future release.

@stephanedupont
Copy link

Same here, almost each time I wake the computer from sleep, the connection is lost and I have the default grey HA icon instead of properly displayed entities. I have to manually exit the app and relaunch it in order for the plugin to work.

@roscocheeta
Copy link

The communication between my plugin and home assistant is using a web socket connection and home asaistants web socket api which is already asynchronous.

I will update my home assistant and my Streamdeck today and check if something breaks. "Unfortunately" I have no problems with the connection at all.

Are some of you using a WiFi connection? Maybe networking hickups cause the websocket connection to break (which then should automatically be reestabliahed, but does not seem to happen if I understand correctly). When I remove my lan cable, the connection gets lost but is reesablished as soon as I plug it in again...

Hi @cgiesche firstly, thanks again for writing this plugin. Appreciate the response.

A couple of additional pieces of info based on what you responded with,

  • Yes, my desktop PC which is running Stream Deck software is on wifi.
  • I have observed this issue occurs when I come out of hybernation/sleep (but not limited to just that, and not always occurs)
  • I have a 3rd party monitoring tool setup to check the Web Socket is responding and that's been up with no issues. So I suspect its not on the Home Assistant side. Will setup something from my desktop PC to monitor if the web socket is responding and see what I find out.

@roscocheeta
Copy link

Same here, almost each time I wake the computer from sleep, the connection is lost and I have the default grey HA icon instead of properly displayed entities. I have to manually exit the app and relaunch it in order for the plugin to work.

Assuming when you go to the plugin settings and click the "Reconnect" button that it doesn't help? This is what I observe, so not sure how to diagnose / troubleshoot what the Reconnect button is or is not doing.

@bchevreau
Copy link
Author

This is what I experience as well. Note that I am on Ethernet myself, so wifi is likely not the issue. And same as you @roscocheeta pressing the reconnecting button doesn't have any effect, only hard quit and restart do.

Most instances when it happen are: waking up from sleep/hibernation, any restart / config restart from HASS.

@stephanedupont
Copy link

@roscocheeta : yes, same, "Reconnect" button doesn't help.

Also on Ethernet.

@cedi
Copy link

cedi commented Jun 3, 2024

+1 on the issue.

My StreamDeck is able to show the states with no problem:
image
image

But if I configure Keypad Actions, the scene does not trigger:
image

Restarting my the StreamDeck software didn't help, reconnect doesn't help, rebooting doesn't help.

If I check the HomeAssistant Logs I find this:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/connection.py:307
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 4:00:44 PM (5 occurrences)
Last logged: 4:00:45 PM

[547475187392] Error handling message: Unauthorized (unauthorized) Cedi from fe80::967a:a3b5:3a31:37c1 (Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/6.6.2 Chrome/112.0.5615.213 Safari/537.36)

I re-created my long-lived access token just to verify. It seems to me (at first glance) like something is broken in the authentication flow. Almost as if the access-token isn't passed to home-assistant correctly when trying to call a service.

@cgiesche
Copy link
Owner

cgiesche commented Jun 3, 2024

I re-created my long-lived access token just to verify. It seems to me (at first glance) like something is broken in the authentication flow. Almost as if the access-token isn't passed to home-assistant correctly when trying to call a service.

There is only a single websocket connection opened to homeassistant (shared across all buttons that use the plugin): The states are updated via this connection and the service calls are performed via the same connection. So if your states are updated, service calls should work, too.

To be able to view logs, you can enable debugging for your stream-deck application:
https://docs.elgato.com/sdk/plugins/getting-started#id-5.-debugging

After that, you can see the plugin instance (and the settings as an individual entry):
image

Once you select the plugin, you can see my log entries (i think every important event is logged, so hopefully you can find out what is going on).

If you select the PI, you can see the debug logging for the settings (maybe interesting for those, whose settings do not save). The PI option only appears after you selected one of the buttons in the app.

@cedi
Copy link

cedi commented Jun 3, 2024

Thanks for the link on how to enable debugging.

This is the logs I could grab for you:

Unhandled Event: deviceDidConnect
nunjucks-b4b04137.js:17 Parsing version 4 settings: {"button":{"serviceLongPress":{"entityId":"","serviceData":"","serviceId":""},"serviceRotation":{"entityId":"","serviceData":"","serviceId":""},"serviceShortPress":{"entityId":"scene.office_maximum_chill","serviceData":"","serviceId":"scene.turn_on"},"serviceTap":{"entityId":"","serviceData":"","serviceId":""}},"controllerType":"Keypad","display":{"buttonTitle":"{{friendly_name}}","domain":"sensor","enableServiceIndicator":true,"entityId":"sensor.buro_sensor_airmonitor_vocs","useStateImagesForOnOffStates":false},"rotationTickBucketSizeMs":300,"rotationTickMultiplier":1,"version":4}
nunjucks-b4b04137.js:17 Unhandled Event: titleParametersDidChange
nunjucks-b4b04137.js:17 Parsing version 4 settings: {"button":{"serviceLongPress":{"entityId":"scene.meeting","serviceData":"","serviceId":"scene.turn_on"},"serviceRotation":{"entityId":"","serviceData":"","serviceId":""},"serviceShortPress":{"entityId":"scene.meeting","serviceData":"","serviceId":"scene.turn_on"},"serviceTap":{"entityId":"","serviceData":"","serviceId":""}},"controllerType":"Keypad","display":{"buttonTitle":"{{friendly_name}}","domain":"scene","enableServiceIndicator":true,"entityId":"scene.meeting","hideIcon":false,"useCustomButtonLabels":false,"useStateImagesForOnOffStates":false},"rotationTickBucketSizeMs":300,"rotationTickMultiplier":1,"version":4}
nunjucks-b4b04137.js:17 Unhandled Event: titleParametersDidChange
plugin-780664f7.js:9 Got global settings.
plugin-780664f7.js:9 Connecting to Home Assistant
plugin-780664f7.js:9 Connecting to Home Assistant ws://hass.local:8123/api/websocket
nunjucks-b4b04137.js:17 Sending HomeAssistant command:
 {
  "id": 2,
  "type": "get_states"
}
nunjucks-b4b04137.js:17 Sending HomeAssistant command:
 {
  "id": 3,
  "type": "subscribe_events",
  "event_type": "state_changed"
}
nunjucks-b4b04137.js:17 Sending HomeAssistant command:
 {
  "id": 4,
  "type": "execute_script",
  "sequence": [
    {
      "target": {
        "entity_id": [
          "scene.office_maximum_chill"
        ]
      },
      "service": "scene.turn_on",
      "data": {}
    }
  ]
}
nunjucks-b4b04137.js:17 Uncaught Unauthorized
handleMessage @ nunjucks-b4b04137.js:17
Bl.websocket.onmessage @ nunjucks-b4b04137.js:17

@cgiesche
Copy link
Owner

cgiesche commented Jun 3, 2024

nunjucks-b4b04137.js:17 Uncaught Unauthorized

Ah. This may be caused by the fact, that services are invoked "indirectly" via home-assistant's execute_script-service. Because this service allows to do almost everything in home-assistant, they decided to only allow users with admin rights to call this service.
Due to that, the token that you enter in the plugin must be a token of a user with admin rights. (I dont like that, but i can not change this currently without losing features that many rely on.)

@cedi
Copy link

cedi commented Jun 3, 2024

Oh my god. Okay. That's crazy. Thank you so much for the quick help!

@bberg115
Copy link

bberg115 commented Jun 7, 2024

token that you enter in the plugin must be a token of a user with admin rights. (I dont like that, but i can not change this currently without losing features that many rely on.)

I am having the same issues, but my token is already for an admin (owner) user.

I also agree it appears to be an issue when I return to the PC after it goes to sleep OR it's the time since boot?

I have enabled logs and will keep the screen open to see if I can find anything when the issue returns.

Edit: i also had this issue a couple weeks ago and it appeared to be fixed when I updated HA and pulled a new token.... I am now 2-3 released behind... but I don't think that's the root cause

@fti7
Copy link

fti7 commented Jun 12, 2024

Same issue here. Happens after pc hibernation.
Streamdeck restart fixes the issue

@braca
Copy link

braca commented Jun 14, 2024

I have the same issue, usually it happens after waking the PC from sleep..
I can't find any error, and reconnecting the addon doesn't work, the only way is to restart streamdeck

@bberg115
Copy link

All I did was update HA to latest and have been good for a week. I still plan on following up when (if?) the issue reappears.

@stephanedupont
Copy link

Updating HA will not fix this. I always update HA to the latest version when available and the problem is still here.

@roscocheeta
Copy link

Just an update from me, I setup a powershell script on my windows PC that run's every 5 mins that opens the websocket on HA, authenticates, and then closes it.

Initial goal was just to monitor (and record in logs) that the connection was stable/working as expected and compare that with this Stream deck plugin's behavior.

However, since enabling this, I've had no reoccurrences of the original reported issue. I've updated HA docker multiple times, my windows PC has come in and out of sleep multiple times.

I am not sure exactly why this PS script is helping, or if its just coincidental.

@KayOhtie
Copy link

Adding in on encountering this, on wake from sleep this time. I've enabled debug logging so I can try to see what the heck it's doing and why the 'reconnect' button doesn't seem to do anything even though it 'flashes' the editor view as if it is.

@lfnovo
Copy link

lfnovo commented Aug 24, 2024

Same issue as @Ceralor .. I have latest version of Mac OS, StreamDeck and Home Assistant. Restarted StreamDeck. It recognizes the events and states, but doesn't run any service/action at all. I have enabled logging and now I see the issue.

nunjucks-b4b04137.js:17 Uncaught must contain at least one of entity_id, device_id, area_id, floor_id, label_id.. Got {'id': 28, 'type': 'execute_script', 'sequence': [{'data': {}, 'action': 'light.toggle'}]}
handleMessage @ nunjucks-b4b04137.js:17
Bl.websocket.onmessage @ nunjucks-b4b04137.js:17
nunjucks-b4b04137.js:17 Sending HomeAssistant command:
{
"id": 29,
"type": "execute_script",
"sequence": [
{
"service": "light.toggle",
"data": {}
}
]
}

According to the documentation, the plugin was supposed to pass the entity_id to HomeAssistant if empty was left null. But that's not happening. Adding the entity_id manually to data fixed the issue.

It's not convenient, but at least it's working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests