Closed rplevka closed 3 years ago
@rplevka, hello.
I cant se any "Got message ... " in log (must be at DEBUG level), so integration don't get messages from MQTT => could not detect device. Normally device should be created automatically after publishing first event...
I'll check it on fresh installation.
so I enabled the debug logging level for the integration and restarted HASS just to find the mentioned messages in the log...and suddenly, even the device got created.
Weird. I'm not aware of any changes to the config. Also i tried to restart HASS server several times.
What was exact actions order while your first attempt?
Right? Maybe restart is required between steps 3 and 4 (or some code changes to avoid it).
However, something went wrong: new device should be created immediately after step 5. I'll check the integration installation on fresh HA installation to debug it.
I believe those were exactly the steps, yeah - I was following the instructions - 1 thing i made differently - I used different topic structure at first:
phone/roman/sleep
after that i noticed the integration works with the root topic, so i switched to phone/sleep/roman
structure.
anyway, when trying to edit the integration settings, the topic in the form resets to "SleepAsAndroid" (possibly a bug?). I decided not to fight with it and go with the defaults.
Anyway, I've tried to restart HASS several times without any success. It almost looks like it started to work after I enabled debug logging output, which is probably just a correlation.
Reconfiguration (without removing the integration) is not supported in correct way now, so it may affect too.
OK, now it work and you may use the Integration. And I'll check the installation process: may be I have bug in installation mechanism...
thanks for your prompt reply!
so I think the issue is here.
The +
wildcard only subscribes to the very next subtopic level.
My all previous configuration attempts used multiple subtopics levels:
phone
/roman/sleep
I guess in my scenario, it subscribed to phone/roman
and thus was not receiving any messages.
I changed my topic structure to make the unique device part the last level:
phone/sleep
/roman
.
I used the previous structure as I also use notify&fitness app + tasker mqtt to publish heart rate data from my wristband:
phone/roman/heart
nevermind, i will swap them.
Just curious, whether using #
instead of +
would work?
Integration logic is to create device for every subtopic: if your family have several devices, then use single root topic for the sleep data and subtopic per device to create devices with names of subtopics. So, it need +
.
Your variant is reasonable too: phone device may provide a lot of data and it is OK to group data by device. In this case subscription should be: prefix
/device_name(+
again)/suffix
.
May be we should have option in configuration dialogue to choose more comfortable way.
maybe a feature request, but I could imagine something like a jinja template to delimit the subtopic part to be taken for a device name, e.g.
foo/bar/{{ device }}/baz
General information
Integration
Integration version: v1.2.0 HASS version: 2021.3.4 Root topic: SleepAsAndroid
Application settings
configured Sleep as android to use
SleepAsAndroid/roman
topic topic:How it works now?
The events are published by Sleep app to the broker and I can read them using mqtt client, However, the HASS integration doesn't create any device nor entity.
What do you expect?
Device and entity that would collect the events and states from the mqtt topic
Steps to reproduce
I followed all the steps as described in readme
Debug log
I can see logs like:
Additional information
just wanted to say hi and thank you for the integration