Preferred situation: esp logs into web application, goes to certain screen and the numbers are exported to home assistant and used as a sensor.
Or if not possible, take a screenshot that is loaded as a picture on home assistant.
pretty sure there is nothing in esphome that will help you with that. This is not something that esphome is designed to do. There are many tools and libraries that are designed for web scraping but they typically require a computer with an OS and more resources.
You might find some inspiration here:
To defeat 2FA you’re going to need a certified black hat to help you. I don’t think you will find that here.
Thanks for the info. What kind of strange is that when I log in the site I get a verification step. But if I login in on another browser and perhaps even other device within the next hour there is no verification step. So maybe I can do something with that.
Could I run the site on my qnap nas webserver. Login there with 2fa and keep the site open. And then have home assistant multiscrape scrape data from the qnap browser?
I can understand there might be an automatic logout after few days but still would be better than nothing.
Most sites that use MFA actively try and keep you from doing things like that using, at least, obfuscation. Exactly how they do this varies. Typically it is some variation of a short-lived token. If it is bearer token, you just need that token. But those are typically good for no more than an hour. A refresh token typically allows getting an access/bearer token.
If you are running this on your NAS, just write a real program that does what you need and then send the data to HA.
Many sites actively discourage the activity you want and it might actually violate the ToS that you agreed to (but probably didn’t read before clicking yes).
A site that supports what you want provides an API and a means of programmatically authenticating securely. As an example GitHub has a API that lets you do many things. It provides PAT and GitHub Apps as two mechanisms for authentication.