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

Option to disable state reporting for discovered devices (Home Assistant) #8655

Closed
macrojames opened this issue Jun 10, 2020 · 6 comments · Fixed by #8724
Closed

Option to disable state reporting for discovered devices (Home Assistant) #8655

macrojames opened this issue Jun 10, 2020 · 6 comments · Fixed by #8724
Assignees
Labels
enhancement Type - Enhancement that will be worked on

Comments

@macrojames
Copy link

Have you looked for this feature in other issues and in the docs?
Sure did, even in the code

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
The problem is sensors showing state=unavailable in home-assistant if I use deepsleep.
I understand the lwt should be offline to show the actual state. Home Assistant with the auto discovery of mqtt devices does not support overriding this behaviour besides the config topic.
(https://www.home-assistant.io/integrations/binary_sensor.mqtt/#configuration)

Describe the solution you'd like
A clear and concise description of what you want to happen.
Let me set an option to remove the availability topic (avty_t) from HASS_DISCOVER_BASE.
That is the recommended (and tested) way to keep the state after entering deep sleep and ignoring the state.
I can set that configuration manually and it works until the next time the device set the config topic.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Manually configuring the mqtt devices, not recommened on Home Assistants side, GUI and integration workflows are preferred. It also doesn't scale and interferes with the charming auto discovery for device groups.

Additional context
Add any other context or screenshots about the feature request here.
intermittent
You can see the time when i enabled DeepSleepTime 60

(Please, remember to close the issue when the problem has been addressed)

@effelle
Copy link
Contributor

effelle commented Jun 10, 2020

LWT topic is hardcoded on Tasmota and can't be disabled. When you enable the deepsleep Tasmota will drop the Wifi and then your MQTT broker will not be reachable until next wakeup.
Add an option to have the LWT configurable is frankly a waste of precious bytes but what I can do is to add a check to omit LWT on configuration for read-only sensors and binary-sensors when DeepSleep is > 0.

@effelle effelle self-assigned this Jun 10, 2020
@effelle effelle added the feature request (devs?) Action - awaiting response from developers label Jun 10, 2020
@ascillato
Copy link
Contributor

but what I can do is to add a check to omit LWT on configuration for read-only sensors and binary-sensors when DeepSleep is 0.

That is a nice idea, but should be configurable, at least with a compilation time key, because is just an user preference to have or not the OFFLINE message on a deepsleep sensor. If you agree, we can let as default that if deepsleep is configured, then it is omitted the ONLINE topic for read-only sensors and binary-sensors. What do you think?

@effelle
Copy link
Contributor

effelle commented Jun 10, 2020

Adrian a compilation time key involves a change on code base, not on Discovery.
Did you already faced this issue in the past?

@effelle effelle added the on hold by dev team Result - Feature request put on hold by member of development team label Jun 10, 2020
@ascillato
Copy link
Contributor

No.

But in the discovery message, you can send or not the ONLINE topic for every sensor of the same device.

So, one option could be to have a compilation time key to choose or not having that ONLINE topic in that sensor. So, obviously, after this change, you will need to do setoption19 0 to delete the discovery on Home Assistant and enable it again with Setoption19 1. But the new messages that HA will look won't contain the online topic for those sensors.

I was just proposing, if you think is ok, to have this by default only IF deepsleep was enabled BEFORE doing setoption19 1.

It is just your idea but with the option to enable it or not due to some users want to see the offline on the sensors while others don't. That depends obviously on the setup of each user.

@ascillato
Copy link
Contributor

ascillato commented Jun 11, 2020

@grizewald

The PR 7231 was done because, as it was before, if you restart your device, OR if you change the topic (that will make Tasmota to restart) it will remain connected to the mqtt, while the reality was incorrect. So you could end up with a lot of old devices being online.

About DeepSleep, it needs some fixes as @effelle have proposed. If you have a relay in a deepsleep device, It should be shown as offline while it is not available. That is why it is here the request to make a DeepSleep sensor to not be shown as OFFLINE or ONLINE. That is easy to implement on the Automatic Discovery.


Just for reference, another topic related to this #8599

@macrojames
Copy link
Author

Maybe I failed to explain my proposed solution correctly.
I wouldn't change the LWT topic or it's behaviour. It's just the field avty_t in the hass discovery config I am concerned about. If you omit that field, Home Assistant will keep the analog/temp/humidity/... sensor value with its last state. The online state of the device can still be tracked on the lwt topic and sensor.
But I like the conditions for read-only sensors @effelle proposed.

@effelle effelle added enhancement Type - Enhancement that will be worked on and removed on hold by dev team Result - Feature request put on hold by member of development team labels Jun 12, 2020
@ascillato2 ascillato2 removed the feature request (devs?) Action - awaiting response from developers label Jun 13, 2020
@effelle effelle mentioned this issue Jun 18, 2020
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type - Enhancement that will be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants