IoT Demo device will not activate/connect to iot.espressif.com device

franchetto
Posts: 1
Joined: Sat Mar 03, 2018 7:58 am

IoT Demo device will not activate/connect to iot.espressif.com device

Postby franchetto » Sat Mar 03, 2018 8:32 am

I have a esp8266mod up and working. I built the IoT Demo (the light device) and worked through a lot of issues that seem now solved. I created the device my_light_iot at the iot.espressif.com cloud and downloaded the master key which was flashed to the appropriate address on the device. Everything works fine until I set the station mode. The device always receives a "internal server error" after the activate command.

Code: Select all

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 29188, room 16
tail 4
chksum 0x3e
load 0x3ffe8000, len 2928, room 4
tail 12
chksum 0x2c
ho 0 tail 12 room 4
load 0x3ffe8b70, len 3832, room 12
tail 12
chksum 0x86
csum 0x86
rf cal sector: 1019
freq trace enable 0
rf[112] : 00
rf[113] : 00
rf[114] : 01
w_flash

SDK ver: 2.1.0(116b762) compiled @ May  5 2017 16:08:55
phy ver: 1134_0, pp ver: 10.2

SDK version:2.1.0(116b762)
IOT VERSION = v1.0.5t45772(a)
reset reason: 6
LIGHT PARAM: R: -1
LIGHT PARAM: G: -1
LIGHT PARAM: B: -1
LIGHT PARAM: CW: -1
LIGHT PARAM: WW: -1
LIGHT PARAM: P: 1000
malloc:1
prd:1000  r : 22222  g: 22222  b: 22222  cw: 22222  ww: 22222
free:0
PWM version : 00000003
mode : sta(ec:fa:bc:12:4a:ca) + softAP(ee:fa:bc:12:4a:ca)
add if0
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
finish
add 1
aid 1
station: 00:04:4b:79:7b:f4 join, AID = 1
len:299
A_dat:152,tot:152,lenght:152
We have a POST request.
copied token to esp_param and saved in flash memory
webserver's 192.168.4.2:43710 disconnect
scandone
switch to channel 10
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 6
cnt

connected with AtHome, channel 10
dhcp client start...
ip:192.168.0.146,mask:255.255.255.0,gw:192.168.0.1
host_name = espressif_light_demo
server_name = _espLight._tcp.local
user_esp_platform_dns_found 115.29.202.58
user_esp_platform_connect
user_esp_platform_connect_cb
station: 00:04:4b:79:7b:f4 leave, AID = 1
rm 1
bcn 0
del if1
pm open,type:2 0
mode : sta(ec:fa:bc:12:4a:ca)
{"nonce": 664128725,"path": "/v1/device/activate/", "method": "POST", "body": {"encrypt_method": "PLAIN", "token": "1fb59f9fa88d23c38157c0dccff11934b24e4e20", "bssid": "ec:fa:bc:12:4a:ca","rom_version":"v1.0.5t45772(a)"}, "meta": {"Authorization": "token 856b9375b02934fb56def0e6f5066de6e304f193"}}

user_esp_platform_sent_cb
user_esp_platform_recv_cb {"status": 500, "message": "internal server error"}

please check device is activated.
{"nonce": 1195372557,"path": "/v1/device/activate/", "method": "POST", "body": {"encrypt_method": "PLAIN", "token": "1fb59f9fa88d23c38157c0dccff11934b24e4e20", "bssid": "ec:fa:bc:12:4a:ca","rom_version":"v1.0.5t45772(a)"}, "meta": {"Authorization": "token 856b9375b02934fb56def0e6f5066de6e304f193"}}

user_esp_platform_sent_cb
user_esp_platform_recv_cb {"status": 500, "message": "internal server error"}


The unit then cycles this command continuously returning the same error. In the above I can confirm that the master key is correct.
Separately I sent from a client a curl command to activate the device my_light_iot to make sure it can be activated.

Code: Select all

curl -X POST -H "Authorization: token 856b9375b02934fb56def0e6f5066de6e304f193" -d '{"encrypt_method":"PLAIN", "bssid":"ec:fa:bc:12:4a:ca","token":"1fb59f9fa88d23c38157c0dccff11934b24e4e20"}' https://iot.espressif.com/v1/device/activate/
{"device": {"id": 13755, "created": "2018-03-01T08:17:11Z", "updated": "2018-03-02T19:19:32Z", "visibly": 1, "ptype": 45772, "product_id": 278, "productbatch_id": 0, "name": "my_light_iot", "description": "", "serial": "e4f6bd78", "bssid": "ec:fa:bc:12:4a:ca", "is_private": 0, "is_frozen": 0, "status": 1, "metadata": "", "key_id": 71682, "location": "", "last_push": "0001-01-01T00:00:00Z", "last_pull": "0001-01-01T00:00:00Z", "last_active": "0001-01-01T00:00:00Z", "last_activated_at": "2018-03-02T19:19:32Z", "activate_status": 1, "activated_at": "2018-03-02T19:19:32Z", "rom_version": "", "latest_rom_version": ""}, "key": {"id": 71682, "created": "2018-03-01T08:17:11Z", "updated": "2018-03-01T08:17:11Z", "visibly": 1, "authorized_user_id": 0, "name": "master", "scope": 3, "user_id": 58717, "product_id": 0, "device_id": 13755, "datastream_tmpl_id": 0, "datastream_id": 0, "access_methods": "*", "source_ip": "*", "token": "856b9375b02934fb56def0e6f5066de6e304f193", "level": 0, "is_master_key": 1, "is_owner_key": 0, "activate_status": 1, "expired_at": "2118-02-05T00:17:13Z"}, "status": 200, "token": {"id": 108181, "created": "2018-03-02T19:19:32Z", "updated": "2018-03-02T19:19:32Z", "visibly": 1, "name": "owner shared", "scope": 3, "user_id": 58717, "product_id": 0, "device_id": 13755, "datastream_tmpl_id": 0, "datastream_id": 0, "access_methods": "*", "source_ip": "*", "token": "1fb59f9fa88d23c38157c0dccff11934b24e4e20", "is_owner_key": 1, "activate_status": 1, "expired_at": "2118-02-06T19:19:32Z", "generated_at": "0001-01-01T00:00:00Z", "token_expired_at": "2018-03-02T19:29:32Z", "delete_after_used": 0, "revoke_prekeys_if_ownerkey": 1}}

The activation was successful and I confirmed the activation by visiting the device at my account at iot.espressif.com. I have run out of ideas on what the problem is. Any help will be appreciated.

jamesleo607

Re: IoT Demo device will not activate/connect to iot.espressif.com device

Postby jamesleo607 » Fri Nov 09, 2018 4:03 pm

When I use curl to active my device, the server return an error:
{"message": "devicekey not exists", "status": 500}
What's the devicekey? token = device secret? or master device key ?

Thanks

Her Mary
Posts: 537
Joined: Mon Oct 27, 2014 11:09 am

Re: IoT Demo device will not activate/connect to iot.espressif.com device

Postby Her Mary » Tue Feb 26, 2019 5:45 pm


Who is online

Users browsing this forum: No registered users and 3 guests