- My goal is: To create a method of provisioning an ESP32 device in as close to automated fashion as possible. I am currently using a bash script for this approach. I want to set a custom device.id before registering the device on GCloud.
- My actions are: 1) Run:
mos config-set device.id=8C28AB79-4115-48D8-A6E1-82D7BFE7BCF22) Run:
mos wifi MY_SSID MY_PASS3) …GCloud config
- The result I see is: https://gist.github.com/goleksiak/01f685aadfbb9429a631493b4ccd6552
- My expectation & question is: If I run either of the 2 commands above individually, they work fine. It is only when both commands are run (in either order) do I get the same error. I assume the error on Line 37 is the problem but I don’t know why.
The error comes from here
wifi_sta_set_host_name fails because the
device.id which is used as hostname in the absence of
wifi.sta.dhcp_hostname has a length>32.
Many thanks @nliviu!! I ended up stripping the ‘-’ chars out of my UUID with:
dhcpHostname=$(echo "$deviceId" | sed -e 's/-//g') and setting that as the
wifi.sta.dhcp_hostname & it worked!
Well, it looks like running
mos license resets the
device.id so I’m thinking about just giving up on setting a custom
gcp.device to a custom uuid gets overwritten during
mos gcp-iot-setup too - oh well.