Plugin failing to communicate
Closed this issue ยท 30 comments
Hello,
I have installed the plugin for home-assistant, input the url of the instance, and input the long-lived access token. But am unable to control my devices with it.
The devices in my home show up, so I know that the connection is active and working, and when I switch devices on/off in the home-assistant web app, the status on the stream deck changes, so I can see when devices are on or off with it.
Screenshots are below of what my settings are, is this something that you know how to fix?
For addition, I cannot see any requests for this in the homeassistant logs, and there are also no debug methods that I can find for the streamdeck plugin.
Normally, between Service and Service data, there should be a third drop-down where you can select the entity you want to turn on.
If it is not visible, this normally means, that there isn't any light entity that supports the turn-on service. Maybe you have to use the "switch" domain instead of "light"?
I see, I can confirm that none of the domains allow me to choose an entity for this. I will have a play around in HomeAssistant to see if anything needs to be changed there, if you have any ideas, please let me know. ๐
I have wathced other videos on how to do this and they do not have what you are saying, but do have the below, which is a screenshot from my machine so to confirm that I can see this and have set this correctly.
Also, to rule out any other affecting factors, I have re installed Home Assistant to try and get this working so this is the only entity linked to it.
If you got to Developer > Services in HA and use the light.turn on service. Does your entity show up and respond?
Yes I have just done this and it turned the light.turn_on service worked and vice versa
@kBraDrs I had this happen to me as well. Are you on 2.4.2? Try rolling back to 2.4.1 and disabling auto updates. I had the same issue as you it sounds like: #193 (comment)
@kBraDrs I had this happen to me as well. Are you on 2.4.2? Try rolling back to 2.4.1 and disabling auto updates. I had the same issue as you it sounds like: #193 (comment)
That was it! It's working perfectly. I have quite a complex networking system at home and spent all of yesterday tracking down whether my network was blocking internal websocket requests ๐ Glad to find out it was this simple all along.
Thank you @joestump, you have made my morning ๐
@cgiesche Any idea why the newer version is not working correctly?
Oh ****.
It's my friend Jesus birthday today and I am far away from my computer for some time.
I have no idea what is going on but I will try to get the store version rolled back to the last working version. This may take some time...
As a workaround, you need to install the "latest" release (2.4.1) manually and disable auto update from store.
Sorry for that poisoned Christmas gift :D
@kBraDrs I have a similarly complex network with multiple VLANs and was worried that was an issue, but all of the devices were on the same VLAN. Interesting that there's overlap in our setup; wonder if there's something (bad network dependency update?) in 2.4.2 causing issues with VLAN tagging?
I am not at home, so I can not really check what it is, but it seems to be a general bug and not related to your network setups.
Not sure if others are dealing with this, but even with "Automatically update" unchecked the plugin is auto-updating nightly, which breaks things all over again. Presumably the Stream Deck software itself has a bug that ignores disabled auto-updates. ๐ข
Is it possible to pull the 2.4.2 release?
Hello everyone.
I just got home and immediately tried to reproduce the issue. I completely uninstalled the plugin and installed the current version (2.4.2) from the Elgato Store. "Unfortunately," everything seems to be working as expected on my end:
Does this issue occur with existing buttons (those that existed before the update) or with newly configured ones as well?
I started an entirely new profile with new buttons and nothing worked. It also persisted across two computers as new profiles with new buttons failed to address the issue. Both macOS and Windows 11.
I believe I am experiencing this issue as well.
I just installed today (1 January 2024). I originally installed from the Elgato Marketplace and received version 2.4.2. After I was unable to get that to function, I did some googling, and stumbled across this. Downgrading to the 2.4.1 build from github did not alleviate my issue though.
The biggest difference I can think of between my config and others is that I am using the remote domain.
I have also tried uninstalling and purging everything I could find from the Stream Deck software and reinstalled, only using the 2.4.1 build, but I am seeing the same behavior.
I believe I am experiencing this issue as well. I just installed today (1 January 2024). I originally installed from the Elgato Marketplace and received version 2.4.2. After I was unable to get that to function, I did some googling, and stumbled across this. Downgrading to the 2.4.1 build from github did not alleviate my issue though. The biggest difference I can think of between my config and others is that I am using the remote domain. I have also tried uninstalling and purging everything I could find from the Stream Deck software and reinstalled, only using the 2.4.1 build, but I am seeing the same behavior.
So, after being stumped by this yesterday, suddenly, today it has the Entity... I am confused, but it works for me now on 2.4.1.
It may have something to do with the version of Home Assistant I had been running? Due to a stuck firmware update for one of my Inovelli dimmers, I had to force the docker containers I'm using to update, by deleting the old ones and downloading the latest. This is the only change I can think of, beyond time, that may have impacted things.
Wanted to share I am seeing the same issue on a new install on 2.4.2 from the Marketplace. The status on the icon appears to be syncing correctly (e.g. when I turn the light on/off the change shows on the button). But I can't get the short press or long press to work and both are missing the "Entity" dropdown after I select the Domain and Service dropdowns although the "Service Data JSON (optional) section appears.
Glad to do any troubleshooting for you if helpful.
I'm slowly going crazy:
- I uninstalled the Stream Deck application on my main PC and deleted all directories (caches, settings, plugins), then reinstalled it completely: The plugin works.
- I installed Stream Deck from scratch on my notebook: The plugin works.
- I've tried it on both using both the XXL and SD+.
- I've tried both admin and regular user tokens from Home Assistant.
I don't understand it.
Maybe someone who is experiencing the issue (on Windows) can check if there is an error in the debug console. Here's how to do it:
- In the Registry, navigate to
HKEY_CURRENT_USER\Software\Elgato Systems GmbH\StreamDeck
and set the keyhtml_remote_debugging_enabled
to the value1
(DWORD).
- Restart the Stream Deck application.
- Go to a button configuration with the Home Assistant plugin on the Stream Deck (stay on this page!).
- In your web browser, navigate to the page http://localhost:23654/.
- Click on "HomeAssistant Plugin PI" (important: PI).
- Switch to the "Console" view and then try to configure an action on the Stream Deck (do not leave the "button" page).
Ideally, you should see an error in the console if there is an issue.
Also not sure if this matters but I'm running on Windows 10
Here is the screenshot I have after following those steps:
Thank you! Nothing unusual to see there :/
Also not sure if this matters but I'm running on Windows 10
In this case, it does not matter. My personal verdict is, that there must be at least one "special" entity in your home-assistant, that somehow causes the problem.
Maybe, you or someone else with this issue can make this request and share the response with me:
https://reqbin.com/c-2qwz2ahd
DISCLAIMER The respone contains the names, ids and current state of ALL our home assistant entities. If you do not want to share this data with the public, please attach the output to a mail and send it to me (christoph.giesche_github@cgidev.de). I will only use it to find out, if one of the enties is causing the problem and then delete this data.
- Replace "TOKEN" with a fresh token from Home-Assistant (delete it afterwards).
- Replace the first part of the URL with your Home-Assistant hostname and port
- Click "Run"
After your request succeeded, it should look like this:
Thanks. I will take a look at this later tonight and email you the output.
Note that the first time I select the entity box under keypad appearance, it appears to work correctly; i.e. I select "light" from the dropdown under Domain and then all of the lights are populated correctly under the Entity dropdown list.
Any updates on this? I am experiencing the same issue.
Plugin connects, displays the correct status label, but doesn't show an option for picking the entity in the keypad actions.
Interestingly, the plugin doesn't even seem to make requests for services where the entity is specified in the service data. Case in point, the following works perfectly in HA:
But what I believe is the same config doesn't work in the plugin:
Environment
OS: MacOS 14.2.1
Stream Deck: 6.4.1 (19697)
Home Assistant Plugin: 2.4.2 (from Marketplace)
I'm happy to help out anyway I can with sending diagnostics but am unsure how to do so on Mac.
Interestingly, the plugin doesn't even seem to make requests for services where the entity is specified in the service data. Case in point, the following works perfectly in HA
Everything points to the problem being one or more entities that somehow break my code. Yesterday I installed my PC from scratch, did not use any backups and the plugin is working perfectly fine.
You can help like described above:
#227 (comment)
With this data, I could import your entities in my local plugin (of course, i can not control them or view live data as this is only a snapshot) and hopefully, the error will occur.
@cgiesche I have a large network of devices which I'm not comfortable sharing, even with someone privately, I hope you can understand.
I do agree though that this is environmental.
May I suggest another way to approach this? If it were true that some sort of entity was causing the code not to show the list of entities and prevent requests from sending, what are the most likely places of code that would fail?
I'm unfamiliar with the codebase, Vue and Stream Deck plugins, but if I were to take a high probability stab in the dark imho... I wonder if the code is expecting a property to exist on an entity and it's accessing a sub-property/method of it but the property is undefined
for a particular entity.
Some suggestions:
-
Focusing on the area that is likely to contain the problem, double-checking how and which properties are accessed and whether they can be accessed in a safer way (e.g. using optional chaining)
-
Adding some error catching and logging to the likely area or adding UI elements in a special "debug" release which give feedback on any errors, etc
UPDATE
@cgiesche i have emailed you an anonymised version of my entity states.
I have just created a debug release which has to be installed manually (https://github.com/cgiesche/streamdeck-homeassistant/releases/tag/2.4.3).
It does perform intense logging at the place where available entities are filtered after selecting a service for a button action.
You can access the logs like described in #227 (comment).
You can verify, the debug release is installed correctly by rightclicking the plugin in the streamdeck app:
@cgiesche Here is a screenshot of the JS console. Note that I tweaked your build slightly to just output the count of available entities and services rather than outputting the entities and services themselves.
I hope this is helpful. I also privately emailed you a screen-recording of my session if that's more helpful.
UPDATE
Best I can tell, this line of code expects selectedService.target.entity
to be an array, but it can just be an object.
if (selectedService && selectedService.target && Array.isArray(selectedService.target.entity)) {
...
}
console.log("[DEBUG] Selected service does not support target. So, no entities available :(")
...
Confirmed, changing the above code to this seemed to fix it for me! ๐ฅณ
const targetEntities = selectedService && selectedService.target && (
Array.isArray(selectedService.target.entity) ? Array.isArray(selectedService.target.entity) : [selectedService.target.entity]
)
if (targetEntities) {
...
}
I've also just come to the same realization. Thanks for the support!
And once again, as a Java developer, I've fallen victim to the type uncertainty of JavaScript. :D
Edit: To be precise, I was more a victim of Python, which generated the JSON.
Edit 2: None of my services returns a single object in target.entity
. Even if there is only a single object, it is returned inside an array. This is how my climate.turn_on
service looks like:
'{"domain":"climate","name":"turn_on","title":"Turn on","description":"Turns climate device on.","dataFields":{},"target":{"entity":[{"domain":["climate"]}]},"serviceId":"climate.turn_on"}'
Strange world.
I will create a fix release!
Here we go: https://github.com/cgiesche/streamdeck-homeassistant/releases/tag/2.4.4
This will hopefully be the next release for the elgato store. Besides (hopefully) fixing this issue, It contains some other minor fixes and improvements.
Please feel free to test and give your feedback.
And once again, as a Java developer, I've fallen victim to the type uncertainty of JavaScript. :D
Haha, well you're in good company. As a former C# (basically Java) dev myself, my advice is to embrace TypeScript! ๐
2.4.4
seems to be working as expected ๐
Thanks for your time, patience and persistence ๐ฏ ๐ฅ