Cannot make Azure IoT Hub work

159 views
Skip to first unread message

Tan Silliksaar

unread,
Jun 10, 2022, 5:13:12 AM6/10/22
to TasmotaUsers
I have a Sonoff S26 here.
I downloaded the latest Tasmota code and added this configuration:

#define USE_MQTT_TLS
#define USE_MQTT_AZURE_IOT
#define USE_MQTT_AZURE_DPS_SCOPEID  "..."
#define USE_MQTT_AZURE_DPS_PRESHAREDKEY "..."

It cannot connect to https://global.azure-devices-provisioning.net at all. When I try to make the same query from my computer, it works fine.

MQT: Starting Azure DPS registration...
MQT: Azure DPS REST assignment connection failed with code '-1'.  Restarting.

This is not a WiFi/networking problem as Web interface works and I tried MQTT with HiveMQ and it worked.

The documentation for Azure IoT on Tasmota gives an impression that it should work out of the box. https://tasmota.github.io/docs/Azure-IoT-Hub/#3-compile-your-binary-including-support-for-azure-iot-device-provisioning-service Well, it does not.

What am I missing? Thank you.

Philip Knowles

unread,
Jun 10, 2022, 5:36:02 AM6/10/22
to Tan Silliksaar, TasmotaUsers

Did you do this as well?

 

#ifndef USE_MQTT_TLS

#define USE_MQTT_TLS

#endif

 

Sent from Mail for Windows

 

From: Tan Silliksaar
Sent: 10 June 2022 10:13
To: TasmotaUsers
Subject: Cannot make Azure IoT Hub work

 

I have a Sonoff S26 here.

I downloaded the latest Tasmota code and added this configuration:

 

#define USE_MQTT_TLS
#define USE_MQTT_AZURE_IOT
#define USE_MQTT_AZURE_DPS_SCOPEID  "..."
#define USE_MQTT_AZURE_DPS_PRESHAREDKEY "..."

It cannot connect to https://global.azure-devices-provisioning.net at all. When I try to make the same query from my computer, it works fine.

 

MQT: Starting Azure DPS registration..

MQT: Azure DPS REST assignment connection failed with code '-1'.  Restarting.


This is not a WiFi/networking problem as Web interface works and I tried MQTT with HiveMQ and it worked.

 

The documentation for Azure IoT on Tasmota gives an impression that it should work out of the box. https://tasmota.github.io/docs/Azure-IoT-Hub/#3-compile-your-binary-including-support-for-azure-iot-device-provisioning-service Well, it does not.

 

What am I missing? Thank you.

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/b901d6f6-e35c-4a08-a538-f2c4e7ceaaa1n%40googlegroups.com.

 

Paul O'Brien

unread,
Nov 25, 2022, 3:26:50 AM11/25/22
to TasmotaUsers
I also am stuck in the same place.. im not sure if anyone else is using this successfully? would love to hear from someone if they are!

Philip Knowles

unread,
Nov 25, 2022, 8:10:49 AM11/25/22
to Paul O'Brien, TasmotaUsers

I would follow through this step by step and get it to connect without DPS first

Azure IoT Hub - Tasmota

 

Sent from Mail for Windows

 

Paul O'Brien

unread,
Nov 25, 2022, 4:29:55 PM11/25/22
to Philip Knowles, TasmotaUsers
I’ve this morning recompiled with out dps scope and key (like it suggests for IOT hub without DPS)

I have a device defined in IOT central and it’s deviceid scopeid and key.

I used azure IOT central connection string tool to get the IOT central’s backend hub (as my understanding is azure dps service generally provides the Mqtts url? And IOT central sets up its own hub you don’t see in azure.

Now I get TLS connection error: 0 in tasmota.

Connect failed to …….azure-devices.net:8883, rc -2



Kind regards,

Paul O'Brien

On 26/11/2022, at 2:10 AM, Philip Knowles <knowles...@gmail.com> wrote:



Philip Knowles

unread,
Nov 25, 2022, 5:22:02 PM11/25/22
to Paul O'Brien, TasmotaUsers

What does the MQTT configuration page look like?

Philip Knowles

unread,
Nov 26, 2022, 2:49:16 PM11/26/22
to Paul O'Brien, TasmotaUsers

I’ve tried the same and got the same error. TLS connection error: 0 apparently means that it has connected successfully (unhelpful) so the issue is the MQTT rc:-2 (which is failing to make a network connection to the broker). I’ve tried to increase the MQTT Timeout but that made no difference. Someone may know what’s going on.

 

Sent from Mail for Windows

 

From: Paul O'Brien
Sent: 25 November 2022 21:29
To: Philip Knowles

Paul O'Brien

unread,
Nov 26, 2022, 4:10:20 PM11/26/22
to Philip Knowles, TasmotaUsers

as per the recommendations in this article - AZURE: WiFiClientSecureLightBearSSL: _wait_for_handshake: failed · Issue #14624 · arendst/Tasmota (github.com)

I can confirm if I create an IOTHub in the US Central region where I can turn on the preview function, upload custom firmware with just MQTTS and IOTHub options defined, setoption 132 1, then I get a connection to IOTHub..
I can confirm this doesn work if you use an IOT Hub without the new preview features turned on

now if anyone knows how to make this all work with IOT Central !!! :)  there doesnt seem to be any way in Azure to define the backend IOT Hub or its settings etc..

01:06:09.646 MQT: Attempting connection...
01:06:09.715 MQT: Authenticating with an Azure IoT Hub Token
01:06:12.013 MQT: TLS connected in 2297 ms, stack low mark 1140
01:06:12.015 MQT: Fingerprint learned: A6 B9 F5 E9 2D 5E 10 CE FA F4 43 DF 05 64 A2 98 64 50 CD 89
01:06:12.450 MQT: Connected

mohan

unread,
Nov 26, 2022, 9:13:29 PM11/26/22
to Philip Knowles, Paul O'Brien, TasmotaUsers
We were able a remedy a similar  issue (no TLS though) with the MQTT rc:-2 (failing to make a network connection to the broker) by increasing the MQTT Timeout to 5000 ms. We started connecting at 2000 ms but decided to bump it up to 5000 factoring lower internet speeds during peak hours.

Wish you good luck!
mohan 


Reply all
Reply to author
Forward
0 new messages