Unit state storage
Allows a Unit to store textual data directly in Pepeunit. This storage is well suited for the following categories of data:
- The last state of the Unit
- Cached user input data from Users
- Data that is large by microcontroller standards
DANGER
The size of this storage is limited by the size of encrypted objects on a Pepeunit instance.
Sending data to the storage
To set a value, follow this algorithm:
Compute the Unit
uuidbased on thePU_AUTH_TOKENJWT from env.json.Convert your value or data structure into a string.
Make a request. The
PU_HTTP_TYPEandPU_DOMAINvariables are available inside env.json:bashcurl -X 'POST' \ 'PU_HTTP_TYPE://PU_DOMAIN/pepeunit/api/v1/units/set_state_storage/{Unit.uuid}' \ -H 'accept: */*' \ -H 'Content-Type: application/json' \ -d '{ "state": "best_data_for_save_in_storage" }'
INFO
You can easily convert this curl request into an http request in any programming language—just pass a copy of it to an LLM.
Retrieving data from the storage
To retrieve a value, follow this algorithm:
- Compute the Unit
uuidbased on thePU_AUTH_TOKENJWT from env.json. - Make a request. The
PU_HTTP_TYPEandPU_DOMAINvariables are available inside env.json:PU_HTTP_TYPE://PU_DOMAIN/pepeunit/api/v1/units/get_state_storage/{Unit.uuid}
- Convert the string returned by Pepeunit into your data structure or value.