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

Bug: All entities unavailable once HASS.agent disconnects/machine is shutdown #301

Open
3 of 5 tasks
bcutter opened this issue Apr 2, 2023 · 7 comments
Open
3 of 5 tasks

Comments

@bcutter
Copy link

bcutter commented Apr 2, 2023

Describe the bug
Is it normal for all Home Assistant entities (buttons and sensors) provided by HASS.Agent through MQTT to render unavailable once the client/Windows machine running HASS.Agent is switched off?

To Reproduce
Steps to reproduce the behavior:

  1. Connect an application to HA
  2. Make sure entities states are up to date
  3. Disconnect the client (shutdown Windows machine e. g.)
  4. See all entities of that machine rendering unavailable

Expected behavior
I expected all entities to keep the latest state, as all integrations do.
If it's not a bug but "works as designed": That "show current state" instead of "show latest state (which is not unavailable) approach has quite some downsides.

Screenshots
grafik
grafik

Misc info (please complete the following information):

  • Windows build (ideally screenshot/info of winver.exe output):
    grafik
  • Windows' UI language: German (DE)
  • HASS.Agent version: 2022.14.0

Please check what's applicable (multiple answers possible):

  • Installed via installer
  • Installed manually
  • Problem occurs in HASS.Agent
  • Problem occurs in Satellite Service
  • Problem occurs after MQTT --> in HA!

Additional context
I was not sure if this issue shall be created in https://github.com/LAB02-Research/HASS.Agent-Integration/issues instead. But the integration does nothing on that ("only" provides notifications and media player), right?

@sirmeili
Copy link

sirmeili commented Jun 19, 2023

I just set this up last night (6/18/2023) and I have run into the same issue. I don't know if it's the MQTT add-on or this one, but having it all set to "unavailable" kinda stinks. I have a feeling it's HA/MQTT doing it though when the connection is lost.

Edit: To be clear, my issue is that as soon as the computer is off/asleep, all sensors are set to "unavailable". Would be nice for some of them to keep the same value, like "lastsystemstatechange"

@bcutter
Copy link
Author

bcutter commented Jun 19, 2023

Edit: To be clear, my issue is that as soon as the computer is off/asleep, all sensors are set to "unavailable". Would be nice for some of them to keep the same value, like "lastsystemstatechange"

Exactly that's the point here ✔

That current behaviour is not common sense and different to common implementation approaches where the last state is kept active until it is refreshed/overwritten by a newer state. Magical unavailable and unknown shall only be used for error situations. HASS.agent not being connected is not an error situation.

@amadeo-alex
Copy link

Hello, HASS.Agent handles availability topic properly and sets the sensors as "offline", that's why the HA shows them as "Unavailable". If the device is not powered on the sensors should not stay available (for example, the CPU load of 45% wouldn't make sense on powered down PC).

@sirmeili
Copy link

But not all sensors fall under that rule. I.e. (as I mentioned in the other issue), Last User Logged In would be nice to have it retain its value. From my understanding it is possible to configure MQTT to allow this (though I am not overly familiar with MQTT yet)

@bcutter
Copy link
Author

bcutter commented Jul 13, 2023

Double what sirmeili said. Plus regarding the CPU load example: if the machine is off, the load is 0 %. 0 is a valid state. While unavailable and unknown stand for problematic states in the HA universe. My devices ('s entities) are not problematic, they are just off.

@amadeo-alex
Copy link

A hard theory from my side (at least for now), but CPU Load will almost never be exactly zero, even if I do implement the option not to send availability topics, the last value from things like CPU Load Sensor most likely won't be zero but the last known value (and this applies to all other sensors that would be configured that way - it will be up to the user to handle this on the HA side, just like it is now with the "unavailable" problem, user can retrieve the last valid value from HA itself).

@bcutter
Copy link
Author

bcutter commented Aug 26, 2023

Won't this be relevant here or at least be of interest?

https://www.home-assistant.io/blog/2023/03/01/release-20233/#breaking-changes

grafik

At least it shows how other folks (the HA core team) care about entity states and what they represent and might trigger.

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

No branches or pull requests

3 participants