Reputation: 464
In user_config_override.h: #define USE_MQTT_AWS_IOT_LIGHT
Always get this error:
03:53:25 MQT: Connect failed to dq5l0h2crqi8-ats.iot.eu-west-1.amazonaws.com:443, rc -4. Retry in 100 sec
I tried to use 1883 and port 8883 instead of 443. I double checked my login/password from AWS CloudFormation (used TasmotaAuth template), no luck.
Anyone successfully connected to AWS ?
Upvotes: 0
Views: 769
Reputation: 1259
I got similar error, and Tasmota could never connect to AWS. Everybody was referring to this page: https://github.com/arendst/Sonoff-Tasmota/wiki/AWS-IoT But there is no such page. The URL had moved to its new location: https://tasmota.github.io/docs/AWS-IoT/
Finally I found that the CloudFormation yaml was incomplete. The AWS console generated TasmotaAuth/Outputs/BackLogCommand was:
BackLog MqttHost xxxxx-ats.iot.us-east-2.amazonaws.com; MqttPort 443; MqttUser tasmota?x-amz-customauthorizer-name=TasmotaAuth; MqttPassword xxxxxxx
It should have included the following to additional options:
SetOption3 1; SetOption103 1;
Probably these were there in an earlier version, but are now missing, as of August 2021.
SetOption103 defaults to false
, so my TLS was disabled:
#define MQTT_TLS_ENABLED false // [SetOption103] Enable TLS mode (requires TLS version)
When I manually issued the command
SetOption103 1
on the Tasmota web console, messages started flowing to AWS.
Either the CloudFormation script need to be changed, or the documentation should be corrected as follows:
Add the following to user_config_override.h:
#ifndef USE_MQTT_TLS
#define USE_MQTT_TLS
#define USE_MQTT_TLS_CA_CERT // Optional but highly recommended
#endif
#ifndef USE_MQTT_AWS_IOT_LIGHT
#define USE_MQTT_AWS_IOT_LIGHT
#endif
#ifdef USE_DISCOVERY
#undef USE_DISCOVERY
#endif
#undef MQTT_TLS_ENABLED
#define MQTT_TLS_ENABLED true
Upvotes: 0
Reputation: 464
I thought defining only this was enough for login/password auth:
#define USE_MQTT_AWS_IOT_LIGHT
While I needed this whole:
#ifndef USE_MQTT_TLS
#define USE_MQTT_TLS
#define USE_MQTT_TLS_CA_CERT // Optional but highly recommended
#endif
#ifndef USE_MQTT_AWS_IOT_LIGHT
#define USE_MQTT_AWS_IOT_LIGHT
#endif
#ifdef USE_DISCOVERY
#undef USE_DISCOVERY
#endif
(in user_config_ovverride.h)
Upvotes: 0