home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.3k stars 636 forks source link

WearOS - Ewelink addon switches: Unable to find referenced entities switch.xxx #1954

Closed peterterbe closed 2 years ago

peterterbe commented 2 years ago

Home Assistant Android version: beta-1716-40e7907-full Home Assistant Wear OS version: beta-1716-40e7907 Android version: 11 Wear OS version: 3 Phone model: Oneplus Nord Watch model: Samsung Galaxy Watch 4 Last working Home Assistant release (if known): None

Description of problem:

Selecting an Ewelink Addon entity in the WearOS app doesn't do anything but a logevent:

WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities switch.1000a403aa

If I enable toast it shows the message eg: "Front yard lamps was selected" but the selection does nothing just the log message. Front yard lamp is switch.1000a403aa and I have tried with several other entities all with the same result. These entities are mainly coming from the Ewelink addon. My only switch that is not from ewelink is the Synology NAS Home mode. That is working perfectly and ewelink switches working from the android phone version, too.

Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):

Screenshot of problem:

Additional information:

dshokouhi commented 2 years ago

well does that entity exist in the states tab? I know nothing about the ewelink add-on but it seems it is not providing valid entities due to the HA side error. All the app does is request HA to send us a list of entities and then we execute it, nothing special.

dshokouhi commented 2 years ago

Looks like its a known issue, are you on the latest version of the add-on?

https://github.com/CoolKit-Technologies/ha-addon/issues/21

peterterbe commented 2 years ago

What do you mean by the States tab? I can see it under Configuration/Entities. Its settings says it does not have a unique ID therefore its settings cannot be managed from the UI. CoolKit-Technologies/ha-addon#21 may be related but I can use these switches from HA web interface, mobile app, and I can add them to Lovelace, etc

dshokouhi commented 2 years ago

The switches may work but the error for the entity ID needs to be solved. Are you on the latest version of the add-on as the linked issue mentions? I am not sure htis is an error the app can solve as the HA server gives us the entity ID and we just try to execute it.

States tab is located inside Developer Tools section, its where all entities added to your server are shown

https://www.home-assistant.io/docs/tools/dev-tools/#states

peterterbe commented 2 years ago

Ok, I have found it, thanks! It's listed but I cannot set the state. I try to change state: 'off' to state: 'on' and the lamp is not lighting up but its state property under the Current entities table State column shows the state I set.

dshokouhi commented 2 years ago

The states tab does not control the device like you think it will, it just overrides the state as it mentions in the link :)

Did you check the add-on is up to date with at least the version mentioned in the linked ticket? Have you tried the entity with another app feature like Android 11 device control or widgets?

peterterbe commented 2 years ago

Yes, I'm on version 1.2.3 of the addon. It seems like coolkit issue#21 was fixed in version 1.2.2. The entity can be used from the Android 11 device control screen but the HA Service button widget throws the same warning into the log as the Wear OS app and doesn't switch the device. This is the case with the Home slide app I've tried before, too. It checks, log event shows up without actual toggle of the device.

dshokouhi commented 2 years ago

Yes, I'm on version 1.2.3 of the addon. It seems like coolkit issue#21 was fixed in version 1.2.2. The entity can be used from the Android 11 device control screen but the HA Service button widget throws the same warning into the log as the Wear OS app and doesn't switch the device. This is the case with the Home slide app I've tried before, too. It checks, log event shows up without actual toggle of the device.

If you make a widget for turn_on or turn_off service call on the switch does it work as expected?

Edit: I would also check this by sending a service call using developer tools as well

peterterbe commented 2 years ago

The above error message has been created on each retry (even if the switch was successful).

So basically it is not working when I call the toggle service regardless of the user interface, even from the Developer tools.

dshokouhi commented 2 years ago

So basically it is not working when I call the toggle service regardless of the user interface, even from the Developer tools.

That is a bug with the add-on itself and not a bug with the app because it is happening from the HA frontend. I suggest you file an issue with the add-on creator to see if switches created from it can use the switch.toggle service call as that is what the app uses in some areas.

https://developers.home-assistant.io/docs/core/entity/switch#toggle

Closing this issue for now but do let us know the outcome of the issue you open there.