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

Mikrotik does not restore states #31757

Closed
tjorim opened this issue Feb 12, 2020 · 11 comments
Closed

Mikrotik does not restore states #31757

tjorim opened this issue Feb 12, 2020 · 11 comments

Comments

@tjorim
Copy link
Contributor

tjorim commented Feb 12, 2020

The problem

When rebooting Home Assistant Core, I end up with a lot of unavailable entities. In HA 0.104 and older (with legacy device_tracker) this wasn't an issue and old states were restored. Now I have a bunch of entities with the following message:

This entity is currently unavailable and is an orphan to a removed, changed or dysfunctional integration or device. If the entity is no longer in use, you can clean it up by removing it.

Entities stay that way until the device connects back to the network (state = home) and leave after that (state = away).

Environment

  • Home Assistant release with the issue: 0.105.3
  • Last working Home Assistant release (if known): 0.104.x
  • Operating environment (Hass.io/Docker/Windows/etc.): Home Assistant (Hass.io) on generic Linux
  • Integration causing this issue: mikrotik
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/mikrotik/

Problem-relevant configuration.yaml

Set up using config flow.

Traceback/Error logs

NA

@probot-home-assistant
Copy link

Hey there @engrbm87, mind taking a look at this issue as its been labeled with a integration (mikrotik) you are listed as a codeowner for? Thanks!

@engrbm87
Copy link
Contributor

Hello @tjorim ,
Restoring the state of a device_tracker while the integration is unavailable will not provide the current state of that device (it might be currently away while the last state was home). If the entity state is unavailable this means either the integration is unavailable (disconnected for some reason) or the integration is not updating the state of this entity in which case you may need to check the reason for that.

@tjorim
Copy link
Contributor Author

tjorim commented Feb 18, 2020

There are no errors in the log. Devices that are still connected show up as home fine. However, devices that are unavailable should be marked as away instead, because they are not available on the network, because they are disconnected.

@engrbm87
Copy link
Contributor

If these devices were created from the previous integration and have not been discovered by the new mikrotik integration (which doesn't use known_device.yaml and uses the entity registry) then they will show as unavailable and should be removed. New devices will show as away if they are disconnected from the network.

@tjorim
Copy link
Contributor Author

tjorim commented Feb 18, 2020

I started clean, removing old integrations and known devices. Yet devices show as unavailable instead of away after a restart. Once a device has connected again, marked as home and disconnects, it is marked as away instead of unavailable (until the next HA restart).

@vampywiz17
Copy link

Same problem, possible to solve it? It make harder to automate a lot of things.... (in need to handle unknown state every time...)

@tjorim
Copy link
Contributor Author

tjorim commented Apr 9, 2020

@engrbm87
Copy link
Contributor

For the mikrotik integration the all_devices list is maintained from the DHCP server leases. If the devices showing unavailable on startup are not in the router DHCP server Leases then you can simply make the lease as static so that it doesn't get removed.

@bigboban
Copy link

Same issue for me. My observation is device-tracker entitites from Mikrotik integration are NOT in know-devices file. Before restart all works great - presence home/not home works fine. But after restart if device is away entity goes to Unavailable state.

Unusable device-tracker integration for me. 👎

@damousys
Copy link

I have also this issue
I use the Wi-FI only option because there is no DHCP on my Router / Acces Point
HA Release 114

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

6 participants