Feller-AG / wiser-api

MIT License
15 stars 1 forks source link

App connecting via Cloud only #35

Open PhilippImhof opened 1 week ago

PhilippImhof commented 1 week ago

Since the last update (2.0.4) the app suddenly started to connect via the Cloud only, meaning that most functions cannot be used anymore. I am able to connect via the µGateway interface, so there is no connection issue.

I have restarted the gateway using the REST API and also force-closed the app, deleted the cache and restarted it several times. What else can I do to reestablish the connection?

woodworm commented 1 week ago

Sorry about that 🙈! Something seems to have gone wrong during the migration. If you check the following URL 'http://<µGW-IP>/api/site' do you see the same entries as the example below, or is something missing on your end?

{
  "data": {
    "enduser_claimed": null,
    "date": null,
    "city": "Entenhausen",
    "address": "Blumenstrasse 13",
    "create_time": "2024-10-11T21:54:12",
    "type": 1,
    "name": "Donald Duck",
    "rooms_order": [
      2406,
      2407,
      2408,
      2409,
      2410,
      2411
    ],
    "floor": null,
    "installer_finalized": true,
    "postal_code": "8810"
  },
  "status": "success"
}
PhilippImhof commented 1 week ago

Thanks for your reply. This is what I get:

{
    "data": {
        "enduser_claimed": true,
        "date": "2021-10-19",
        "city": "xxx",
        "address": "xxx",
        "create_time": "2021-10-19T12:38:26",
        "type": 1
        "name": "Imhof",
        "rooms_order": [
            31,
            32,
            33,
            34,
            35,
            36
        ],
        "floor": null,
        "installer_finalized": true,
        "postal_code": "xxx",
        "automatedVacation": false,
        "guest_secret": "xxx",
    },
    "status": "success"
}
woodworm commented 1 week ago

Okay, that looks good and doesn't seem to be the issue. I once had a case where this was the problem when something went wrong in this area.

Have you deleted the "Anlage" from the APP and then added it again? You shouldn't lose anything because everything is stored on the µGW. By doing this, the APP refers a new secret (token). It’s possible that the token is stored incorrectly in the APP.

PhilippImhof commented 1 week ago

Strange enough: I tried to tcpdump the traffic to check for a wrong token or something similar. On Android, this can be done by redirecting the traffic through a VPN. When the VPN was active, the connection worked fine.

I then noticed that suddenly the name of my home has been changed to "singleFamilyHome" or something similar. So I decided to re-add the installation, without prior deletion, because I did not want to lose the favourites etc. That solved it partially.

I can now connect to the gateway as long as I am using the same access point as the gateway itself. If I go upstairs and connect to another access point, the connection still drops sometimes.

woodworm commented 1 week ago

Thank you for sharing your insights with us.

Are your access points connected to multiple cascaded switches?

PhilippImhof commented 1 week ago

No, they are both connected to the same switch and the network does not have separate segments or VLANs.

kinnkler commented 1 week ago

Hello everyone, I also had this problem in the Wiser Home iOS app after the update. Since I reset the system anyway to restart with the Gateway 2, it fixed it for me. So it could well be due to the migration to the new app version. Otherwise, I only noticed the error with the color selection for the DALI dimmers in the new app, which I also wrote to you by email (@woodworm).

Have a nice weekend!

PhilippImhof commented 1 week ago

I have a suspicion, but I am not sure about it: AFAICS, the app connects and opens a persistent websocket connection. When I go upstairs, the network connection breaks and is re-established. Now probably the WS should be re-initialized, but the app does not realise that, because it did not register the change in connectivity while in the background.

It then tries to push stuff through the old WS channel and that obviously does not work.

woodworm commented 1 week ago

Actually, a WebSocket connection should be able to tolerate a brief network interruption... but it's true that the server (µGW) closes the connection after a certain time, and the client (app) needs to re-establish it. Do you have a µGWv1 or v2?

PhilippImhof commented 1 week ago

OK, thanks. I just noticed that if my notebook goes to sleep mode with an open wsdump session, I get a Connection reset by peer after waking up and sending something.

I have a µGWv1 with API 5.1 (v5.1.28)

woodworm commented 1 week ago

thank you very much for the info.... I will look into it

PhilippImhof commented 1 week ago

Thanks. I have another hint, that might help: if I block the connection to the cloud, the app connects to the gateway (status = green) immediately and I can switch loads normally.

As soon as I unblock access to the cloud, status becomes orange again and no connection is possible anymore.