Error while binding using zerynth toolchain


#1

I’m trying to do the steps to configure a device on zerynth using AWS Greengrass as broker, using this video below as reference

But when I put this command:" ztc aws add-things project_path --things-number 10 --things-base-name production_thing "

I always receive this error:

File “C:\Users\mathe\zerynth2\dist\r2.1.0\ztc\ztc.py”, line 111, in
cli()
File “C:\Users\mathe\zerynth2\sys\python\lib\site-packages\click\core.py”, line 716, in call
return self.main(*args, **kwargs)
File “C:\Users\mathe\zerynth2\sys\python\lib\site-packages\click\core.py”, line 696, in main
rv = self.invoke(ctx)
File “C:\Users\mathe\zerynth2\sys\python\lib\site-packages\click\core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “C:\Users\mathe\zerynth2\sys\python\lib\site-packages\click\core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “C:\Users\mathe\zerynth2\sys\python\lib\site-packages\click\core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “C:\Users\mathe\zerynth2\sys\python\lib\site-packages\click\core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “C:\Users\mathe\zerynth2\dist\r2.1.0\ztc\aws\awscmd.py”, line 189, in __add_things
thing.create_with_keys_and_certificate()
File “C:\Users\mathe\zerynth2\dist\r2.1.0\ztc\aws\awsthing.py”, line 23, in create_with_keys_and_certificate
data = self.awscli.create_keys_and_certificate()
File “C:\Users\mathe\zerynth2\dist\r2.1.0\ztc\aws\awscli.py”, line 22, in create_keys_and_certificate
return json.loads(out)
File "C:\Users\mathe\zerynth2\sys\python\lib\json_init
.py", line 319, in loads
return _default_decoder.decode(s)
File “C:\Users\mathe\zerynth2\sys\python\lib\json\decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “C:\Users\mathe\zerynth2\sys\python\lib\json\decoder.py”, line 357, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I have no idea about how i can solve this, neither why this happen. So, I’ll thank a lot if you guys could help me with this issue.


#2

Hi @Matheus,

this happens due to an error in parsing the JSON response from AWS, have you correctly configured the AWS Command Line Interface setting both the right account and region?

Let me know :slight_smile:


#3

Hi @LorenzoR, thank you for you answer, I tried what you recommended me and finally worked well. I don’t know why, but my device doesn’t work well beyond the message: “connecting to mqtt server…”. I’m using AWS IoT example, using the exactly same steps from the video that i mencionated above (video made by the own zerynth), I could compile and upload to the device, but it doesn’t connect to AWS server. Do you know what problem it can be?


#4

Hi @Matheus,

it could be a policy issue or a wrong endpoint, could you check the policy name and endpoint value you placed in the thing.conf.json configuration file? For the policy be sure to have it correctly defined in your policyhub (AWS IoT->Secure->Policies).

Thank you and let me know :slight_smile:


#5

@LorenzoR, i tried your advice, but happen the same. I followed all the steps of the video, but i’m still stuck on this part. I don’t know if it changes something, but i’m using an esp8266 as device, instead of esp32 (I changed the line of code “import wifi support”, to works on my device).


#6

Hi @Matheus,

unfortunately connecting to the AWS IoT MQTT broken with TLS is currently not supported on ESP8266 based boards, although it may be added in a future release, I suggest you to try following the tutorial with a more performant ESP32 based board :slight_smile:


#7

I didn’t know about this compability, it’s a pity it doesn’t support esp8266 based boards… So, my next step will test this with an esp32, and I hope it’ll work this time. Anyway, thank you @LorenzoR for all. My doubt is solved, the topic can be closed now.


#8

I was facing the same problem and after digging into it, i got the solution. My AWS CLI was not configured properly. I have set output value to “TEXT” instead of “JSON”.

So please set output value to “json” , while configuring the aws cli