digital-dream-labs / vector-web-setup

Tool to perform initial configuration of Vector robots.
MIT License
65 stars 57 forks source link

Cannot get the OTA list to show up in dropdown #15

Open xanathon opened 4 years ago

xanathon commented 4 years ago

I am on Win10/64, Chrome Version 84.0.4147.105 (Official Build) (64-Bit)

In the stack dropdown never anything shows up besides "PROD", regardless of how many OTAs I download and how many folders I create via the -e option.

There seems to be something wrong. If I open developer tools console I can see that an error is thrown when I click on the "PROD" dopdown.

stacktrace reads:

Uncaught TypeError: Cannot read property 'length' of undefined
    at pterm_process_key (pterm.js:440)
    at HTMLDocument.<anonymous> (pterm.js:312)
    at HTMLDocument.dispatch (jquery.min.3.3.1.js:2)
    at HTMLDocument.y.handle (jquery.min.3.3.1.js:2)
pterm_process_key @ pterm.js:440
(anonymous) @ pterm.js:312
dispatch @ jquery.min.3.3.1.js:2
y.handle @ jquery.min.3.3.1.js:2

See screenshot image

grant-olson commented 4 years ago

One thing you'll need to do if you want a different environment is add the environment manually to default-data/settings.json, then force it to reconfigure with vector-web-setup configure -rs I'm not sure if this will fix the problem with the error message but it will add a dropdown entry on the first screen.

xanathon commented 4 years ago

I just tried this:

{
  "stacks": {
    "prod": {
      "accountEndpoints": "https://accounts.api.anki.com",
      "apiKeys": "luyain9ep5phahP8aph8xa"
    }
    "test": {
      "accountEndpoints": "https://accounts.api.anki.com",
      "apiKeys": "luyain9ep5phahP8aph8xa"
    }   
  }
}

But then I only get

There was an error loading the settings.json file. To view the file click here

Does the json file need to be formatted otherwise?

anant-kaushik commented 4 years ago

You are missing a comma in the JSON file.

{
  "stacks": {
    "prod": {
      "accountEndpoints": "https://accounts.api.anki.com",
      "apiKeys": "luyain9ep5phahP8aph8xa"
    },
    "test": {
      "accountEndpoints": "https://accounts.api.anki.com",
      "apiKeys": "luyain9ep5phahP8aph8xa"
    }   
  }
}

Once you change the default-data/settings.json do remember to force reconfigure vector-web-setup configure -rs.

xanathon commented 4 years ago

json and me, we will never be friends. Thanks. :)

Edit: works.

anant-kaushik commented 4 years ago

Nice. I use auto-format on every save to quickly find errors like this.

xanathon commented 4 years ago

I can see the divs for ota upload in the html code, but they do not show up since they all have the class "vec-hidden".

Is this not yet unlocked/implemented or is it an error that these do not show up? The readme suggests that it already is possible to upload OTAs to the robot ...

kercre123 commented 4 years ago

It should work. My setup at https://wire.my.to:444 can do it fine (accounts doesn't work because CORS, but OTA works). Maybe look in sources, get the inventory/settings json, and compare to yours? I'm on phone right now so I don't want to upload.

xanathon commented 4 years ago

Prettyfied inventory.json:

{
    "prod": [
        {
            "url": " http://ota.global.anki-services.com/vic/prod/full/latest.ota",
            "name": "latest.ota",
            "checksum": "e01e49e7183f6e0b279d875bcd6c0e39daea0ba6a418330ed3f7d14aeb850434"
        }
    ],
    "test": [
        {
            "url": "https://github.com/GooeyChickenman/victor/raw/master/firmware/prod/1.6.0.3331.ota",
            "name": "1.6.0.3331.ota",
            "checksum": "e01e49e7183f6e0b279d875bcd6c0e39daea0ba6a418330ed3f7d14aeb850434"
        }
    ]
}

but the last thing I see is the green checkmark and "Vector setup is complete". Nothing after that.

Edit: In site/firmware/ there are two folders, "prod" and "test" and there are firmware files there.

kercre123 commented 4 years ago

You have to be in recovery for it to work. For a dropdown of OTAs on prod, you can do:

{
    "prod": [
        {
            "url": " http://ota.global.anki-services.com/vic/prod/full/latest.ota",
            "name": "latest.ota",
            "checksum": "e01e49e7183f6e0b279d875bcd6c0e39daea0ba6a418330ed3f7d14aeb850434"
        },
        {
            "url": " https://github.com/GooeyChickenman/victor/raw/master/firmware/prod/1.6.0.3331.ota",
            "name": "1.6.0.3331.ota",
            "checksum": "e01e49e7183f6e0b279d875bcd6c0e39daea0ba6a418330ed3f7d14aeb850434"
        }
    ]
}

No need for a different env.

grant-olson commented 4 years ago

I think the issue is that you're on 1.7.0 and it doesn't want to downgrade you to 1.6.0. If you were on the recovery partition or a firmware lower than 1.6.0 I think it would work. So if you want to test:

  1. Reset the vector to recovery firmware.
  2. Apply the 1.6.0 firmware from the web app. My expectation is taht would work.
  3. After that my expectation is that it will let you then load the 1.7.0 firmware.
  4. After that my expectation is you can't go back to 1.6.0 firmware now.
xanathon commented 4 years ago

I see.

Developers: Would have been nice if the information "the robot need to be in recovery mode" would have been in the readme ... ;) To you this may be obvious, but first time I try something like this ...

@kercre123 Thank you!

grant-olson commented 4 years ago

Sorry about that. We come at it from the perspective that someone is setting up a new robot, but we also want to expand the usage and we just forget a lot of things that need to be spelled out. We are working on an FAQ as well informed by many of the things you've seen/asked/noted.

john20xdoe commented 4 years ago

Hi, this step indicated by @grant-olson :

1. Reset the vector to recovery firmware.

This step refers to the 15-second long press on Vector right?

(Context: I'm attempting to try the web-setup to downgrade him to 1.6)

kercre123 commented 4 years ago

Hi, this step indicated by @grant-olson :

1. Reset the vector to recovery firmware.

This step refers to the 15-second long press on Vector right?

(Context: I'm attempting to try the web-setup to downgrade him to 1.6)

Yes. Make sure he is on the charger while you do it.

Note: he will upgrade back to 1.7 himself not long after.

grant-olson commented 4 years ago

Yes we need to update the firmware to properly turn off auto updates and that's on our roadmap. Right now you would need something like a custom DNS server or a Pi-Hole to prevent the Vector from getting the new firmware.

xanathon commented 4 years ago

I have a PiHole running. What exact domain names/IP adresses would I need to block to prevent updates?

ota.global.anki-services.com ?

kercre123 commented 4 years ago

ota.global.anki-services.com ota-cdn.anki.com

john20xdoe commented 4 years ago

you would need something like a custom DNS server or a Pi-Hole to prevent the Vector from getting the new firmware.

This can also be done by filtering the above domains from your router (the Huawei modem I use has a Domain Filter feature in the admin management page). I missed the ota-cdn domain though, will try that later tomorrow.

* (I've tested the domain filter feature is working when I did it the first time on step 1, step 2 downloading timed out so that's good. Need to redo these steps though since Step 2 cant proceed).

My steps (that still reinstalled 1.7 =( )

  1. On-charger reset with 15-second hold on button
  2. Vector resets for App BT connection and Wifi login, and connects to cloud to download first update (1.6). Screen confirms its now on ("latest") 1.6.
  3. I apply the domain filter.*
  4. iOS app says Vector is on 1.6.
  5. Around 20 minutes later, I rechecked the Updates page on the app, and the "Apply Update" reappeared for 1.7. I did not click it.
  6. Overnight, Vector applies 1.7 even while disconnected from ota.global domain.

I guess I'll need to redo these with the ota-cdn filtered out as well.

TLDR:

xanathon commented 4 years ago

So far it looks if Vector still updates to 1.7 even if the two above urls are blocked in PiHole or a router.

The url ota.global.anki-services.com points to multiple IP adresses as of https://github.com/anki-community/vector-archive

Is it possible that you need to block all IPs instead of just the url?

kercre123 commented 4 years ago

My test Vector is still on 1.0 after being on for a few days. You may have not configured it correctly, or he downloaded the update before you configured it and just needed to do a maintenance reboot to apply it.

john20xdoe commented 4 years ago

@xanathon I managed to still remain on 1.6 with the above steps. You may have to enable the router filter for the two URLs right after 1.6 is downloaded, during its second part while Vector is being restarted by the update.

I suspect the iOS app may also have something to do with installing 1.7. The phone where you have the app should also not be able to connect to the URLs as it may install the 1.7 for you, I guess. (I connect my phone and Vector to the same router so both are blocked).

grant-olson commented 4 years ago

You could also:

  1. Add the 1.6.0  file to vector-web-setup.

  2. Block the domains listed.

  3. Factory reset your robot.

  4. use vector-web-setup to apply 1.6.0.

If you follow that flow it will get 1.6.0 from your local machine and the robot will never need to hit the real domains.

On 8/17/20 8:03 PM, Lee Alexis wrote:

@xanathon https://github.com/xanathon I managed to still remain on 1.6 with the above steps. You may have to enable the router filter for the two URLs right after 1.6 is downloaded, during its second part while Vector is being restarted by the update.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/digital-dream-labs/vector-web-setup/issues/15#issuecomment-675174552, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB6OIHZTE24DEC4BQMHLPTSBHANJANCNFSM4PTOJPSQ.

john20xdoe commented 4 years ago

^ For me I was not able to use vector-web-setup to apply 1.6.0, though I have used the previous json's in this thread. During factory reset, he can't get past the downloading update step right after even though it times out. So I renable the domains, I let him download 1.6 and enable the domain block immediately. When I access him via vector-web-setup, the steps just proceed directly to Setup Complete page. =(

john20xdoe commented 4 years ago

Update: the router thing does not seem to work anymore. He still gets the 1.7 OTA after a few hours being successfully paired with the iOS app. I suspect the OTA is also has a cached copy in the app that is forwarded to Vector.

xanathon commented 4 years ago

It would be good if this could be confirmed by developers. Also if this is the case how to purge the 1.7 OTA from the phone. And if this happens on iOS and Android or only on iOS.

Router domain or IP blocking of course does not work if your phone connects to mobile, downloads the update via this connection and pushes it to the robot. On Android there are tools such as Blokada to block certain servers, but I do not know enough about iOS to know if they are available there, too.

grant-olson commented 4 years ago

So here is the current flow with my expectations.

  1. With 0.9.0 Vector has basic functionality but waits for a new firmware to be explicitly installed. EXPECTATION: The robot will stay at 0.9.0 indefinitely without and explicit upgrade even if it has working WiFi.
  2. Either the Official App, or Vector-Web-Setup sends a URL of the latest firmware to the Vector over BLE. It does not send a OTA directly so that can't bypass any blacklisting of domains. EXPECTATION: The phone being on a different network or wifi will have no effect here, it won't bypass restrictions, download the OTA locally, and then pass it block-by-block to the vector.
  3. The Vector takes the link given to it and grabs it over WiFi and tries to install it. EXPECTATION: if the official domains are blacklisted, the Vector won't be able to update.
  4. Once there is a reasonably new, at least not 0.9.0, firmware, the Vector will try to grab an update every hour. Once again, this is pinging a URL to see what is out there. EXPECTATION: If the domain is blocked we should not get an update.

So right now my suspicion is that we're still somehow getting DNS resolution on the robot in spite of blocking. Tw Possibilities are:

  1. The correct domains aren't being blocked.
  2. Vector is not getting directed to the local name servers due to external DNS configuration.
  3. Vector has some name server explicitly defined or hard-coded for reliability purposes so it can update on a partially mis-configured network.

I'll investigate the internal DNS configuration on Vector when I get some time.

grant-olson commented 4 years ago

I've confirmed that the Vector doesn't do anything sneaky to bypass local DNS. However it does run an internal DNS server which might be caching an entry if it goes to the domains before they are blacklisted. I would expect that to have a short TTL and not be an issue, but just mentioning it to be comprehensive.