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

No SleepAsAndroid device shows up in Blueprint #49

Open
kevinnocom opened this issue Jan 21, 2023 Discussed in #41 · 7 comments
Open

No SleepAsAndroid device shows up in Blueprint #49

kevinnocom opened this issue Jan 21, 2023 Discussed in #41 · 7 comments

Comments

@kevinnocom
Copy link

Hello, I have a very similar issue to the solved one here: #41

I have read through that discussion and tried to mimic the solution, but no device shows up in the Sleep As Android blueprint, after restarting HA.
firefox_otUMZhPOtF

The Application Topic is: SleepAsAndroid/subtopic
The Integration MQTT Topic is: SleepAsAndroid/subtopic

Using the "Test" command in the application causes an event to pop up in the HA MQTT Integration when listening, and also in MQTT Explorer running on my desktop PC. And I've set an alarm on my Sleep As Android application to try to fire off a test event, which seems to work fine ("alarm_alert_start" "alarm_alert_dismiss" show up in MQTT Explorer).

I am doing something wrong but am not quite sure what it is. I am very new to this. Thank for you very much for your hard work!

@IATkachenko
Copy link
Owner

IATkachenko commented Jan 22, 2023

@kevinnocom, hello.

Could you post integration logs at debug level while startup and any event from application?
To get debug logs you should add:

logger:
  default: warning
  logs:
    custom_components.sleep_as_android: debug

to configuration.yaml and restart Home Assistant.

@morgil
Copy link

morgil commented Mar 25, 2023

@kevinnocom I just had the same problem, it was because I forgot to add /username resp. my device ID to the MQTT topic in Sleep: https://github.com/IATkachenko/HA-SleepAsAndroid#application-configuration
Maybe it is the same for you?

@Knysliux001
Copy link

I see the messages in MQTT Explorer, but the integration fails to create the entity.
Home Assistant Core Logs:

2023-04-18 00:08:12.710 INFO (MainThread) [custom_components.sleep_as_android] Setting up 53bbe1409c513bbf36babe9c9b78726a
2023-04-18 00:08:12.714 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that uses deprecated `async_get_registry` to access entity registry, use async_get instead. Please report issue to the custom integration author for sleep_as_android using this method at custom_components/sleep_as_android/__init__.py, line 29: registry = await er.async_get_registry(hass)
2023-04-18 00:08:12.813 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] async_setup_entry: adding configured entities is finished.
2023-04-18 00:08:12.813 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] Going to subscribe to root topic.
2023-04-18 00:08:12.814 DEBUG (MainThread) [custom_components.sleep_as_android] Subscribing to 'SleepAsAndroid/+' (generated from 'SleepAsAndroid/%%%device%%%')
2023-04-18 00:08:12.824 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up sleep_as_android platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/sleep_as_android/sensor.py", line 48, in async_setup_entry
await instance.subscribe_root_topic(async_add_entities)
File "/config/custom_components/sleep_as_android/__init__.py", line 183, in subscribe_root_topic
self._subscription_state = await subscription.async_subscribe_topics(
TypeError: async_subscribe_topics() takes 2 positional arguments but 3 were given

@IATkachenko
Copy link
Owner

IATkachenko commented Apr 19, 2023

@Knysliux001, could you open new issue with this, with installation details (HA version, installation method etc)?

Looks like version incompatibility: last version with code from your trace is v1.7.0, and it is not compatible with HA 2022.3 and above. Also you may check versions Wiki page.

@cooljoebob64
Copy link

I had this problem as well, and the solution was as @morgil mentioned:

I had the topic configured incorrectly (not matching between Sleep and the HASS integration). One had a leading slash, and the other did not - both seem to be valid, but they need to match up.

So I had:
devices/myphone/SleepAsAndroid
and
/devices/myphone/SleepAsAndroid
which of course do not actually match.

Setting them both to the same (as either of the above) works just fine as soon as Sleep sends a message (such as using the test button).

Might be nice to have some kind of validation for this or at least a mention in the documentation somewhere, even though it seems obvious in hindsight.

@IATkachenko
Copy link
Owner

@cooljoebob64, hello

https://github.com/IATkachenko/HA-SleepAsAndroid/wiki/application-configuration

Topic is a topic name where the application will publish events. MUST be related to Topic template from integration settings.

May be I need reword it... Is any suggestions?

@Gabriel-Graf
Copy link

@kevinnocom I just had the same problem, it was because I forgot to add /username resp. my device ID to the MQTT topic in Sleep: https://github.com/IATkachenko/HA-SleepAsAndroid#application-configuration Maybe it is the same for you?

It is Important to make another test send over the sleep App to make the change visible in HA

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

No branches or pull requests

6 participants