Skip to content

Only one entity is added with status unavailable #61

@LMaier-dev

Description

@LMaier-dev

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions