Open bboguszewicz opened 2 years ago
just updated to 2022.09 and also getting issues
Logger: custom_components.foxess.sensor
Source: custom_components/foxess/sensor.py:164
Integration: foxess ([documentation](https://github.com/macxq/foxess-ha), [issues](https://github.com/macxq/foxess-ha/issues))
First occurred: 16:02:15 (1 occurrences)
Last logged: 16:02:15
Unable to login to FoxESS Cloud - No data recived
Logger: homeassistant.components.rest.data
Source: components/rest/data.py:74
Integration: RESTful ([documentation](https://www.home-assistant.io/integrations/rest), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+rest%22))
First occurred: 16:02:15 (1 occurrences)
Last logged: 16:02:15
Error fetching data: https://www.foxesscloud.com/c/v0/user/login failed with
I have good news, I have a curl request that works and returns me a token
curl -X POST \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36 OPR/89.0.4447.83', \
-H 'Accept: application/json, text/plain, */*' \
-H 'lang: en' \
-H 'sec-ch-ua-platform: macOS' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Referer: https://www.foxesscloud.com/login?redirect=/' \
-H 'Accept-Language: en-US;q=0.9,en;q=0.8,de;q=0.7,nl;q=0.6' \
-H 'Connection: keep-alive' \
-H 'X-Requested-With: XMLHttpRequest' \
-H 'signature: e5677b71870be075b2b0ede7bafaff5d.5245784' \
-H 'timestamp: 1664016309488' \
-H 'token: ' \
-d @data.json \
https://www.foxesscloud.com/c/v0/user/login
the data.json file
{
"user": "USERNAME",
"password": "PASSWORD"
}
and getting raw data
curl -X POST \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36 OPR/89.0.4447.83', \
-H 'Accept: application/json, text/plain, */*' \
-H 'lang: en' \
-H 'sec-ch-ua-platform: macOS' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Referer: https://www.foxesscloud.com/login?redirect=/' \
-H 'Accept-Language: en-US;q=0.9,en;q=0.8,de;q=0.7,nl;q=0.6' \
-H 'Connection: keep-alive' \
-H 'X-Requested-With: XMLHttpRequest' \
-H 'signature: 7e45eaaa5343cf62cee9c8bec3c0a113.5245784' \
-H 'timestamp: 1664016314077' \
-H 'token: TOKEN' \
-d @raw.json \
https://www.foxesscloud.com/c/v0/plant/history/raw
the raw.json
{
"stationID": "e85fa7c2-2f04-4b3a-a9bd-07423d940ca4",
"variables": [
"generationPower",
"feedinPower",
"loadsPower"
],
"timespan": "day",
"beginDate": {
"year": 2022,
"month": 9,
"day": 24,
"hour": 10,
"minute": 0,
"second": 0
}
}
@mhzawadi how did you calculate the signature ? To be precise I think I know how to calculate, but what data is used to generate the signature and how to get it :)
I didn't, I robbed it from my browser session.
I did have a look at some documents that are on other issues and couldn't work out how
Would you have the time and energy to briefly tell me how to do it :) ? I'm an embedded software enginner and lacking a bit of know-how in terms of web applications. I tried to find something in chrome console and the only thing I found was the signature.js, but couldn't find what I needed
sure, you login to the foxesscloud site. open the dev tools (option+command+i on a mac), click the network tab and reload the page. scroll down the list of loaded files till you see access
, click that and scroll to the bottom of the headers tab.
On a mac I can right click the signature and copy the value
Hope that helps you out
Thanks a lot I was able to find it, but still failing yet with fake requests. Will investigate further, thanks for the help :)
@bboguszewicz does this issue exist in the newest version v0.17?
Unluckily no, have a timeout on login page Timeout while fetching data: https://www.foxesscloud.com/c/v0/user/login
I have also checked on 0.18 and the issue is still in place for me. Just to let you know I have made a workaround by using two shelly 3em which gives me much more flexibility and granularity anyway, but of course if you would need any help with testing let me know :)
Hi all, from few days I am experiencing the problem where I can't reach login page. Here's the log output:
Could you help me understand what might be wrong here ? It was working correctly and then it just stopped. Thanks!