-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Presence detection for "always-on" devices or imported devices #814
Comments
Hi @ingoratsdorf , Thanks for the report! I've been avoiding this part of the app since I started maintaining it. The code isn't very readable IMO so I tried to avoid touching it. I know there are a couple of bugs, but I'd say they are non-breaking issues. I will try to have a look in the next few days, but not sure if I can find the bug. If you have the availability and interest, these are the 2 files which I think need to be fixed. https://github.com/jokob-sk/NetAlertX/blob/main/front/php/server/events.php |
It's because of In the SQLite file, Convert_Events_to_Sessions corresponds to a view that selects from the Events table. This determines whether a session begins based on the following events: 'New Device','Connected', however this misses the event 'Down Reconnected', which is why it never starts a new session for some devices. Connecting to SQLite and fixing the view allowed the sessions to show up for me. I'm not sure what the best way of fixing this for existing users would be since it's essentially a one time database update.
|
Amazing @johnwang16 🙏 thanks a lot! Just pushed it to dev and should be available for testing in ~15 min in the |
Looks like this doesn't fix the issue where a device is imported and never has a connection event to begin with. I'll take a look at what can be done to address that. |
this should do it #855 |
thanks @johnwang16 , the -dev build should be ready in ~15 min |
releasing in 15 min -> closing - thanks again @johnwang16 |
Is there an existing issue for this?
Current Behavior
When a device is always on or has been imported before being scanned and discovered, the presence detection fails.
Although the device is online, there are no sessions, no events, and mo presence.
Expected Behavior
Device to show up in presence when online.
Steps To Reproduce
Example:
![image](https://private-user-images.githubusercontent.com/3344778/371953539-b08b97ae-23b5-476b-a157-bf292102c4bf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2ODk4MDQsIm5iZiI6MTczOTY4OTUwNCwicGF0aCI6Ii8zMzQ0Nzc4LzM3MTk1MzUzOS1iMDhiOTdhZS0yM2I1LTQ3NmItYTE1Ny1iZjI5MjEwMmM0YmYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTZUMDcwNTA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWY5MzA3Y2NlMTcyOTUzZDA0ZjliNjQ0ZWRmYzgwMjc2ZTg2ZTVhYzRiMGY0NDc2NGI4YWIyZjg1OTRmMDJiZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.3x2fT7IIPROV2qXjkzk_5hc3Dv6aFHSVEkdEJK4wK1M)
There's a an "online since" field that is populated, but not sure from where?
Cause there are no session:
![image](https://private-user-images.githubusercontent.com/3344778/371953728-1eb90fab-e7eb-4bcd-a54e-eb2896aa3398.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2ODk4MDQsIm5iZiI6MTczOTY4OTUwNCwicGF0aCI6Ii8zMzQ0Nzc4LzM3MTk1MzcyOC0xZWI5MGZhYi1lN2ViLTRiY2QtYTU0ZS1lYjI4OTZhYTMzOTgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTZUMDcwNTA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NTMwZmUzZmVkNWRiYTllMzI3NTA3MzlmOWU4YzFiY2IzZDE0OThkYzgyNDFiZTNlNjMxZDcwYjg0MWZkZTNmYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.S9BZ41IyxZtiQstQwPzCi6EN7HiAKURVIcMHF5bEmuI)
And no events either:
![image](https://private-user-images.githubusercontent.com/3344778/371953783-b5ea10bc-8179-4487-ab49-06d1186e1d0b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2ODk4MDQsIm5iZiI6MTczOTY4OTUwNCwicGF0aCI6Ii8zMzQ0Nzc4LzM3MTk1Mzc4My1iNWVhMTBiYy04MTc5LTQ0ODctYWI0OS0wNmQxMTg2ZTFkMGIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTZUMDcwNTA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YjJlZTEwM2E2ZjJkODJiY2I4MTNhNjEzM2YwM2M0MGRlMGJhYzA4NDYzOGJmODJkODU5MjNhOTRjNTBhMjVlNiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.B88JTAP1dq0xZbiU8_tXJRgmqqErW939-DiPSqaAQxQ)
Presence in the device details page seem to have randomly stopped somewhere:
![image](https://private-user-images.githubusercontent.com/3344778/371954018-d350ee14-8621-4e06-a026-2ddbbcbb606b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2ODk4MDQsIm5iZiI6MTczOTY4OTUwNCwicGF0aCI6Ii8zMzQ0Nzc4LzM3MTk1NDAxOC1kMzUwZWUxNC04NjIxLTRlMDYtYTAyNi0yZGRiYmNiYjYwNmIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTZUMDcwNTA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDRmYTBkMmRmMDE0ODc4NjUwZDY1YTYzMTM3MGU2NWJjODMwMGJmMzdkNzFlNmQ5NWQ2MGUyYmRhMDUyODcwMiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.jXQFzJr9k-14O1TKxv8rvWmm2-9REzNgtayACuELAN0)
And presence in the monitoring page is not even there at all:
![image](https://private-user-images.githubusercontent.com/3344778/371954188-4e550170-2ad0-4f4e-9d9a-a32c8136dd4e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2ODk4MDQsIm5iZiI6MTczOTY4OTUwNCwicGF0aCI6Ii8zMzQ0Nzc4LzM3MTk1NDE4OC00ZTU1MDE3MC0yYWQwLTRmNGUtOWQ5YS1hMzJjODEzNmRkNGUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTZUMDcwNTA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzEwYjE4YTZiY2VjMzc5OTRkZmZlYTgwMzczNjAyOGIyNGFmYmViZTc2YTdhZDc2YzJlM2EyYzVlMmMzMDgxMiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.eAZLisQI-Eq79eb8TSoBT0-R4NnSZ3xdpb9aPUzDtSg)
I have a few of such devices, some of them do not even have a presence in device details page.
Any ideas?
The only thing I could think of would be: If a device gets detected as online, then check if there's a previuous 'device-online' event, if not, create one with now as datetime stamp.
app.conf
No response
docker-compose.yml
No response
What branch are you running?
Dev
app.log
No response
Debug enabled
The text was updated successfully, but these errors were encountered: