# Gatewayn liittäminen Azure IoT Hubiin

**URL:** <https://f.ruuvi.com/t/gatewayn-liittaminen-azure-iot-hubiin/5447>\
**Category:** 🇫🇮 Ruuvi Gateway -reititin\
**Created:** [20 February 2022 17:03 UTC](https://f.ruuvi.com/t/gatewayn-liittaminen-azure-iot-hubiin/5447 "2022-02-20T17:03:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![huikkis](https://f.ruuvi.com/user_avatar/f.ruuvi.com/huikkis/32/2793_2.png) [@huikkis](https://f.ruuvi.com/u/huikkis)\
**Post date:** [20 February 2022 17:03 UTC](https://f.ruuvi.com/t/gatewayn-liittaminen-azure-iot-hubiin/5447/1 "2022-02-20T17:03:10Z")

</div>

Tarkoitukseni on liittää gateway Azure IoT Hubiin MQTT yhteydellä. Olen lukenut ohjeita ([Understand Azure IoT Hub MQTT support | Microsoft Docs](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-mqtt-support#using-the-mqtt-protocol-directly-as-a-device)), joiden mukaan täytin MQTT-tiedot. Salasanan loin Visual Studio Coden avulla (SharedAccessSignature).  
En kuitenkaan saa yhteyttä toimimaan IoT Hubiin.  
Osaisiko joku kertoa miten kyseiset tiedot kuuluu laittaa ja mikä meni pieleen?

 ![RuuviGateway](https://f.ruuvi.com/uploads/default/original/2X/7/7aefa37aabc294ae05d349d06f25bf27cbee666a.png)

---

<div class="post-metadata">

**Author:** ![dgerman](https://f.ruuvi.com/user_avatar/f.ruuvi.com/dgerman/32/154_2.png) [@dgerman](https://f.ruuvi.com/u/dgerman)\
**Post date:** [24 February 2022 13:01 UTC](https://f.ruuvi.com/t/gatewayn-liittaminen-azure-iot-hubiin/5447/2 "2022-02-24T13:01:05Z")

</div>

Google translates as: My intention is to connect the gateway to the Azure IoT Hub via MQTT. I have read the instructions (Understand Azure IoT Hub MQTT support | Microsoft Docs) to complete the MQTT information. I created the password using the Visual Studio Code (SharedAccessSignature).  
However, I am not allowed to connect to the IoT Hub.  
Can anyone tell me how that information should be put and what went wrong?

---

<div class="post-metadata">

**Author:** ![VilleT](https://f.ruuvi.com/letter_avatar_proxy/v4/letter/v/ecccb3/32.png) [@VilleT](https://f.ruuvi.com/u/VilleT)\
**Post date:** [5 March 2022 16:57 UTC](https://f.ruuvi.com/t/gatewayn-liittaminen-azure-iot-hubiin/5447/3 "2022-03-05T16:57:14Z")

</div>

Olen itse tuskaillut saman asian kanssa jo monta päivää.

Löysin ainakin nämä langat aiheesta:

> [@Ruuvi Gateway and Azure IoT Hub connection with MQTT](https://f.ruuvi.com/t/ruuvi-gateway-and-azure-iot-hub-connection-with-mqtt/5093):
>
> Hi, has anyone connected Ruuvi Gateway to Azure IoT hub using MQTT? I followed instructions ([Understand Azure IoT Hub MQTT support | Microsoft Docs](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-mqtt-support)) “Using the MQTT protocol directly (as a device)” but with no data streaming to Azure. Is it even possible to get connection working or do I just have incorrect parameters?

> [@MQTT connection problems](https://f.ruuvi.com/t/mqtt-connection-problems/5339/5):
>
> Hi, I don’t have virtual server, I’m using Azure IoT Hub that accepts direct MQTT connections from Ruuvi Gateway. I think the Ruuvi Gateway is not the problem but because there is no logging for MQTT, I’m not able to see why messages are not received at the Azure end. Could it be possible to include MQTT logging similarly than HTTP logging is implemented at the moment?

> [@V1.10.0 Failed to set client configurations](https://f.ruuvi.com/t/v1-10-0-failed-to-set-client-configurations/5388/8):
>
> Just tested v1.11.2 and TSL error still exists. E (23793) MQTT\_CLIENT: Certificate bundle feature is not available in IDF version v4.2.2 E (23852) esp-tls-mbedtls: No server verification option set in esp\_tls\_cfg\_t structure. Check esp\_tls API reference E (23853) esp-tls-mbedtls: Failed to set client configurations E (23859) esp-tls: create\_ssl\_handle failed E (23866) esp-tls: Failed to open new connection E (23869) TRANS\_SSL: Failed to open a new connection E (23875) MQTT\_CLIENT: Error t…

Minulla on varmasti toimivat fieldit Server, Port, User name, Password ja Client name kenttiin, testasin siis erillisellä MQTT clientillä ja saan datan lähetettyä Azure IoT Hubiin ikään kuin laitteena.

Sinulla esim. Server field on väärin, siellä pitäisi olla lopussa vielä /device/?api-version=2018-06-30 (huom EI sinun deviceid, vaan oikeasti kirjaimellisesti “device”)

username ja password varmaan oikein.

Topic on väärin, IoT Hub ei tykkää jos dataa ei lähetetä oikealla topicilla:

devices/{device\_id}/messages/events/

custom prefixillä saa tuon. Itse laitan vielä “mac=” loppuun.

Itse juuri nyt downgradesin v1.11.1 firmwareen, koska kuulemma oli ongelmia v1.11.2. Silti en saa toimimaan. Logejakaan en saa mistään irti.

---

<div class="post-metadata">

**Author:** ![huikkis](https://f.ruuvi.com/user_avatar/f.ruuvi.com/huikkis/32/2793_2.png) [@huikkis](https://f.ruuvi.com/u/huikkis)\
**Post date:** [7 March 2022 15:58 UTC](https://f.ruuvi.com/t/gatewayn-liittaminen-azure-iot-hubiin/5447/4 "2022-03-07T15:58:17Z")

</div>

Kiitos vinkeistä!  
Sain tuon yhteyden muodostettua näillä tiedoilla ja v1.11.1 firmwarella.

 ![RuuviGateway](https://f.ruuvi.com/uploads/default/original/2X/e/e7065b357f27bfab0624de6b838c86719e56d104.png)

Vaikuttaisi kuitenkin siltä, että itse gateway lähettää kyllä tietojaan IoT Hubiin mutta varsinaiset mittaustiedot jäävät puuttumaan. Nuo mac osoitteet ovat siis tagien osoitteita. Kokeilin myös ilman niitä samalla lopputuloksella.

Tässä vielä kuva Visual Studio Codesta.

 ![Visual Studio](https://f.ruuvi.com/uploads/default/original/2X/2/2a796240919073334dbb4d6726ff0fe24db45db0.png)

Hyviä vinkkejä ja ehdotuksia otetaan vastaan.

---

<div class="post-metadata">

**Author:** ![otso](https://f.ruuvi.com/user_avatar/f.ruuvi.com/otso/32/1651_2.png) [@otso](https://f.ruuvi.com/u/otso)\
**Post date:** [8 March 2022 07:51 UTC](https://f.ruuvi.com/t/gatewayn-liittaminen-azure-iot-hubiin/5447/5 "2022-03-08T07:51:12Z")

</div>

Mittaustieto on tuossa “data”-merkkijonossa, se on koko Bluetooth-lähetys.

Sen purkamisesta on kerrottu enemmän dokumentaatiossamme: [https://docs.ruuvi.com/communication/bluetooth-advertisements](https://docs.ruuvi.com/communication/bluetooth-advertisements)

---

<div class="post-metadata">

**Author:** ![huikkis](https://f.ruuvi.com/user_avatar/f.ruuvi.com/huikkis/32/2793_2.png) [@huikkis](https://f.ruuvi.com/u/huikkis)\
**Post date:** [8 March 2022 14:10 UTC](https://f.ruuvi.com/t/gatewayn-liittaminen-azure-iot-hubiin/5447/6 "2022-03-08T14:10:40Z")

</div>

OK. Täytyy jatkaa tutkimuksia siis Azuren puolella. Saan kyllä monenlaista tietoa näkymään siellä mutta juurikin nuo lämpötila yms. tiedot ovat vielä hakusessa.  
Tässäkin tietysti voi valaista tietämätöntä eteenpäin.

---

<div class="post-metadata">

**Author:** ![VilleT](https://f.ruuvi.com/letter_avatar_proxy/v4/letter/v/ecccb3/32.png) [@VilleT](https://f.ruuvi.com/u/VilleT)\
**Post date:** [10 March 2022 10:18 UTC](https://f.ruuvi.com/t/gatewayn-liittaminen-azure-iot-hubiin/5447/7 "2022-03-10T10:18:48Z")

</div>

Sain itsekin vihdoin toimimaan downgradetulla firmwarella. Hoidan bluetooth broadcastin decoodaamisen Azure funkkarilla ja [GitHub - ruuvi-friends/ruuvi-decoders: Decoders for extracting data from Ruuvi raw payloads](https://github.com/ruuvi-friends/ruuvi-decoders)

---

<div class="post-metadata">

**Author:** ![ossi.laakkonen](https://f.ruuvi.com/letter_avatar_proxy/v4/letter/o/5e9695/32.png) [@ossi.laakkonen](https://f.ruuvi.com/u/ossi.laakkonen)\
**Post date:** [24 March 2022 13:20 UTC](https://f.ruuvi.com/t/gatewayn-liittaminen-azure-iot-hubiin/5447/8 "2022-03-24T13:20:26Z")

</div>

Azuren päässä IoT hubin perään Azure Function App ja sinne funktio tuolta GitHubista purkamaan data-kentän merkkijono erillisiksi mittauksiksi.
