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

Fix web sockets instability #577

Merged
merged 9 commits into from
Oct 25, 2023
Merged

Fix web sockets instability #577

merged 9 commits into from
Oct 25, 2023

Conversation

matjack1
Copy link
Collaborator

This PR attempts a fix at a long standing issue about reboots when using the web UI.

The issues that probably will be fixed by this are:

A bit of back story here: #572

Mainly this PR is moving the processing of web sockets out of the callback to the main loop, similar to what happened recently to the MQTT messages.

Then instead of sending all the messages to all the clients, now each client receives back the messages that have requested, so potentially multiple users can access esp-rfid simultaneously.

If anyone can test this and give me a feedback would be greatly appreciated.

@timknowlden
Copy link

timknowlden commented Jan 22, 2023

Hi @matjack1 , I would like to try this as my unit is still on the test bench, I am not sure how I can download this release to test though as still new to GitHub. I also have an issue on the version I am using where GPI05 is triggered on boot up (which triggers relay)

@matjack1
Copy link
Collaborator Author

hey @timknowlden thank you!

You can check the automated builds from here: https://github.com/esprfid/esp-rfid/actions

In particular, the latest build for this PR is here: https://github.com/esprfid/esp-rfid/actions/runs/3980992874 at the bottom of the page you can download the binaries. Let me know if you need more info. Thank you very much!

@timknowlden
Copy link

Thanks for the reply, I will try the latest very shortly.

Im also trying to understand how GitHub works, there are Tools build for Mac, Windows and Linux, these are all ones that have to be manually compiled and platform IO is automated?

@timknowlden
Copy link

@matjack1 I have installed this build, the issue with triggering the relay persists.
My relay board is this one here:
https://templates.blakadder.com/ESP12F_Relay_X1.html

I am using GPI05, which is listed as ok to use on here: https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/

So it seems as though somewhere in the code it is being triggered on start up? (my hardware settings are set to Momentary and is triggered for the same length as the 'Activate Time', it doesn't trigger on start up if set to Continuous)

I am also not having any joy with home assistant auto discovery, if I set topic to home 'assistant/rfid' or just 'rfid' as per the MQTT readme it is not picked up in home assistant automatically.

I can communicate with it manually. It is also taking 3 or more times to save the changes as after each restart it is back to how it started.

Because my intention is to use this with a garage door opener I cannot have this trigger the door in the event of a power cut, or device reboot.

Any help appreciated.

@matjack1
Copy link
Collaborator Author

This PR is not related to your issue, I'd say, but let me try giving you a couple inputs:

  • the relays are triggered at startup in the closed state. If yours is triggered in the wrong way, try to change the relay setting here:
    Schermata 2023-01-22 alle 21 50 50

  • the HA autodiscovery topic is fixed, so it shouldn't be affected by your settings

Maybe let's carry on in your discussion here: #576 if it's not related to this PR

@windy54
Copy link

windy54 commented Jan 23, 2023

Just downloaded the binary and installed the debug build.
150 users restored on first attempt.

Brilliant, promise not to find anymore issues...
Steve

@matjack1
Copy link
Collaborator Author

Thank you!

@timknowlden
Copy link

Good morning,

I have been having issues with the door opening on its own, it is registering the action as the internal button being pressed. See log,

image

@matjack1
Copy link
Collaborator Author

@timknowlden is this caused by this pull request? It seems unrelated to me. If it is unrelated, please open a separate issue and possibly provide an export of your settings and the version you are trying, so that I can better reproduce the error. Thanks!

@timknowlden
Copy link

timknowlden commented Feb 15, 2023

@timknowlden is this caused by this pull request? It seems unrelated to me. If it is unrelated, please open a separate issue and possibly provide an export of your settings and the version you are trying, so that I can better reproduce the error. Thanks!

Sorry, this is the incorrect place. I will do this later as I am away from home and my wife has switched the device off because of the opening/closing whilst nobody is home

matjack1 and others added 8 commits October 10, 2023 16:36
I've hacked in a new pagination system, only for users now, that avoids fetching all the data before showing the interactive table.

It still has room for improvement, but it's a test to see if it fixes some issues with large data sets.
@matjack1 matjack1 force-pushed the fix-websockets branch 2 times, most recently from 23595e6 to eba8708 Compare October 17, 2023 13:46
@matjack1 matjack1 force-pushed the fix-websockets branch 3 times, most recently from e2be2df to 5aa5768 Compare October 25, 2023 20:26
@matjack1 matjack1 merged commit 4bb84b8 into dev Oct 25, 2023
@matjack1 matjack1 deleted the fix-websockets branch October 25, 2023 20:44
@matjack1
Copy link
Collaborator Author

This is not perfect, it's a little improvement for stability. It works most of the time, with not too big data set. But this is the best I can pull off here :(

For doing stuff when the web UI breaks, I recommend using MQTT that is far more stable.

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

Successfully merging this pull request may close these issues.

3 participants