-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Suggestion to use app-gateway-prod.senecops.com to retrieve webapi Data #42
Comments
Hi @oakdesign! when you run into issues with following the login redirects of mein-senec.de (when using aiohttp) - then you need https://github.com/aio-libs/aiohttp 3.9+ (since the new version - not released yet) will include a fix for the cookie handling... If you don't like to wait the code here includes the fix/workaround by setting an own the cookieJar implementation... The main reason why I would like to stick with mein-senec.de (and don't use the app-gateway-prod.senecops.com) - this host and API is not public at all - yes obviously we can see that it exists right now (and will be used by the App) - but we never know, when this host & API might be replaced/removed at any time... I don't see (yet) any advantage of a longer cookie expire-duration... IMHO the infrastructure setup of the host is 'suboptimal' - but that's IMHO just matching the rest of the company's IT department. So - yes - I knew this 'app-gateway-prod.senecops.com' host (and the endpoints) before - but (right now) I don't see any advantage of using them as long as mein-senec.de is officially available. Of course you are invited to change my mind :-D |
Only real advantage I see at the moment would be the ability to set wallbox properties through the app gateway endpoints. At least I haven't identified corresponding service endpoints on the mein-senec.de wallbox controllers. Btw. from my point of view the mein-senec API endpoints are not more or less public than the app gateway. if we grab A from browser devtools or B through monitoring the DNS traffic of the app, both are not officially public documented by senec ;-) |
ok - that's for sure an advantage (having more options) - thanks for mention this - I still have the hope that Senec Software developers are doing some things right - and at the end of the day (code) both url's will be handled by the same internal enpoints (just with different auth-providers) - so would be interesting, if it's possible to manipulate wallbox settings from the mein-senec.de url [actually I hope that the security layer will intercept - but who knows!]
I can agree with your point of view... Pressing F12 and open the network tab just became a habit for me... while monitoring my DNS traffic isn't (might be cause a PiHole-instance is running also in the basement) ... and forgot to mention - let me know, if you want/need additional information about the using own CookieJar impl with aiohttp (in order to successfully access mein-senec.de) |
THX for the offer, I have some 25 years as Dev and Architect for web based applications, so have no issues to get the mein-senec.de running as well as using this integration in order to have entities for my power-plus enrgy plus cards. On other small advantage of the app-gateway in comparison to the mein-senec.d I see in collecting the statistic total. With the app-gateway I would be possible to get all total values with a single service call compared to the multiple calls with type=xxx calls.
I don't think so. My mein-senec.de UI is pritty messed and limited, I guess because I have a Home V4. Compared I only have half of the menu of other users. My first thought was that it's account based restirctions but then realized that they dont even have a proper binding for the Home 4 and therefore result in a "?view.product.unknown?" and therefore not loading a proper NavigationViewModel. |
@marq24 might have found some data that is not available from the mein-senec.de API but through the app-gateway in terms of systemstatus. I'm currently quite busy with a large software package delivery for 2 automotive customers. But as soon as I find some time might contribute with a app-gateway code. Meanwhile through the latest app version 4.3.3 and 4.4.0_beta01 ther is for example that returns so for example case and module temperatures for Home 4 systems
|
GOOD LUCK! - "Your Spaltmaß is killing my Software" - I worked 15+ years in this area - and finally got away...
Actually my current train of thought would be to add an additional "connection-type" - so the user can choose "direct", Mein-Senec or WebAPI (and the additional internal inverter stuff),,, |
same idea I had in mind. meanwhile I'm going to ducument the current app-gateway serices of App Version > 4.3.3 here. As the Service-endpoints and request parameters as well as response json have been changed compared to the previous availabe postman documentation of app version 3.12.0 from 2021 |
Might be it was yesterday just too late - or too early this morning - I try to understand the new postman stuff - some URL contains a So basically that's the ANLAGEN_ID that have to be placed into the URL... ok - makes sense - but this will instantly rise the question, about master & slave setup's (that was hard part of the current web-api implementation) - but this should not be a show stopper for now... |
@oakdesign I am currently looking "a bit" closer into your request - or better into the data that will be returned... I have to admit, I am basically clueless, what call's I have to make to the APP-API in order to get A) "lastest" total statistics data Yes I can get current battery status [currentChargingLevelInPercent, currentVoltageInV, currentCurrentInA] from the batteryPack (when calling the technical-data endpoint)... But I do not manage to create a URL (that does not return 99% data that is not needed) for the 'zeitverlauf' (or 'statistik') endpoints - I would like to be able to use something like "after" (and not "before") |
I am already closer to what I was looking for... BUT... there are (at least I don't see this) none TOTAL (sum) of the IMPORT/EXPORT etc fields - you can get the data for NOW, TODAY (dashboard) and then from the Monitor "per" year... [but not a overall total] - do you agree? |
Have you tried the data/custom command with something like 2001-01-01 as the startDate and today's date as the endDate? |
lowest startDate that I can use is 2018-01-01... for endDate I can use current month +1 [JFYI] - but yet THANKS - thats probably will do it... |
so you have an initial version (beta) now... [no new sensors yet] -> https://github.com/marq24/ha-senec-v3/releases/tag/2024.0.2 |
@oakdesign looking forward to your feedback to https://github.com/marq24/ha-senec-v3/releases/tag/2024.0.3 |
2024.0.1 was the last working version for me. The 2 beta releases after that did not initialize properly. Did a rollback but have not checked the release 2024.0.6 yet. I think I should not try any beta in my case, although the 2 beta releases in-between don't show up anymore |
of course the installation of the beta version(s) is totally optional - but have in mind, when there is no feedback (bug reports) beta releases will make it to the release channel... If a beta version does not work for you - please create a issue (providing details from you log)... TIA |
Totally true. I will provide the logs with a new test of the current beta |
closed with release of 2024.0.9 |
Fist of all thank you for integrating the webapi into the the integration.
I personally use nodered in combination with Homeassistant alongside with influxdb and grafana.
In oder to get the webapi data I use node-red and ran into a similar issue like you did in
#7
After further inspection, there is an alternative way to get the same data but through a different source which is the senec
https://app-gateway-prod.senecops.com which host the service the senec app is using to retreive its data. this is a overview of all available service endpoints
https://documenter.getpostman.com/view/10329335/UVCB9ihW#3e5a4286-c7d2-49d1-8856-12bba9fb5c6e
In comparision to the mein-senec the login and authorization is not based on a session cookie rather than a token. From my current testing the token only has to be obtained once alongside with the value for the anlagenid and does not expire in contrary to the JSESSIONID cookies used by mein-senec.de
Tested on various plattforms and locations, the token retrieved once through a POST to the https://app-gateway-prod.senecops.com/v1/senec/login endpoint stays the same for a given username and passord combination.
The text was updated successfully, but these errors were encountered: