Persistent storage model or device?

Hey!

I just made to prototypes with two different devices. I’m configuring the devices with password and username to Auth0 via HTTP config call. Then i hold the settings in the persistent storage using server.save() and server.load(). But when I wanted to configure the next device with username and password, it already had the connection going, which is strange because i thought that persistent storage was attached to the devices and not models? This means that I need to create another model for same devices for different costumers? What have i missed? What is the structure of model/device of persistant memory?

Thanks, bobby :slight_smile:

Model = Agent Code + Device Code

Both device and agent have their own, separate server.save() persistent storage. Both reside within the server. The device has its nv table too, but that is wiped when the power is cut.

If you call server.save() in agent code, it doesn’t not save the info in a way that can be read with a server.load() on the device (or vice versa).

I get around this by having the agent handle persistence. When the device restarts, it immediately asks its agent for the settings it needs.

If each device needs unique data (and if each device goes to a different customer, it’s very likely they will) then you need to deal with that in the agent code that creates or requests identity info from Auth0, so you don’t get back the same identity every time.

Thanks for your reply. I’m aware that agent and device doesn’t share the same persistent storage. I’m using only the agents server.save()/load() for this particular setup.

For configuring a device, I made a HTTP handler on device_url?config, where you can send ID token, user and password to configure the device. So, I have 2 different devices with different device URL, and I’m sending a config request to one of them, which works totally fine. The user and password is then saved from the agent to persistent memory. But it seems like the other device can read that table, and also get configured to the same user. How would you “deal” with that in the agent code? And is it true that persistent memory using server.save() on the agent is shared across devices(read agents) assigned to a model?

Sure you didn’t send it to both? The agent-local storage is local to a specific agent; there is no sharing amongst models.