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

Only one entity is added with status unavailable #61

Open
LMaier-dev opened this issue Sep 10, 2023 · 4 comments
Open

Only one entity is added with status unavailable #61

LMaier-dev opened this issue Sep 10, 2023 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@LMaier-dev
Copy link

LMaier-dev commented Sep 10, 2023

General information

Home Assistant

Version: 2023.9.1
Installation method (according to instructions):
[ X ] Operating System (10.5)
[ ] Linux VM
[ ] Container
[ ] Supervised
[ ] Core

Integration

Installation method:
[ X ] HACS
[ ] manual from release
[ ] manual from git
Integration version: v2.2.0
Root topic: SleepAsAndroid

Application settings

WhatsApp Image 2023-09-10 at 13 14 33

[ X ] I can see MQTT messages from application at MQTT-server (only the first one though)

How it works now?

Only one sensor shows up which reports unavailable

What do you expect?

After Pressing Test like in the steps below, all sensors would show up and report the correct values.

Steps to reproduce

  1. Input mqtt url and topic (SleepAsAndroid/client)
  2. Add the integration in home assistant with these settings:
    NVIDIA_Share_sd74jk1J4o
  3. Press Test in app (App reports "Connecting..." then "Success")
  4. Only one Entity (sensor.sleepasandroid_client) shows up which has status unavailable

Debug log

2023-09-10 12:50:09.831 DEBUG (MainThread) [custom_components.sleep_as_android] Got message ReceiveMessage(topic='SleepAsAndroid/lorenz', payload='{"event":"Unknown"}', qos=0, retain=0, subscribed_topic='SleepAsAndroid/+', timestamp=datetime.datetime(2023, 9, 10, 10, 50, 9, 831189, tzinfo=datetime.timezone.utc))
2023-09-10 12:50:09.832 DEBUG (MainThread) [custom_components.sleep_as_android] create_entity_id: my name is SleepAsAndroid, device name is lorenz
2023-09-10 12:50:09.832 DEBUG (MainThread) [custom_components.sleep_as_android] sensor entity_id is SleepAsAndroid_lorenz
2023-09-10 12:50:09.833 INFO (MainThread) [custom_components.sleep_as_android] New device! Let's create sensor for lorenz
2023-09-10 12:50:09.833 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] New attributes is {'timestamp': 'unavailable', 'label': 'unavailable'}
2023-09-10 12:50:09.833 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] Creating sensor with name lorenz
2023-09-10 12:50:09.833 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] Processing message ReceiveMessage(topic='SleepAsAndroid/lorenz', payload='{"event":"Unknown"}', qos=0, retain=0, subscribed_topic='SleepAsAndroid/+', timestamp=datetime.datetime(2023, 9, 10, 10, 50, 9, 831189, tzinfo=datetime.timezone.utc))
2023-09-10 12:50:09.833 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] Got payload['event']='Unknown'. Will use STATE_UNKNOWN='unknown' instead
2023-09-10 12:50:09.833 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] New attributes is {'timestamp': 'unavailable', 'label': 'unavailable'}
2023-09-10 12:50:09.833 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] Will not update state because old self.state='unknown' == new_state='unknown'
2023-09-10 12:50:09.833 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] Firing 'SleepAsAndroid_lorenz' with payload: '{'event': 'unknown'}'
2023-09-10 12:50:09.835 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] My identifiers is {('sleep_as_android', 'SleepAsAndroid_lorenz')}
2023-09-10 12:50:09.837 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] My identifiers is {('sleep_as_android', 'SleepAsAndroid_lorenz')}
2023-09-10 12:50:09.837 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] My device id is 19f4d0ea86bded0b5121a31057bed36f
2023-09-10 12:50:09.837 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] Got self._attr_native_value='unknown'. Will use STATE_UNKNOWN='unknown' instead
2023-09-10 12:50:09.837 DEBUG (MainThread) [custom_components.sleep_as_android.sensor] async_added_to_hass: restored previous state for SleepAsAndroid_lorenz: self.state='unknown', self.native_value='unknown'.

Additional information

My Mosquitto MQTT broker only log this:
2023-09-10 13:09:40: New client connected from 192.168.0.81:47932 as SleepAsAndroid (p2, c1, k60, u'mqtt-user').
2023-09-10 13:09:40: Client SleepAsAndroid disconnected.

Thanks for working on this!

@IATkachenko
Copy link
Owner

IATkachenko commented Sep 16, 2023

LMaier-dev, hello.

All goes well with your setup: while pressing "test" in the App the integration got payload='{"event":"Unknown"}' (the first message from log) and translate it to sensor state.

Try to start sleep tracking and you will see "sleep tracking started" payload and corresponding sensor state.

ps. the integration have just one sensor with current sleep tracking state.

@IATkachenko IATkachenko added the documentation Improvements or additions to documentation label Sep 16, 2023
@baradetsky
Copy link

а я поддерживаю предыдущего оратора...
2023-10-21_12-45-09
2023-10-21_12-45-38
что я делаю не так?

@IATkachenko
Copy link
Owner

@baradetsky, пишете в чужом issue, в ситуации когда ваши настройки не соответствуют настройкам автора, не прикладываете логи и диагностическую информацию, которая требуется при создании issue.

ps. у вас в приложении, скорее всего (понять по скринам ваши настройки невозможно, поэтому форма issue запрашивает все что запрашивает, а не только один пункт, про который вы написали), в разделе topic, написано "SleepAsAndroid", а интеграция, скорее всего настроена на путь по умолчанию. Поэтому она и не видит данные. Пропишите в приложении topic SleepAsAndroid/baradetsky. Если не поможет -- открой issue, с логами и настройками, будем детальнее разбираться.

@LMaier-dev
Copy link
Author

LMaier-dev, hello.

All goes well with your setup: while pressing "test" in the App the integration got payload='{"event":"Unknown"}' (the first message from log) and translate it to sensor state.

Try to start sleep tracking and you will see "sleep tracking started" payload and corresponding sensor state.

ps. the integration have just one sensor with current sleep tracking state.

Hi @IATkachenko,
Very sorry, I forgot I opened this issue. Actually the next day it worked fine already (And it does to this day). I didnt even have to press the test button again.
Feel free to close this issue when and if @baradetsky opens a separate one.
Thanks again for this integration.

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

No branches or pull requests

3 participants